From d16dd57e8a3fb3874f9505c6702fcd398e0e65a1 Mon Sep 17 00:00:00 2001 From: Travis Abendshien <46939827+CyanVoxel@users.noreply.github.com> Date: Sun, 29 Dec 2024 23:44:16 -0800 Subject: [PATCH] fix: move theme check inside class --- .../src/qt/widgets/preview/file_attributes.py | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/tagstudio/src/qt/widgets/preview/file_attributes.py b/tagstudio/src/qt/widgets/preview/file_attributes.py index 23f20720..b564f6e1 100644 --- a/tagstudio/src/qt/widgets/preview/file_attributes.py +++ b/tagstudio/src/qt/widgets/preview/file_attributes.py @@ -37,33 +37,6 @@ class FileAttributes(QWidget): tags_updated = Signal() - label_bg_color = ( - Theme.COLOR_BG_DARK.value - if QGuiApplication.styleHints().colorScheme() is Qt.ColorScheme.Dark - else Theme.COLOR_DARK_LABEL.value - ) - - # panel_bg_color = ( - # Theme.COLOR_BG_DARK.value - # if QGuiApplication.styleHints().colorScheme() is Qt.ColorScheme.Dark - # else Theme.COLOR_BG_LIGHT.value - # ) - - file_label_style = "font-size: 12px" - properties_style = ( - f"background-color:{label_bg_color};" - "color:#FFFFFF;" - "font-family:Oxanium;" - "font-weight:bold;" - "font-size:12px;" - "border-radius:3px;" - "padding-top: 4px;" - "padding-right: 1px;" - "padding-bottom: 1px;" - "padding-left: 1px;" - ) - date_style = "font-size:12px;" - def __init__(self, library: Library, driver: "QtDriver"): super().__init__() # self.is_connected = False @@ -76,29 +49,56 @@ class FileAttributes(QWidget): root_layout.setContentsMargins(0, 0, 0, 0) root_layout.setSpacing(6) + label_bg_color = ( + Theme.COLOR_BG_DARK.value + if QGuiApplication.styleHints().colorScheme() is Qt.ColorScheme.Dark + else Theme.COLOR_DARK_LABEL.value + ) + + # panel_bg_color = ( + # Theme.COLOR_BG_DARK.value + # if QGuiApplication.styleHints().colorScheme() is Qt.ColorScheme.Dark + # else Theme.COLOR_BG_LIGHT.value + # ) + + self.date_style = "font-size:12px;" + self.file_label_style = "font-size: 12px" + self.properties_style = ( + f"background-color:{label_bg_color};" + "color:#FFFFFF;" + "font-family:Oxanium;" + "font-weight:bold;" + "font-size:12px;" + "border-radius:3px;" + "padding-top: 4px;" + "padding-right: 1px;" + "padding-bottom: 1px;" + "padding-left: 1px;" + ) + self.file_label = FileOpenerLabel() self.file_label.setObjectName("filenameLabel") self.file_label.setTextFormat(Qt.TextFormat.RichText) self.file_label.setWordWrap(True) self.file_label.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse) - self.file_label.setStyleSheet(FileAttributes.file_label_style) + self.file_label.setStyleSheet(self.file_label_style) self.date_created_label = QLabel() self.date_created_label.setObjectName("dateCreatedLabel") self.date_created_label.setAlignment(Qt.AlignmentFlag.AlignLeft) self.date_created_label.setTextFormat(Qt.TextFormat.RichText) - self.date_created_label.setStyleSheet(FileAttributes.date_style) + self.date_created_label.setStyleSheet(self.date_style) self.date_modified_label = QLabel() self.date_modified_label.setObjectName("dateModifiedLabel") self.date_modified_label.setAlignment(Qt.AlignmentFlag.AlignLeft) self.date_modified_label.setTextFormat(Qt.TextFormat.RichText) - self.date_modified_label.setStyleSheet(FileAttributes.date_style) + self.date_modified_label.setStyleSheet(self.date_style) self.dimensions_label = QLabel() self.dimensions_label.setObjectName("dimensionsLabel") self.dimensions_label.setWordWrap(True) - self.dimensions_label.setStyleSheet(FileAttributes.properties_style) + self.dimensions_label.setStyleSheet(self.properties_style) self.date_container = QWidget() date_layout = QVBoxLayout(self.date_container)