Skip to content

Commit 6992b40

Browse files
committed
Fixed condition where a box was checked when it shouldn't have been
1 parent 211b83d commit 6992b40

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

core.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,9 @@ def add_option(self, item: QTreeWidgetItem):
464464

465465
if option:
466466
if option in self.settings[item.data(0, 32)]['options']:
467-
self.alert_message('Error', 'That option already exsists!', '')
467+
self.alert_message('Error', 'That option already exists!', '')
468468
item.treeWidget().blockSignals(False)
469-
return
469+
return True
470470

471471
new_option = ParameterTree.make_option(option.strip(),
472472
item,
@@ -501,10 +501,14 @@ def add_option(self, item: QTreeWidgetItem):
501501

502502
self.file_handler.save_settings(self.settings.settings_data)
503503

504-
item.treeWidget().blockSignals(False)
505-
504+
item.treeWidget().blockSignals(False)
505+
return True
506+
else:
507+
item.treeWidget().blockSignals(False)
508+
return False
506509
else:
507510
self.alert_message('Error!', 'The specified option does not take arguments!', None)
511+
return False
508512
# print('Doesn\'t have an option')
509513

510514
def move_item(self, item: QTreeWidgetItem, favorite: bool):
@@ -676,7 +680,13 @@ def parameter_updater(self, item: QTreeWidgetItem, col=None, save=True):
676680
result = self.alert_message('Warning!', 'This parameter needs an option!', 'There are no options!\n'
677681
'Would you make one?', True)
678682
if result == QMessageBox.Yes:
679-
self.add_option(item)
683+
success = self.add_option(item)
684+
685+
if not success:
686+
item.treeWidget().blockSignals(True)
687+
item.setCheckState(0, Qt.Unchecked)
688+
item.treeWidget().blockSignals(False)
689+
item.treeWidget().check_dependency(item)
680690
else:
681691
item.treeWidget().blockSignals(True)
682692
item.setCheckState(0, Qt.Unchecked)

0 commit comments

Comments
 (0)