From 8ddf0807fdf729a658ea9b9c9f95ebfacf82fda8 Mon Sep 17 00:00:00 2001 From: MarcusStill <69536339+MarcusStill@users.noreply.github.com> Date: Mon, 14 Sep 2026 17:12:07 +0000 Subject: [PATCH] feat: modernize PySide6 GUI with Windows 10/11 QSS theme --- files/style.qss | 156 ++++++++++++++++++++++++++++++++++++++++++++++++ main.py | 13 +++- 2 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 files/style.qss diff --git a/files/style.qss b/files/style.qss new file mode 100644 index 0000000..007bf6e --- /dev/null +++ b/files/style.qss @@ -0,0 +1,156 @@ +/* Windows 10/11 Light Theme (PyMASL) */ + +QWidget { + font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Roboto", "Ubuntu", sans-serif; + font-size: 14px; + color: #111111; +} + +QMainWindow, QDialog { + background-color: #F3F3F3; +} + +QPushButton { + background-color: #FDFDFD; + border: 1px solid #CCCCCC; + border-radius: 4px; + padding: 6px 16px; + color: #111111; +} + +QPushButton:hover { + background-color: #E5F1FB; + border: 1px solid #0078D4; +} + +QPushButton:pressed { + background-color: #CCE4F7; + border: 1px solid #005499; +} + +QPushButton:disabled { + background-color: #F0F0F0; + border: 1px solid #D9D9D9; + color: #A0A0A0; +} + +QLineEdit, QTextEdit, QPlainTextEdit, QSpinBox, QDoubleSpinBox, QDateEdit, QTimeEdit, QDateTimeEdit { + background-color: #FFFFFF; + border: 1px solid #CCCCCC; + border-radius: 4px; + padding: 4px; + selection-background-color: #0078D4; + selection-color: #FFFFFF; +} + +QLineEdit:focus, QTextEdit:focus, QPlainTextEdit:focus, QSpinBox:focus, QDoubleSpinBox:focus, QDateEdit:focus, QTimeEdit:focus, QDateTimeEdit:focus { + border: 1px solid #0078D4; +} + +QTabWidget::pane { + border: 1px solid #CCCCCC; + background-color: #FFFFFF; + border-radius: 4px; +} + +QTabBar::tab { + background-color: #F3F3F3; + border: 1px solid transparent; + border-bottom: 1px solid #CCCCCC; + padding: 8px 16px; + margin-right: 2px; +} + +QTabBar::tab:selected { + background-color: #FFFFFF; + border: 1px solid #CCCCCC; + border-bottom: 1px solid #FFFFFF; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + color: #0078D4; +} + +QTabBar::tab:hover:!selected { + background-color: #EAEAEA; +} + +QTableWidget, QTableView { + background-color: #FFFFFF; + border: 1px solid #CCCCCC; + gridline-color: #E0E0E0; + selection-background-color: #0078D4; + selection-color: #FFFFFF; +} + +QHeaderView::section { + background-color: #F9F9F9; + color: #333333; + padding: 4px; + border: none; + border-right: 1px solid #E0E0E0; + border-bottom: 1px solid #E0E0E0; + font-weight: bold; +} + +QScrollBar:vertical { + border: none; + background: #F3F3F3; + width: 12px; + margin: 0px 0px 0px 0px; +} + +QScrollBar::handle:vertical { + background: #CCCCCC; + min-height: 20px; + border-radius: 6px; + margin: 2px; +} + +QScrollBar::handle:vertical:hover { + background: #A6A6A6; +} + +QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { + border: none; + background: none; + height: 0px; +} + +QScrollBar:horizontal { + border: none; + background: #F3F3F3; + height: 12px; + margin: 0px 0px 0px 0px; +} + +QScrollBar::handle:horizontal { + background: #CCCCCC; + min-width: 20px; + border-radius: 6px; + margin: 2px; +} + +QScrollBar::handle:horizontal:hover { + background: #A6A6A6; +} + +QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { + border: none; + background: none; + width: 0px; +} + +QGroupBox { + border: 1px solid #CCCCCC; + border-radius: 4px; + margin-top: 10px; + background-color: #FAFAFA; +} + +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + padding: 0 5px; + color: #0078D4; + font-weight: bold; +} diff --git a/main.py b/main.py index c7f54d0..4b2b200 100644 --- a/main.py +++ b/main.py @@ -3556,7 +3556,18 @@ class Payment: if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) app.setStyle("Fusion") + + # Загрузка QSS стилей + qss_path = Path(__file__).parent / "files" / "style.qss" + try: + with open(qss_path, "r", encoding="utf-8") as f: + app.setStyleSheet(f.read()) + except Exception as e: + logger.error(f"Не удалось загрузить файл стилей {qss_path}: {e}") + auth = AuthForm() auth.show() auth.ui.label_9.setText(system.database) - sys.exit(app.exec()) + + exit_code = app.exec() + sys.exit(exit_code)