From 9c469099734ec7fc0cfc72117fd513073c86f5af Mon Sep 17 00:00:00 2001 From: dervart Date: Tue, 30 Jun 2026 19:09:34 +0700 Subject: [PATCH] refactor: styles for library controls popup and filter combobox --- portprotonqt/tabs/library_tab.py | 6 +- portprotonqt/themes/classic-light/styles.py | 73 ----------------- portprotonqt/themes/classic/styles.py | 73 ----------------- portprotonqt/themes/standart-light/styles.py | 80 +++---------------- portprotonqt/themes/standart/styles/base.py | 9 +++ .../themes/standart/styles/constants.py | 1 + .../themes/standart/styles/detail_page.py | 71 ---------------- 7 files changed, 22 insertions(+), 291 deletions(-) diff --git a/portprotonqt/tabs/library_tab.py b/portprotonqt/tabs/library_tab.py index 87768323..835d1e2d 100644 --- a/portprotonqt/tabs/library_tab.py +++ b/portprotonqt/tabs/library_tab.py @@ -71,8 +71,7 @@ class MainWindowLibraryTabMixin(_MainWindowTypingBase): ) combo.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) combo.addItems(labels) - combo_style = getattr(self.theme, "LIBRARY_FILTER_COMBOBOX_STYLE", self.theme.COMBOBOX_STYLE) - combo.setStyleSheet(combo_style + self.theme.SCROLL_STYLE) + combo.setStyleSheet(self.theme.COMBOBOX_STYLE + self.theme.SCROLL_STYLE) combo.setFocusPolicy(Qt.FocusPolicy.StrongFocus) self._register_gamepad_tooltip(combo, tooltip) return combo @@ -112,8 +111,9 @@ class MainWindowLibraryTabMixin(_MainWindowTypingBase): def _create_library_controls_widget(self) -> QHBoxLayout: self.libraryControlsWidget = QWidget(self) controls_layout = QHBoxLayout(self.libraryControlsWidget) - controls_layout.setContentsMargins(0, 0, 0, 0) + controls_layout.setContentsMargins(5, 5, 5, 5) controls_layout.setSpacing(10) + self.libraryControlsWidget.setStyleSheet(self.theme.LIBRARY_CONTROL_STYLE) return controls_layout def _position_library_controls_widget(self) -> None: diff --git a/portprotonqt/themes/classic-light/styles.py b/portprotonqt/themes/classic-light/styles.py index 0b39b27b..5c86da06 100644 --- a/portprotonqt/themes/classic-light/styles.py +++ b/portprotonqt/themes/classic-light/styles.py @@ -228,79 +228,6 @@ LIBRARY_CONTROLS_BUTTON_STYLE = f""" }} """ -LIBRARY_FILTER_COMBOBOX_STYLE = f""" - QComboBox {{ - background: {color_bg}; - border: {border_thin} {color_text}; - border-radius: {border_radius_small}; - padding-left: 12px; - height: 30px; - color: {color_text_dark}; - font-family: '{font_family}'; - font-size: {font_size_normal}; - min-width: 120px; - combobox-popup: 0; - }} - QComboBox:hover, QComboBox:focus {{ - background: {color_bg}; - border: {border_thin} {color_accent}; - }} - QComboBox:on {{ - background: {color_bg}; - border: {border_thin} {color_accent}; - border-bottom-style: none; - border-top-left-radius: {border_radius_small}; - border-top-right-radius: {border_radius_small}; - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; - }} - QComboBox::drop-down {{ - subcontrol-origin: padding; - subcontrol-position: center right; - border-left: {border_thin} {color_border_faint}; - padding: 12px; - height: 12px; - width: 12px; - }} - QComboBox::down-arrow {{ - image: url(%s); - padding: 12px; - height: 10px; - width: 10px; - }} - QComboBox::down-arrow:on {{ - image: url(%s); - padding: 12px; - height: 10px; - width: 10px; - }} - QComboBox QAbstractItemView {{ - outline: none; - background: {color_surface}; - border: {border_thin} {color_accent}; - border-top-style: none; - border-top-left-radius: 0px; - border-top-right-radius: 0px; - border-bottom-left-radius: {border_radius_small}; - border-bottom-right-radius: {border_radius_small}; - }} - QComboBox QAbstractItemView::item {{ - padding: 3px 3px 3px 6px; - margin: 1px; - min-height: 24px; - border-radius: {border_radius_small}; - color: {color_text_dark}; - }} - QComboBox QAbstractItemView::item:hover, - QComboBox QAbstractItemView::item:selected {{ - background: {color_accent}; - color: {color_text_dark}; - }} -""" % ( - theme_manager.get_icon("down", current_theme_name, as_path=True), - theme_manager.get_icon("up", current_theme_name, as_path=True), -) - SEARCH_EDIT_STYLE = f""" QLineEdit {{ background: {color_bg}; diff --git a/portprotonqt/themes/classic/styles.py b/portprotonqt/themes/classic/styles.py index d394c7c5..18e4d741 100644 --- a/portprotonqt/themes/classic/styles.py +++ b/portprotonqt/themes/classic/styles.py @@ -176,79 +176,6 @@ LIBRARY_CONTROLS_BUTTON_STYLE = f""" }} """ -LIBRARY_FILTER_COMBOBOX_STYLE = f""" - QComboBox {{ - background: {color_surface_elevated}; - border: {border_thin} transparent; - border-radius: {border_radius_small}; - padding-left: 12px; - height: 30px; - color: {color_text}; - font-family: '{font_family}'; - font-size: {font_size_normal}; - min-width: 120px; - combobox-popup: 0; - }} - QComboBox:hover, QComboBox:focus {{ - background: {color_accent}; - border: {border_thin} {color_accent}; - }} - QComboBox:on {{ - background: {color_surface_elevated}; - border: {border_thin} {color_accent}; - border-bottom-style: none; - border-top-left-radius: {border_radius_small}; - border-top-right-radius: {border_radius_small}; - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; - }} - QComboBox::drop-down {{ - subcontrol-origin: padding; - subcontrol-position: center right; - border-left: {border_thin} {color_border_faint}; - padding: 12px; - height: 12px; - width: 12px; - }} - QComboBox::down-arrow {{ - image: url(%s); - padding: 12px; - height: 10px; - width: 10px; - }} - QComboBox::down-arrow:on {{ - image: url(%s); - padding: 12px; - height: 10px; - width: 10px; - }} - QComboBox QAbstractItemView {{ - outline: none; - background: {color_surface}; - border: {border_thin} {color_accent}; - border-top-style: none; - border-top-left-radius: 0px; - border-top-right-radius: 0px; - border-bottom-left-radius: {border_radius_small}; - border-bottom-right-radius: {border_radius_small}; - }} - QComboBox QAbstractItemView::item {{ - padding: 3px 3px 3px 6px; - margin: 1px; - min-height: 24px; - border-radius: {border_radius_small}; - color: {color_text}; - }} - QComboBox QAbstractItemView::item:hover, - QComboBox QAbstractItemView::item:selected {{ - background: {color_accent}; - color: {color_text}; - }} -""" % ( - theme_manager.get_icon("down", current_theme_name, as_path=True), - theme_manager.get_icon("up", current_theme_name, as_path=True), -) - SEARCH_EDIT_STYLE = f""" QLineEdit {{ background: {color_bg}; diff --git a/portprotonqt/themes/standart-light/styles.py b/portprotonqt/themes/standart-light/styles.py index 3157b988..bfeb5e23 100644 --- a/portprotonqt/themes/standart-light/styles.py +++ b/portprotonqt/themes/standart-light/styles.py @@ -44,6 +44,7 @@ border_radius_card = "20px" border_radius_badge = "5px" color_accent = "#70b8ff" color_bg = "#F8F9FC" +color_bg_darker = "#bfc0c7" color_surface = "#F0F2F5" color_surface_elevated = "#E9ECEF" color_surface_hover = "#DEE2E6" @@ -595,6 +596,14 @@ LIBRARY_WIDGET_STYLE = f""" }} """ +LIBRARY_CONTROL_STYLE = f""" + QWidget {{ + background: {color_bg_darker}; + border: {border_thin} {color_accent}; + border-radius: {border_radius_small}; + }} +""" + # CONTAINER_STYLE CONTAINER_STYLE= """ QWidget { @@ -1015,77 +1024,6 @@ LIBRARY_CONTROLS_BUTTON_STYLE = f""" }} """ -LIBRARY_FILTER_COMBOBOX_STYLE = f""" - QComboBox {{ - background: {color_bg}; - border: {border_thin} {color_text}; - border-radius: {border_radius_small}; - padding-left: 12px; - height: 34px; - color: {color_text_dark}; - font-family: '{font_family}'; - font-size: {font_size_normal}; - min-width: 120px; - combobox-popup: 0; - }} - QComboBox:hover, - QComboBox:focus {{ - background: {color_bg}; - border: {border_thin} {color_accent}; - }} - QComboBox:on {{ - background: {color_bg}; - border: {border_thin} {color_accent}; - border-bottom-style: none; - border-top-left-radius: 10px; - border-top-right-radius: 10px; - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; - }} - QComboBox::drop-down {{ - subcontrol-origin: padding; - subcontrol-position: center right; - border-left: {border_thin} {color_border_faint}; - padding: 12px; - height: 12px; - width: 12px; - }} - QComboBox::down-arrow {{ - image: url({theme_manager.get_icon("down", current_theme_name, as_path=True)}); - padding: 12px; - height: 12px; - width: 12px; - }} - QComboBox::down-arrow:on {{ - image: url({theme_manager.get_icon("up", current_theme_name, as_path=True)}); - padding: 12px; - height: 12px; - width: 12px; - }} - QComboBox QAbstractItemView {{ - outline: none; - background: {color_surface}; - border: {border_thin} {color_accent}; - border-top-style: none; - border-top-left-radius: 0px; - border-top-right-radius: 0px; - border-bottom-left-radius: 10px; - border-bottom-right-radius: 10px; - }} - QComboBox QAbstractItemView::item {{ - padding: 7px 7px 7px 12px; - margin: 3px; - min-height: 24px; - border-radius: {border_radius_small}; - color: {color_text_dark}; - }} - QComboBox QAbstractItemView::item:hover, - QComboBox QAbstractItemView::item:selected {{ - background: {color_accent}; - color: {color_text_dark}; - }} -""" - # SEARCH FIELD STYLE SEARCH_EDIT_STYLE = f""" QLineEdit {{ diff --git a/portprotonqt/themes/standart/styles/base.py b/portprotonqt/themes/standart/styles/base.py index 764ec375..d1d6b0a2 100644 --- a/portprotonqt/themes/standart/styles/base.py +++ b/portprotonqt/themes/standart/styles/base.py @@ -303,6 +303,15 @@ LIBRARY_WIDGET_STYLE = f""" }} """ +# LIBRARY_CONTROL_STYLE +LIBRARY_CONTROL_STYLE = f""" + QWidget {{ + background: {color_bg_darker}; + border: {border_thin} {color_accent}; + border-radius: {border_radius_small}; + }} +""" + # CONTAINER_STYLE CONTAINER_STYLE = """ QWidget { diff --git a/portprotonqt/themes/standart/styles/constants.py b/portprotonqt/themes/standart/styles/constants.py index 16dc653f..c97366a0 100644 --- a/portprotonqt/themes/standart/styles/constants.py +++ b/portprotonqt/themes/standart/styles/constants.py @@ -56,6 +56,7 @@ border_radius_slider_handle = "9px" # === Core Palette === color_accent = "#409EFF" color_bg = "#282a33" +color_bg_darker = "#22242b" color_surface = "#3f424d" color_surface_elevated = "#32343d" color_surface_hover = "#404554" diff --git a/portprotonqt/themes/standart/styles/detail_page.py b/portprotonqt/themes/standart/styles/detail_page.py index b49d9c05..8efdcbfd 100644 --- a/portprotonqt/themes/standart/styles/detail_page.py +++ b/portprotonqt/themes/standart/styles/detail_page.py @@ -46,77 +46,6 @@ LIBRARY_CONTROLS_BUTTON_STYLE = f""" }} """ -LIBRARY_FILTER_COMBOBOX_STYLE = f""" - QComboBox {{ - background: {color_detail_overlay}; - border: {border_thin} {color_border_input}; - border-radius: {border_radius_small}; - padding-left: 12px; - height: 34px; - color: {color_text}; - font-family: '{font_family}'; - font-size: {font_size_normal}; - min-width: 120px; - combobox-popup: 0; - }} - QComboBox:hover, - QComboBox:focus {{ - background: {color_detail_overlay}; - border: {border_thin} {color_accent}; - }} - QComboBox:on {{ - background: {color_bg}; - border: {border_thin} {color_accent}; - border-bottom-style: none; - border-top-left-radius: 10px; - border-top-right-radius: 10px; - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; - }} - QComboBox::drop-down {{ - subcontrol-origin: padding; - subcontrol-position: center right; - border-left: {border_thin} {color_border_faint}; - padding: 12px; - height: 12px; - width: 12px; - }} - QComboBox::down-arrow {{ - image: url({theme_manager.get_icon("down", current_theme_name, as_path=True)}); - padding: 12px; - height: 12px; - width: 12px; - }} - QComboBox::down-arrow:on {{ - image: url({theme_manager.get_icon("up", current_theme_name, as_path=True)}); - padding: 12px; - height: 12px; - width: 12px; - }} - QComboBox QAbstractItemView {{ - outline: none; - background: {color_surface}; - border: {border_thin} {color_accent}; - border-top-style: none; - border-top-left-radius: 0px; - border-top-right-radius: 0px; - border-bottom-left-radius: 10px; - border-bottom-right-radius: 10px; - }} - QComboBox QAbstractItemView::item {{ - padding: 7px 7px 7px 12px; - margin: 3px; - min-height: 24px; - border-radius: {border_radius_small}; - color: {color_text}; - }} - QComboBox QAbstractItemView::item:hover, - QComboBox QAbstractItemView::item:selected {{ - background: {color_accent}; - color: {color_text}; - }} -""" - # MAIN FRAME FOR GAME DETAILS DETAIL_CONTENT_FRAME_STYLE = f""" QFrame {{ -- 2.54.0