Skip to content

Commit

Permalink
Don't display the warning when enabling/diabbling option profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
rdswift committed Jan 28, 2024
1 parent ed4079a commit c034636
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions picard/ui/options/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,14 @@ def fcmp(x):
if not OS_SUPPORTS_THEMES:
self.ui.ui_theme_container.hide()

self.loading = False
self.warning_displayed = False
self.ui.toolbar_multiselect.stateChanged.connect(self.multi_selection_warning)

def load(self):
# Don't display the multi-selection warning when loading values.
# This is required because loading a different option profile could trigger the warning.
self.ui.toolbar_multiselect.blockSignals(True)

config = get_config()
self.loading = True
self.ui.toolbar_show_labels.setChecked(config.setting['toolbar_show_labels'])
self.ui.toolbar_multiselect.setChecked(config.setting['toolbar_multiselect'])
self.ui.show_menu_icons.setChecked(config.setting['show_menu_icons'])
Expand All @@ -165,13 +166,12 @@ def load(self):
self.ui.starting_directory_path.setText(config.setting['starting_directory_path'])
current_theme = UiTheme(config.setting['ui_theme'])
self.ui.ui_theme.setCurrentIndex(self.ui.ui_theme.findData(current_theme))
self.loading = False

# re-enable the multi-selection warning
self.ui.toolbar_multiselect.blockSignals(False)

def save(self):
config = get_config()
# Only display warning dialog if it has not been displayed during this Options session.
if not self.warning_displayed:
self.multi_selection_warning()
config.setting['toolbar_show_labels'] = self.ui.toolbar_show_labels.isChecked()
config.setting['toolbar_multiselect'] = self.ui.toolbar_multiselect.isChecked()
config.setting['show_menu_icons'] = self.ui.show_menu_icons.isChecked()
Expand Down Expand Up @@ -218,10 +218,9 @@ def starting_directory_browse(self):
item.setText(path)

def multi_selection_warning(self):
if self.loading or not self.ui.toolbar_multiselect.isChecked():
if not self.ui.toolbar_multiselect.isChecked():
return

self.warning_displayed = True
dialog = QtWidgets.QMessageBox(
QtWidgets.QMessageBox.Icon.Warning,
_('Option Setting Warning'),
Expand Down

0 comments on commit c034636

Please sign in to comment.