Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion picard/ui/options/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,13 @@ def accept(self):
self._show_page_error(page, e)
return

for page in sorted(self.loaded_pages, key=lambda p: (p.SORT_ORDER, p.NAME)):
# Force the `profiles` page to always save first to avoid an error when
# saving settings to a new profile that has been marked as enabled.
pages = [
self.get_page('profiles'),
]
pages.extend(x for x in sorted(self.loaded_pages, key=lambda p: (p.SORT_ORDER, p.NAME)) if x.NAME != 'profiles')
for page in pages:
try:
page.save()
except Exception as e:
Expand Down
4 changes: 1 addition & 3 deletions picard/ui/options/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ class ProfilesOptionsPage(OptionsPage):
NAME = 'profiles'
TITLE = N_("Option Profiles")
PARENT = None
# Set SORT_ORDER to negative number to ensure the profiles page is saved first to avoid
# an error when saving settings to a new profile that has been marked as enabled.
SORT_ORDER = -100
SORT_ORDER = 10
ACTIVE = True
HELP_URL = "/config/options_profiles.html"

Expand Down
Loading