diff --git a/rare/resources/static_css/__init__.py b/rare/resources/static_css/__init__.py index 985508ef..54f20323 100644 Binary files a/rare/resources/static_css/__init__.py and b/rare/resources/static_css/__init__.py differ diff --git a/rare/resources/static_css/stylesheet.py b/rare/resources/static_css/stylesheet.py index 7c2b2f81..f8cc898c 100644 --- a/rare/resources/static_css/stylesheet.py +++ b/rare/resources/static_css/stylesheet.py @@ -1,10 +1,14 @@ import os import sys +from typing import Union, Type import qstylizer.style -from PyQt5.QtCore import QDir +from PyQt5.QtCore import QDir, QObject from PyQt5.QtGui import QColor from PyQt5.pyrcc import RCCResourceLibrary, CONSTANT_COMPRESSLEVEL_DEFAULT, CONSTANT_COMPRESSTHRESHOLD_DEFAULT +from PyQt5.sip import wrappertype + +from rare.utils.misc import widget_object_name verbose = True compressLevel = 6 @@ -53,6 +57,10 @@ def processResourceFile(filenamesIn, filenameOut, listFiles): return library.output(filenameOut) +def css_name(widget: Union[wrappertype,QObject,Type]): + return f"#{widget_object_name(widget, '')}" + + css = qstylizer.style.StyleSheet() @@ -168,6 +176,22 @@ css.QLabel[list_name("VersionLabel")].color.setValue(list_info_label_color) css.QLabel[list_name("SizeLabel")].color.setValue(list_info_label_color) +# WaitingSpinner +from rare.utils.extra_widgets import WaitingSpinner +css.QLabel[css_name(WaitingSpinner)].setValues( + marginLeft="auto", + marginRight="auto", +) + + +# SelectViewWidget +from rare.utils.extra_widgets import SelectViewWidget +css.QPushButton[f"{css_name(SelectViewWidget)}Button"].setValues( + border="none", + backgroundColor="transparent", +) + + if __name__ == "__main__": with open("stylesheet.qss", "w") as qss: qss.write(f'\n/* This file is auto-generated from "{os.path.basename(__file__)}". DO NOT EDIT!!! */\n\n') diff --git a/rare/resources/static_css/stylesheet.qss b/rare/resources/static_css/stylesheet.qss index 42019f17..80895846 100644 --- a/rare/resources/static_css/stylesheet.qss +++ b/rare/resources/static_css/stylesheet.qss @@ -101,3 +101,11 @@ QLabel#ListWidgetVersionLabel { QLabel#ListWidgetSizeLabel { color: #999; } +QLabel#WaitingSpinner { + margin-left: auto; + margin-right: auto; +} +QPushButton#SelectViewWidgetButton { + border: none; + background-color: transparent; +} diff --git a/rare/ui/components/tabs/games/game_info/game_dlc_widget.py b/rare/ui/components/tabs/games/game_info/game_dlc_widget.py index dad466e1..799c7361 100644 --- a/rare/ui/components/tabs/games/game_info/game_dlc_widget.py +++ b/rare/ui/components/tabs/games/game_info/game_dlc_widget.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'rare/ui/components/tabs/games/game_info/game_dlc_widget.ui' # -# Created by: PyQt5 UI code generator 5.15.7 +# Created by: PyQt5 UI code generator 5.15.9 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -96,7 +96,6 @@ class Ui_GameDlcWidget(object): sizePolicy.setHeightForWidth(self.action_button.sizePolicy().hasHeightForWidth()) self.action_button.setSizePolicy(sizePolicy) self.action_button.setMinimumSize(QtCore.QSize(160, 0)) - self.action_button.setStyleSheet("") self.action_button.setText("Action") self.action_button.setObjectName("action_button") self.dlc_layout.addWidget(self.action_button, 0, QtCore.Qt.AlignBottom) diff --git a/rare/ui/components/tabs/games/game_info/game_dlc_widget.ui b/rare/ui/components/tabs/games/game_info/game_dlc_widget.ui index 267f533e..4ab95570 100644 --- a/rare/ui/components/tabs/games/game_info/game_dlc_widget.ui +++ b/rare/ui/components/tabs/games/game_info/game_dlc_widget.ui @@ -191,9 +191,6 @@ 0 - - - Action diff --git a/rare/ui/components/tabs/games/game_info/game_info.py b/rare/ui/components/tabs/games/game_info/game_info.py index 6b21b9aa..0ff0fb56 100644 --- a/rare/ui/components/tabs/games/game_info/game_info.py +++ b/rare/ui/components/tabs/games/game_info/game_info.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'rare/ui/components/tabs/games/game_info/game_info.ui' # -# Created by: PyQt5 UI code generator 5.15.7 +# Created by: PyQt5 UI code generator 5.15.9 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. @@ -163,7 +163,6 @@ class Ui_GameInfo(object): self.move_stack.addWidget(self.move_progress_page) self.installed_layout.addWidget(self.move_stack) self.uninstall_button = QtWidgets.QPushButton(self.installed_page) - self.uninstall_button.setStyleSheet("") self.uninstall_button.setObjectName("uninstall_button") self.installed_layout.addWidget(self.uninstall_button) self.game_actions_stack.addWidget(self.installed_page) @@ -172,10 +171,9 @@ class Ui_GameInfo(object): self.uninstalled_layout = QtWidgets.QVBoxLayout(self.uninstalled_page) self.uninstalled_layout.setContentsMargins(0, 0, 0, 0) self.uninstalled_layout.setObjectName("uninstalled_layout") - spacerItem2 = QtWidgets.QSpacerItem(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + spacerItem2 = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.uninstalled_layout.addItem(spacerItem2) self.install_button = QtWidgets.QPushButton(self.uninstalled_page) - self.install_button.setStyleSheet("") self.install_button.setObjectName("install_button") self.uninstalled_layout.addWidget(self.install_button) self.import_button = QtWidgets.QPushButton(self.uninstalled_page) diff --git a/rare/ui/components/tabs/games/game_info/game_info.ui b/rare/ui/components/tabs/games/game_info/game_info.ui index f2792b93..51d19420 100644 --- a/rare/ui/components/tabs/games/game_info/game_info.ui +++ b/rare/ui/components/tabs/games/game_info/game_info.ui @@ -353,9 +353,6 @@ - - - Uninstall Game @@ -382,13 +379,16 @@ Qt::Vertical + + + 0 + 0 + + - - - Install Game diff --git a/rare/utils/extra_widgets.py b/rare/utils/extra_widgets.py index 38b0a2a7..6d94f63d 100644 --- a/rare/utils/extra_widgets.py +++ b/rare/utils/extra_widgets.py @@ -27,9 +27,6 @@ class WaitingSpinner(QLabel): def __init__(self, parent=None): super(WaitingSpinner, self).__init__(parent=parent) self.setObjectName(type(self).__name__) - self.setStyleSheet( - f"QLabel#{self.objectName()} {{margin - left: auto; margin-right: auto;}}" - ) self.movie = QMovie(":/images/loader.gif") self.setMovie(self.movie) self.movie.start() @@ -43,14 +40,9 @@ class SelectViewWidget(QWidget): self.icon_view = icon_view self.icon_button = QPushButton(self) self.icon_button.setObjectName(f"{type(self).__name__}Button") - self.icon_button.setStyleSheet( - f"QPushButton#{self.icon_button.objectName()} {{border: none; background-color: transparent}}" - ) self.list_button = QPushButton(self) self.list_button.setObjectName(f"{type(self).__name__}Button") - self.list_button.setStyleSheet( - f"QPushButton#{self.list_button.objectName()} {{border: none; background-color: transparent}}" - ) + if icon_view: self.icon_button.setIcon(qta_icon("mdi.view-grid-outline", "ei.th-large", color="orange")) self.list_button.setIcon(qta_icon("fa5s.list", "ei.th-list")) diff --git a/rare/utils/misc.py b/rare/utils/misc.py index 24177c3b..67b97987 100644 --- a/rare/utils/misc.py +++ b/rare/utils/misc.py @@ -209,10 +209,11 @@ def icon(icn_str: str, fallback: str = None, **kwargs): def widget_object_name(widget: Union[wrappertype,QObject,Type], suffix: str) -> str: + suffix = f"_{suffix}" if suffix else "" if isinstance(widget, QObject): - return f"{type(widget).__name__}_{suffix}" + return f"{type(widget).__name__}{suffix}" elif isinstance(widget, wrappertype): - return f"{widget.__name__}_{suffix}" + return f"{widget.__name__}{suffix}" else: raise RuntimeError(f"Argument {widget} not a QObject or type of QObject")