Resources: Move some more stylesheets into the static CSS
This commit is contained in:
parent
372b276157
commit
76a616615b
Binary file not shown.
|
@ -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')
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -191,9 +191,6 @@
|
|||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Action</string>
|
||||
</property>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -353,9 +353,6 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="uninstall_button">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Uninstall Game</string>
|
||||
</property>
|
||||
|
@ -382,13 +379,16 @@
|
|||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="install_button">
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Install Game</string>
|
||||
</property>
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
Loading…
Reference in a new issue