diff --git a/picard/profile.py b/picard/profile.py index baeed01ac..2809cf7fa 100644 --- a/picard/profile.py +++ b/picard/profile.py @@ -25,8 +25,6 @@ from collections import namedtuple -from picard.i18n import N_ - SettingDesc = namedtuple('SettingDesc', ('name', 'fields')) @@ -35,19 +33,12 @@ class UserProfileGroups(): """Provides information about the profile groups available for selecting in a user profile, and the title and settings that apply to each profile group. """ - _settings_groups = { - 'general': {'title': N_("General")}, - 'metadata': {'title': N_("Metadata")}, - 'tags': {'title': N_("Tags")}, - 'cover': {'title': N_("Cover Art")}, - 'filerenaming': {'title': N_("File Naming")}, - 'scripting': {'title': N_("Scripting")}, - 'interface': {'title': N_("User Interface")}, - 'advanced': {'title': N_("Advanced")}, - } + _settings_groups = {} @classmethod - def append_to_group(cls, group, option, highlights): + def append_to_group(cls, group, option, highlights, title=None): + if group not in cls._settings_groups: + cls._settings_groups[group] = {'title': title or group} if 'settings' not in cls._settings_groups[group]: cls._settings_groups[group]['settings'] = [] cls._settings_groups[group]['settings'].append(SettingDesc(option, highlights)) @@ -77,8 +68,7 @@ class UserProfileGroups(): @classmethod def group_from_page(cls, page): try: - name = page.PARENT if page.PARENT in cls._settings_groups else page.NAME - return cls._settings_groups[name] + return cls._settings_groups[page.NAME] except (AttributeError, KeyError): pass return None diff --git a/picard/ui/options/__init__.py b/picard/ui/options/__init__.py index b96993918..714f8afc5 100644 --- a/picard/ui/options/__init__.py +++ b/picard/ui/options/__init__.py @@ -137,8 +137,7 @@ class OptionsPage(QtWidgets.QWidget): raise Exception(f"Cannot register setting for non-existing option {name}") self._registered_settings.append(option) if highlights is not None: - page_name = self.PARENT if self.PARENT else self.NAME - UserProfileGroups.append_to_group(page_name, name, tuple(highlights)) + UserProfileGroups.append_to_group(self.NAME, name, tuple(highlights), title=self.TITLE) _pages = ExtensionPoint(label='pages') diff --git a/picard/ui/options/profiles.py b/picard/ui/options/profiles.py index 5cfd87316..695667f71 100644 --- a/picard/ui/options/profiles.py +++ b/picard/ui/options/profiles.py @@ -211,7 +211,7 @@ class ProfilesOptionsPage(OptionsPage): return self.building_tree = True for group in UserProfileGroups.values(): - title = group['title'] + title = _(group['title']) group_settings = group['settings'] widget_item = QtWidgets.QTreeWidgetItem([title]) widget_item.setFlags(QtCore.Qt.ItemFlag.ItemIsEnabled | QtCore.Qt.ItemFlag.ItemIsUserCheckable | QtCore.Qt.ItemFlag.ItemIsAutoTristate)