From bbfc51f9082b86f15c072e31624fb1ff90b84e62 Mon Sep 17 00:00:00 2001 From: dervart Date: Wed, 7 Jan 2026 15:31:35 +0700 Subject: [PATCH] styles for get_wine module --- portprotonqt/delete_wine_module.py | 15 +- portprotonqt/get_wine_module.py | 21 ++- portprotonqt/themes/standart/styles.py | 1 + portprotonqt/themes/standart/styles/base.py | 17 +-- .../themes/standart/styles/get_wine.py | 142 ++++++++++++++++++ 5 files changed, 178 insertions(+), 18 deletions(-) create mode 100644 portprotonqt/themes/standart/styles/get_wine.py diff --git a/portprotonqt/delete_wine_module.py b/portprotonqt/delete_wine_module.py index 07e5597..cafc009 100644 --- a/portprotonqt/delete_wine_module.py +++ b/portprotonqt/delete_wine_module.py @@ -7,11 +7,16 @@ from PySide6.QtWidgets import (QDialog, QVBoxLayout, QWidget, QCheckBox, from PySide6.QtCore import Qt from portprotonqt.localization import _ from portprotonqt.version_utils import version_sort_key +from portprotonqt.config_utils import read_theme_from_config +from portprotonqt.theme_manager import ThemeManager + +theme_manager = ThemeManager() class WineDeleteManager(QDialog): - def __init__(self, parent=None, portproton_location=None, selected_wine=None): + def __init__(self, parent=None, portproton_location=None, selected_wine=None, theme=None): super().__init__(parent) + self.theme = theme if theme else theme_manager.apply_theme(read_theme_from_config()) self.selected_wines = set() # Use set to store selected wine names self.portproton_location = portproton_location self.selected_wine = selected_wine # The wine that should be pre-selected @@ -20,7 +25,8 @@ class WineDeleteManager(QDialog): def initUI(self): self.setWindowTitle(_('Delete Wine')) - self.resize(800, 600) + self.resize(1100, 720) + self.setStyleSheet(self.theme.MAIN_WINDOW_STYLE + self.theme.MESSAGE_BOX_STYLE) layout = QVBoxLayout(self) layout.setContentsMargins(5, 5, 5, 5) @@ -28,6 +34,7 @@ class WineDeleteManager(QDialog): # Wine list widget - основной растягивающийся элемент self.list_widget = QListWidget() + self.list_widget.setStyleSheet(self.theme.GETWINE_WINDOW_STYLE) self.list_widget.setSelectionMode(QListWidget.SelectionMode.NoSelection) # Disable default selection to use checkboxes layout.addWidget(self.list_widget, 1) @@ -44,6 +51,7 @@ class WineDeleteManager(QDialog): self.selection_text.setMaximumHeight(80) self.selection_text.setReadOnly(True) self.selection_text.setTextInteractionFlags(Qt.TextInteractionFlag.NoTextInteraction) + self.selection_text.setStyleSheet(self.theme.GETWINE_WINDOW_STYLE) self.selection_text.setPlainText(_("No WINE selected")) selection_layout.addWidget(self.selection_text) @@ -82,8 +90,9 @@ class WineDeleteManager(QDialog): """Add a wine to the list with checkbox""" # Create a widget with checkbox and wine name item_widget = QWidget() + item_widget.setStyleSheet(self.theme.GETWINE_WINDOW_STYLE) item_layout = QHBoxLayout(item_widget) - item_layout.setContentsMargins(5, 2, 5, 2) + item_layout.setContentsMargins(5, 5, 5, 5) item_layout.setSpacing(5) checkbox = QCheckBox(wine_name) diff --git a/portprotonqt/get_wine_module.py b/portprotonqt/get_wine_module.py index 30bd97a..a67964f 100644 --- a/portprotonqt/get_wine_module.py +++ b/portprotonqt/get_wine_module.py @@ -12,12 +12,14 @@ from PySide6.QtWidgets import (QDialog, QTabWidget, QTableWidget, QFrame, QSizePolicy, QAbstractItemView) from PySide6.QtCore import Qt, QThread, Signal, QMutex, QWaitCondition, QTimer import urllib.parse -from portprotonqt.config_utils import read_proxy_config, get_portproton_start_command +from portprotonqt.config_utils import read_proxy_config, get_portproton_start_command, read_theme_from_config from portprotonqt.logger import get_logger +from portprotonqt.theme_manager import ThemeManager from portprotonqt.localization import _ from portprotonqt.version_utils import version_sort_key logger = get_logger(__name__) +theme_manager = ThemeManager() def get_cpu_level(): @@ -328,8 +330,9 @@ class ExtractionThread(QThread): class ProtonManager(QDialog): - def __init__(self, parent=None, portproton_location=None): + def __init__(self, parent=None, portproton_location=None, theme=None): super().__init__(parent) + self.theme = theme if theme else theme_manager.apply_theme(read_theme_from_config()) self.selected_assets = {} # {unique_id: asset_data} self.current_extraction_thread = None self.current_download_thread = None # Still keep this for compatibility with Downloader's thread @@ -342,7 +345,8 @@ class ProtonManager(QDialog): def initUI(self): self.setWindowTitle(_('Get other Wine')) - self.resize(800, 600) + self.resize(1100, 720) + self.setStyleSheet(self.theme.MAIN_WINDOW_STYLE + self.theme.MESSAGE_BOX_STYLE) layout = QVBoxLayout(self) layout.setContentsMargins(5, 5, 5, 5) @@ -350,6 +354,7 @@ class ProtonManager(QDialog): # Tab widget - основной растягивающийся элемент self.tab_widget = QTabWidget() + self.tab_widget.setStyleSheet(self.theme.GETWINE_WINDOW_STYLE) self.tab_widget.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) layout.addWidget(self.tab_widget, 1) @@ -367,6 +372,7 @@ class ProtonManager(QDialog): self.selection_text.setMaximumHeight(80) self.selection_text.setReadOnly(True) self.selection_text.setTextInteractionFlags(Qt.TextInteractionFlag.NoTextInteraction) + self.selection_text.setStyleSheet(self.theme.GETWINE_WINDOW_STYLE) self.selection_text.setPlainText(_("No assets selected")) selection_layout.addWidget(self.selection_text) @@ -519,14 +525,17 @@ class ProtonManager(QDialog): tab.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) layout = QVBoxLayout(tab) - layout.setContentsMargins(2, 2, 2, 2) - layout.setSpacing(2) + layout.setContentsMargins(5, 5, 5, 5) + layout.setSpacing(5) table = QTableWidget() + table.setAlternatingRowColors(True) table.verticalHeader().setVisible(False) table.setColumnCount(2) # Только Checkbox и Имя table.setHorizontalHeaderLabels(['', _('Asset Name')]) table.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers) + table.verticalHeader().setDefaultSectionSize(36) + table.setStyleSheet(self.theme.GETWINE_WINDOW_STYLE) header = table.horizontalHeader() header.setSectionResizeMode(0, QHeaderView.ResizeMode.ResizeToContents) @@ -843,6 +852,7 @@ class ProtonManager(QDialog): download_info = download_info[:77] + "..." self.download_progress.setValue(0) self.download_frame.setVisible(True) + self.download_frame.setStyleSheet(self.theme.GETWINE_WINDOW_STYLE) self.download_btn.setEnabled(False) self.clear_btn.setEnabled(False) @@ -860,6 +870,7 @@ class ProtonManager(QDialog): download_info = download_info[:77] + "..." self.download_progress.setValue(0) self.download_frame.setVisible(True) + self.download_frame.setStyleSheet(self.theme.GETWINE_WINDOW_STYLE) self.download_btn.setEnabled(False) self.clear_btn.setEnabled(False) diff --git a/portprotonqt/themes/standart/styles.py b/portprotonqt/themes/standart/styles.py index cb0b64c..fb572e3 100644 --- a/portprotonqt/themes/standart/styles.py +++ b/portprotonqt/themes/standart/styles.py @@ -5,4 +5,5 @@ from portprotonqt.themes.standart.styles.game_card import * from portprotonqt.themes.standart.styles.detail_page import * from portprotonqt.themes.standart.styles.settings import * from portprotonqt.themes.standart.styles.winetricks import * +from portprotonqt.themes.standart.styles.get_wine import * from portprotonqt.themes.standart.styles.theme_utils import * diff --git a/portprotonqt/themes/standart/styles/base.py b/portprotonqt/themes/standart/styles/base.py index fbca417..9a2395f 100644 --- a/portprotonqt/themes/standart/styles/base.py +++ b/portprotonqt/themes/standart/styles/base.py @@ -344,11 +344,8 @@ PROXY_INPUT_STYLE = f""" # СТИЛИ ДЛЯ QMessageBox (ОКНА СООБЩЕНИЙ) MESSAGE_BOX_STYLE = f""" QMessageBox {{ - background: qlineargradient(x1:0, y1:0, x2:1, y2:0, - stop:0 rgba(40, 40, 40, 0.95), - stop:1 rgba(25, 25, 25, 0.95)); - border: {border_b} rgba(255, 255, 255, 0.15); - border-radius: 12px; + background: {color_b}; + border: {border_a}; }} QMessageBox QLabel {{ color: {color_f}; @@ -356,8 +353,8 @@ MESSAGE_BOX_STYLE = f""" font-size: {font_size_a}; }} QMessageBox QPushButton {{ - background: rgba(30, 30, 30, 0.6); - border: {border_b} rgba(255, 255, 255, 0.2); + background: {color_c}; + border: {border_a} {color_h}; border-radius: {border_radius_a}; color: {color_f}; font-family: '{font_family}'; @@ -365,12 +362,12 @@ MESSAGE_BOX_STYLE = f""" min-width: 80px; }} QMessageBox QPushButton:hover {{ - background: #09bec8; - border-color: rgba(255, 255, 255, 0.3); + background: {color_a}; + border-color: border: {border_b} {color_a}; }} QMessageBox QPushButton:focus {{ border: {border_c} {color_a}; - background: {color_e}; + background: {color_a}; }} """ diff --git a/portprotonqt/themes/standart/styles/get_wine.py b/portprotonqt/themes/standart/styles/get_wine.py new file mode 100644 index 0000000..60f5166 --- /dev/null +++ b/portprotonqt/themes/standart/styles/get_wine.py @@ -0,0 +1,142 @@ +from .constants import * + +GETWINE_WINDOW_STYLE = f""" +/* TabWidget */ +QTabWidget::pane {{ + border-top: 1px solid {color_c}; + background: {color_h}; +}} +QTabBar::tab {{ + background: {color_c}; + color: {color_f}; + padding: 8px 16px; + border-top-left-radius: {border_radius_a}; + border-top-right-radius: {border_radius_a}; + margin-right: 2px; +}} +QTabBar::tab:selected {{ + background: {color_a}; + color: {color_f}; +}} +QTabBar::tab:hover {{ + background: {color_a}; +}} +/* Table */ +QHeaderView::section {{ + background: {color_d}; + color: {color_f}; + border: {border_a}; + font-weight: bold; +}} +QTableWidget {{ + background: {color_h}; + gridline-color: {color_h}; + color: {color_f}; + alternate-background-color: {color_d}; + border: {border_a}; + border-radius: {border_radius_a}; + font-family: '{font_family}'; + font-size: {font_size_a}; +}} +QTableWidget::item:!enabled {{ + color: #7a7a7a; +}} +QTableWidget::item:focus {{ + background: {color_a}; +}} +/* CheckBox */ +QCheckBox {{ + height: 34px; + color: {color_f}; + font-family: '{font_family}'; + font-size: {font_size_a}; +}} +QCheckBox::indicator {{ + width: 24px; + height: 24px; + border: {border_c} {color_g}; + border-radius: {border_radius_a}; + background: {color_c}; +}} +QCheckBox::indicator:hover {{ + background: {color_c}; + border: {border_c} {color_a}; +}} +QCheckBox::indicator:focus {{ + border: {border_c} {color_a}; +}} +QCheckBox::indicator:checked {{ + image: url({theme_manager.get_icon("check", current_theme_name, as_path=True)}); + border: {border_c} {color_a}; +}} +/* ScrollBar */ +QScrollBar:vertical {{ + width: 10px; + border: {border_a}; + border-radius: 5px; + background: rgba(20, 20, 20, 0.30); +}} +QScrollBar::handle:vertical {{ + background: #bebebe; + border: {border_a}; + border-radius: 5px; +}} +QScrollBar::add-line:vertical {{ + border: {border_a}; + background: none; +}} +QScrollBar::sub-line:vertical {{ + border: {border_a}; + background: none; +}} +QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {{ + border: {border_a}; + width: 3px; + height: 3px; + background: none; +}} +QScrollBar:horizontal {{ + height: 10px; + border: {border_a}; + border-radius: 5px; + background: rgba(20, 20, 20, 0.30); +}} +QScrollBar::handle:horizontal {{ + background: #bebebe; + border: {border_a}; + border-radius: 5px; +}} +QScrollBar::add-line:horizontal {{ + border: {border_a}; + background: none; +}} +QScrollBar::sub-line:horizontal {{ + border: {border_a}; + background: none; +}} +QScrollBar::up-arrow:horizontal, QScrollBar::down-arrow:horizontal {{ + border: {border_a}; + width: 3px; + height: 3px; + background: none; +}} +/* LogArea */ +QTextEdit {{ + background: {color_c}; + border: {border_a}; + border-radius: {border_radius_a}; + color: {color_f}; + font-family: '{font_family}'; + font-size: {font_size_a}; + padding: 5px; +}} + +QProgressBar {{ + color: {color_f}; + background-color: {color_c}; + text-align: center; +}} +QProgressBar::chunk {{ + background-color: {color_a}; +}} +"""