Skip to content

Commit

Permalink
Introduce register_profile_highlights()
Browse files Browse the repository at this point in the history
  • Loading branch information
zas committed Apr 25, 2024
1 parent 7676177 commit 29b4471
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
16 changes: 5 additions & 11 deletions picard/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,7 @@ class UserProfileGroups():
# Each item in "settings" is a tuple of the setting key, the display title, and a list of the names of the widgets to highlight
SETTINGS_GROUPS['general'] = {
'title': N_("General"),
'settings': [
SettingDesc('server_host', ['server_host']),
SettingDesc('server_port', ['server_port']),
SettingDesc('analyze_new_files', ['analyze_new_files']),
SettingDesc('cluster_new_files', ['cluster_new_files']),
SettingDesc('ignore_file_mbids', ['ignore_file_mbids']),
SettingDesc('check_for_plugin_updates', ['check_for_plugin_updates']),
SettingDesc('check_for_updates', ['check_for_updates']),
SettingDesc('update_check_days', ['update_check_days']),
SettingDesc('update_level', ['update_level']),
],
'settings': [],
}

SETTINGS_GROUPS['metadata'] = {
Expand Down Expand Up @@ -269,3 +259,7 @@ def get_setting_groups_list(cls):
str: Key
"""
yield from cls.SETTINGS_GROUPS


def register_profile_highlights(group, option, higlights):
UserProfileGroups.SETTINGS_GROUPS[group]['settings'].append(SettingDesc(option, higlights))
10 changes: 10 additions & 0 deletions picard/ui/options/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
gettext as _,
gettext_constants,
)
from picard.profile import register_profile_highlights
from picard.util.mbserver import is_official_server

from picard.ui.options import (
Expand Down Expand Up @@ -75,6 +76,15 @@ def __init__(self, parent=None):
self.ui.login_error.setStyleSheet(self.STYLESHEET_ERROR)
self.ui.login_error.hide()
self.update_login_logout()
register_profile_highlights('general', 'server_host', ['server_host'])
register_profile_highlights('general', 'server_port', ['server_port'])
register_profile_highlights('general', 'analyze_new_files', ['analyze_new_files'])
register_profile_highlights('general', 'cluster_new_files', ['cluster_new_files'])
register_profile_highlights('general', 'ignore_file_mbids', ['ignore_file_mbids'])
register_profile_highlights('general', 'check_for_plugin_updates', ['check_for_plugin_updates'])
register_profile_highlights('general', 'check_for_updates', ['check_for_updates'])
register_profile_highlights('general', 'update_check_days', ['update_check_days'])
register_profile_highlights('general', 'update_level', ['update_level'])

def load(self):
config = get_config()
Expand Down

0 comments on commit 29b4471

Please sign in to comment.