mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-20 06:34:05 +00:00
Add tooltips to theme combox box items, providing a description
This commit is contained in:
@@ -58,6 +58,7 @@ from picard.ui.theme import (
|
||||
AVAILABLE_UI_THEMES,
|
||||
OS_SUPPORTS_THEMES,
|
||||
UiTheme,
|
||||
theme_enum_to_desc,
|
||||
theme_enum_to_label,
|
||||
)
|
||||
from picard.ui.ui_options_interface import Ui_InterfaceOptionsPage
|
||||
@@ -175,6 +176,8 @@ class InterfaceOptionsPage(OptionsPage):
|
||||
self.ui.ui_theme.clear()
|
||||
for theme in AVAILABLE_UI_THEMES:
|
||||
self.ui.ui_theme.addItem(_(theme_enum_to_label(theme)), theme)
|
||||
idx = self.ui.ui_theme.findData(theme)
|
||||
self.ui.ui_theme.setItemData(idx, _(theme_enum_to_desc(theme)), QtCore.Qt.ToolTipRole)
|
||||
self.ui.ui_theme.setCurrentIndex(self.ui.ui_theme.findData(UiTheme.DEFAULT))
|
||||
|
||||
self.ui.ui_language.addItem(_('System default'), '')
|
||||
|
||||
@@ -73,15 +73,31 @@ class UiTheme(Enum):
|
||||
# example to display translated "System" theme name: _(UI_THEMES[UiTheme.DEFAULT])
|
||||
# here strings are just marked for translation
|
||||
_UI_THEME_LABELS = {
|
||||
UiTheme.DEFAULT: N_('Default'),
|
||||
UiTheme.DARK: N_('Dark'),
|
||||
UiTheme.LIGHT: N_('Light'),
|
||||
UiTheme.SYSTEM: N_('System'),
|
||||
UiTheme.DEFAULT: {
|
||||
'label': N_('Default'),
|
||||
'desc': N_('The default color scheme based on the operating system display settings'),
|
||||
},
|
||||
UiTheme.DARK: {
|
||||
'label': N_('Dark'),
|
||||
'desc': N_('A dark display theme'),
|
||||
},
|
||||
UiTheme.LIGHT: {
|
||||
'label': N_('Light'),
|
||||
'desc': N_('A light display theme'),
|
||||
},
|
||||
UiTheme.SYSTEM: {
|
||||
'label': N_('System'),
|
||||
'desc': N_('The Qt5 theme configured in the desktop environment'),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def theme_enum_to_label(theme):
|
||||
return _UI_THEME_LABELS[theme]
|
||||
return _UI_THEME_LABELS[theme]['label']
|
||||
|
||||
|
||||
def theme_enum_to_desc(theme):
|
||||
return _UI_THEME_LABELS[theme]['desc']
|
||||
|
||||
|
||||
AVAILABLE_UI_THEMES = [UiTheme.DEFAULT]
|
||||
|
||||
Reference in New Issue
Block a user