Skip to content

Commit

Permalink
[supervision] prevent removing module settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien-B committed Dec 16, 2022
1 parent 0857afa commit e9045d3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sw/supervision/python/conf_settings_widget.py
Expand Up @@ -15,6 +15,7 @@ def __init__(self, parent=None):
self.setupUi(self)
self.add_setting_button.clicked.connect(self.open_setting)
self.remove_setting_button.clicked.connect(self.remove_setting)
self.settings.currentItemChanged.connect(self.set_remove_button_state)

def open_setting(self):
base_settings_path = os.path.join(utils.CONF_DIR, "settings")
Expand All @@ -32,3 +33,9 @@ def remove_setting(self):
self.settings.takeItem(row)
self.settings_changed.emit()

def set_remove_button_state(self, item: QListWidgetItem, _):
if item.text().startswith("modules/"):
self.remove_setting_button.setDisabled(True)
else:
self.remove_setting_button.setDisabled(False)

0 comments on commit e9045d3

Please sign in to comment.