From 41d2d013c8de565fdf0e1bd714426ed246ee9836 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Tue, 21 May 2024 11:07:42 +0200 Subject: [PATCH 1/2] Make row highlight configurable This one is used to highlight current album in release group search from Other versions dialog Defaults are unchanged. --- picard/ui/colors.py | 3 +++ picard/ui/tablebaseddialog.py | 10 ++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/picard/ui/colors.py b/picard/ui/colors.py index 1f0cfeba7..2e866f6b3 100644 --- a/picard/ui/colors.py +++ b/picard/ui/colors.py @@ -47,6 +47,7 @@ _COLOR_DESCRIPTIONS = { 'log_warning': N_('Log view text (warning)'), 'profile_hl_bg': N_("Profile highlight background"), 'profile_hl_fg': N_("Profile highlight foreground"), + 'row_highlight': N_("Row Highlight"), 'tagstatus_added': N_("Tag added"), 'tagstatus_changed': N_("Tag changed"), 'tagstatus_removed': N_("Tag removed"), @@ -90,6 +91,8 @@ register_color(_DARK, 'profile_hl_fg', '#FFFFFF') register_color(_LIGHT, 'profile_hl_fg', '#000000') register_color(_DARK, 'profile_hl_bg', '#000080') register_color(_LIGHT, 'profile_hl_bg', '#F9F906') +register_color(_LIGHT, 'row_highlight', '#FFFFE0') +register_color(_DARK, 'row_highlight', '#90907E') class InterfaceColors: diff --git a/picard/ui/tablebaseddialog.py b/picard/ui/tablebaseddialog.py index b51f3e8cb..ea3dbdb97 100644 --- a/picard/ui/tablebaseddialog.py +++ b/picard/ui/tablebaseddialog.py @@ -45,7 +45,7 @@ from picard.util import ( ) from picard.ui import PicardDialog -from picard.ui.theme import theme +from picard.ui.colors import interface_colors class ResultTable(QtWidgets.QTableWidget): @@ -183,13 +183,7 @@ class TableBasedDialog(PicardDialog): def highlight_row(self, row): model = self.table.model() - highlight_color = QtGui.QColor('LightYellow') - if theme.is_dark_theme: - highlight_color.setHsv( - highlight_color.hue(), - highlight_color.saturation(), - int(highlight_color.lightness() * .6), - highlight_color.alpha()) + highlight_color = interface_colors.get_qcolor('row_highlight') highlight_brush = QtGui.QBrush(highlight_color) for column in range(0, model.columnCount()): index = model.index(row, column) From 444d9067a24f50444a29387b6cbd2def58010432 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Tue, 21 May 2024 11:16:40 +0200 Subject: [PATCH 2/2] Make color of first cover highlight configurable --- picard/ui/colors.py | 3 +++ picard/ui/coverartbox.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/picard/ui/colors.py b/picard/ui/colors.py index 2e866f6b3..ac56620f7 100644 --- a/picard/ui/colors.py +++ b/picard/ui/colors.py @@ -41,6 +41,7 @@ _COLOR_DESCRIPTIONS = { 'entity_error': N_("Errored entity"), 'entity_pending': N_("Pending entity"), 'entity_saved': N_("Saved entity"), + 'first_cover_hl': N_("First cover art"), 'log_debug': N_('Log view text (debug)'), 'log_error': N_('Log view text (error)'), 'log_info': N_('Log view text (info)'), @@ -93,6 +94,8 @@ register_color(_DARK, 'profile_hl_bg', '#000080') register_color(_LIGHT, 'profile_hl_bg', '#F9F906') register_color(_LIGHT, 'row_highlight', '#FFFFE0') register_color(_DARK, 'row_highlight', '#90907E') +register_color(_LIGHT, 'first_cover_hl', 'darkgoldenrod') +register_color(_DARK, 'first_cover_hl', 'orange') class InterfaceColors: diff --git a/picard/ui/coverartbox.py b/picard/ui/coverartbox.py index 79165a75e..aee781816 100644 --- a/picard/ui/coverartbox.py +++ b/picard/ui/coverartbox.py @@ -63,6 +63,7 @@ from picard.util import ( ) from picard.util.lrucache import LRUCache +from picard.ui.colors import interface_colors from picard.ui.item import FileListItem from picard.ui.widgets import ActiveLabel @@ -293,9 +294,9 @@ class CoverArtThumbnail(ActiveLabel): cx -= displacements cy += displacements if not has_common_images: - # Draw a golden highlight around the first cover to indicate that + # Draw a highlight around the first cover to indicate that # images are not common to all selected items - color = QtGui.QColor('darkgoldenrod') + color = interface_colors.get_qcolor('first_cover_hl') border_length = 10 for k in range(border_length): color.setAlpha(255 - k * 255 // border_length)