diff --git a/blivetgui/actions_menu.py b/blivetgui/actions_menu.py index d819a90d..369615d7 100644 --- a/blivetgui/actions_menu.py +++ b/blivetgui/actions_menu.py @@ -76,7 +76,8 @@ def activate_menu_items(self, menu_item_names): """ for item in menu_item_names: - self.menu_items[item].set_sensitive(True) + if item in self.menu_items.keys(): + self.menu_items[item].set_sensitive(True) def deactivate_menu_items(self, menu_item_names): """ Deactivate selected buttons @@ -87,7 +88,8 @@ def deactivate_menu_items(self, menu_item_names): """ for item in menu_item_names: - self.menu_items[item].set_sensitive(True) + if item in self.menu_items.keys(): + self.menu_items[item].set_sensitive(False) def deactivate_all(self): """ Deactivate all partition based buttons diff --git a/blivetgui/actions_toolbar.py b/blivetgui/actions_toolbar.py index 98caf716..e19366b1 100644 --- a/blivetgui/actions_toolbar.py +++ b/blivetgui/actions_toolbar.py @@ -85,7 +85,8 @@ def activate_buttons(self, button_names): """ for button in button_names: - self.buttons[button].set_sensitive(True) + if button in self.buttons.keys(): + self.buttons[button].set_sensitive(True) def deactivate_buttons(self, button_names): """ Deactivate selected buttons @@ -96,7 +97,8 @@ def deactivate_buttons(self, button_names): """ for button in button_names: - self.buttons[button].set_sensitive(False) + if button in self.buttons.keys(): + self.buttons[button].set_sensitive(False) def deactivate_all(self): """ Deactivate all partition based buttons diff --git a/blivetgui/blivetgui.py b/blivetgui/blivetgui.py index 89aaf92c..dd480b66 100644 --- a/blivetgui/blivetgui.py +++ b/blivetgui/blivetgui.py @@ -161,9 +161,7 @@ def activate_options(self, activate_list): for item in activate_list: self.toolbar.activate_buttons([item]) self.main_menu.activate_menu_items([item]) - - if item not in ("apply", "clear", "undo"): - self.popup_menu.activate_menu_items([item]) + self.popup_menu.activate_menu_items([item]) def deactivate_options(self, deactivate_list): """ Deactivate toolbar buttons and menu items @@ -176,9 +174,7 @@ def deactivate_options(self, deactivate_list): for item in deactivate_list: self.toolbar.deactivate_buttons([item]) self.main_menu.deactivate_menu_items([item]) - - if item not in ("apply", "clear", "undo"): - self.popup_menu.deactivate_menu_items([item]) + self.popup_menu.deactivate_menu_items([item]) def deactivate_all_options(self): """ Deactivate all partition-based buttons/menu items diff --git a/blivetgui/main_menu.py b/blivetgui/main_menu.py index e96f1661..49952957 100644 --- a/blivetgui/main_menu.py +++ b/blivetgui/main_menu.py @@ -165,7 +165,8 @@ def activate_menu_items(self, menu_item_names): """ for item in menu_item_names: - self.menu_items[item].set_sensitive(True) + if item in self.menu_items.keys(): + self.menu_items[item].set_sensitive(True) def deactivate_menu_items(self, menu_item_names): """ Deactivate selected buttons @@ -176,7 +177,8 @@ def deactivate_menu_items(self, menu_item_names): """ for item in menu_item_names: - self.menu_items[item].set_sensitive(False) + if item in self.menu_items.keys(): + self.menu_items[item].set_sensitive(False) def deactivate_all(self): """ Deactivate all partition based buttons