Skip to content

Commit 5704848

Browse files
improv: generate Steam Deck stylesheet through qstylizer
1 parent 385b357 commit 5704848

File tree

6 files changed

+256
-92
lines changed

6 files changed

+256
-92
lines changed

.idea/ProtonUp-Qt.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/pupgui2.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pupgui2/resources/themes/steamdeck/__init__.py

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,49 @@
66
from PySide6 import QtCore
77

88
qt_resource_data = b"\
9-
\x00\x00\x02w\
9+
\x00\x00\x02\x8a\
1010
(\
11-
\xb5/\xfd`\xed\x07m\x13\x00\xb6\xdaQ% \x8d\xb8\
12-
\x01h\x1f\xd1Bb\xb3\xcf\x97\xfe\x08\x9b\x87\xaeKc\
13-
\x95?\x18\xfa\x12\x80\x0e\xf6\xadny\x12\xab\x00FT\
14-
\xa0\x08K\x00G\x00B\x00\x8d\xad\x027\x84}\xae\xdb\
15-
\x81\x92\x8b\x89\x96\xb4d\xf5\x01%\x17\x1fy\x81\x92\x8b\
16-
\xd7\xff\x97\xa4\x8a\x17\x03\x85a*\x18\x03\xc7\x89R\xbf\
17-
\xa2x-\xcd\xbf\x8e(\x80&\xcf\xe3i\xda\xbb\xda)\
18-
\x89\x89I\x06\x08\x01\xa9\xde\xae\xa7\xccL\xe6\x92\xbfT\
19-
c\x08J\x95>\x0e\xc8\x81&\x8f\x93X\xe4\x16i$\
20-
D\x91\xa8m\x8c\xebP!\x05\x93\x86\xa3\xe1[\xe9J\
21-
\x1b\x97\xb4\xf6Y\x15\x92J=n\x8d\xc1\x09\x08\xa5\xc6\
22-
\x8b\x1b\xf3f_\xbfT\xdf\xe6-9\xa2\x09\x04\x81.\
23-
\xf9\x9a\x7f\xda\xa8jY~\xf0\x0dW\xc7u\x86\x02\x08\
24-
8\xbfR\x97b\x16;\x9e\xd4\xea\x1b[\x12\xf6'\xc7\
25-
\x86\xfa\x98b\xef\xc6\xb5\xff\xebI\xba\xa2\xa5[\x03\xdb\
26-
\x9b*\xe3`\xf5\x7fK\xb0\x7f\xe2\xf7\xad@\xee\xa4~\
27-
\xc4\xba\xe61\xe5\xccr\xec_S\xb0wQtIK\
28-
\xbb\xb3\x06^N\xe4D\xcdck]{\xac\x82\xfd\x8f\
29-
\xc7#]q\xb1\x8f]\xd3\x1a\xd3*2\x01#O\xea\
30-
\xbfu\x06\xe3c\xfe\xce$\xce\xb5O\x0d\x03\x00T%\
31-
\x124\xaf'fHL\xdb,\xb6\x1f\x19q\xad\xad\x9e\
32-
\x11w\xf2{\xa0\xf1\xa5\x19\x91\x0bf4\x05%\xc9r\
33-
@Bb\x10\xb3\xea\x01\xa2\x9b\xd0\x05\xfeQ\x94sw\
34-
(\x81\x01{/J\xcc\x0fw\xd7m=\xaf:\x7f.\
35-
\x0f\x11\x0cL\xae\xc9Q \xfe\x8c\xceP\xce\x1b\x06#\
36-
d /Q\x1b3\xa5E2bi\xfa\xb8\xe8\x184\
37-
F\xb2LC%\x11\xf1\x11g\x18uV\x0e\xb5:\x86\
38-
\x84(\xb0y\xed\xf0pl\x01\xd6;\xc0-F)\xa6\
39-
I[d\xe7\xbd\x00\xce7\x97\x03k\xcbP\xd0\x1a\x01\
40-
3\xa1\x13@\x168\x94\xd2\x88$\x11\x9b+\x8b\xc85\
41-
%Hb\xb6\xf4\x91\xc0:\xcb\xac\xd6z\xd6\xe4\x86\xe7\
42-
#\x1f\x0bBv5\xe7\xde\x08\x8c\xc8\xb0\x7f\x08\x1a\x8f\
43-
\xd3P*\x91X\x15\x90\xd8\xa5\x85\x08h@Zi\xc7\
44-
q[\x9eLA\xc4t\x18|\x98S.'\xfaC!\
45-
w\xc6\x84C\xb7\xe6\xb8a\x05\x83H\xb72\xd6C\xf2\
46-
\x0eL\x03\x1b4\xb6\xe4\xb4E+\x14\xe8\xc3\xa6\xb4`\
47-
\x9fA\x95t\x0b\x06t1z\x1e\xe4\xb1\x935\xabG\
48-
\xcb\x9b\xd0x\x19\x93\x8c\x12\xd4\x92\xb3\xe2%-cS\
49-
1\x1f\x83\xfe\x91@\x99\xac\x1cRL\xaf\x1a\xab\xc7\x13\
50-
H8\xbez\x0b\xfe\
11+
\xb5/\xfd`\x04\x0a\x05\x14\x00\x86^]&\x00\xaf\xb8\
12+
\x01\x0c$\xaeS\x16\x85\x8e\x1b\x7f\xc8v\xfe\xee\xbb\xa5\
13+
\xd1\x9eq\xd0\x18\x89\xa8\xe8\xa3\x16\x18\xe23\xaa\xaa\x06\
14+
\xaaX\x01T\x00T\x00O\x00\xbc\x19\xe7_c\x06\xa2\
15+
\x06\x11@N{W;U11\xc9`\x01R\xbd]\
16+
O\x99\x99\x8dM\xfeR\x8d)\x22\x1a\x0e\x87\xe3\xc2\x90\
17+
\xa0\x90\x97\x07\x87|HH\xc8\xd3x \xf9\xb8\x80\x91\
18+
\xdf\xad\xe2\xba\x8b\x8f\x8f\xb4\xda1\xd9\xf6\x99\xef[\xca\
19+
\xe9\xbfXF\xceu\x8c\xc9\xc8\xd5%!O\x8dR\xa1\
20+
\xf8Zt\xa5\x9b\xb4\xf6Y\x95\xc2?mT\x856\x99\
21+
Y\x9e\xf0ml\x17\xb8)\xecs\xdd\x17M\x1f\xb4d\
22+
5\xc2Gn\x88hd\x14\xa4R\x8f[cP\x03\xa3\
23+
\xd4xqc\xee\xf86o\xa92iQA\xb4\xc9\xd7\
24+
\xff\xd7A\x15/\x88\x88FF\xc3@\x22\x99\xa4~E\
25+
\x05\xa9\xd57\xceh E\x12\x89\x12\xf6'\xc7\x86\xfa\
26+
\x98bo\xc7\xb5\xff\xebI\xbab\xa6\x9b\x03\xdb\x9b*\
27+
t\xb1\xfa\xbf%\xd8?\xf1\xfbZh\xe4\x92\xd4\xc7\xac\
28+
s\x1eS\xce,\xc7\xfe5\x06{WZ\x89$Q\x83\
29+
\x9c\xc4\x227\x0b\x053\xb1L\xda\xc6\xb8\x0e\x0b\x06\x02\
30+
\xaa\x93vg\x0e\xbc$\x13\xe7\xb1\xb5\xae=V\xc1~\
31+
\xe9\x8a\x04\x04\xfb\xd89\xad1\xad\xd4\xa2\x81\x16(\xf5\
32+
\xdf:\x83\xf11\x7fg\x07\xce\xb5O\x12\x02\x0f\xca\x22\
33+
F\x9c\xd7\x13?\x15\xd36\x8b\xed\xc7'\xae\xb5\xd5?\
34+
q'\xbf:\xae?\xfa\x08p~\xa5.\xc5,\xae@\
35+
\x01h\xa0\xb1%AF\x10\xc9h\x0aJ*\x85\xc6@\
36+
\x02B\x10\xb2\xb2\x1e\x85\xb7\xb2\x9b\x1d\xf8X5\xc5r\
37+
\xa3\xd1#\xbd\xe7(F\x8d6\xa6\x8ax\xb0\xf6\xbcx\
38+
\xc9)\x5c\x16\x88\x00\xc3m\xf5\x99\xf6\xb0\xa4\xa0\x85:\
39+
J\xa0\x15\x05u\x13\xf5\xf7uQ\x9e\xa0\xbcc1\xcd\
40+
-7f\x0a\x14\xe88\x1b@\x188F\x0b\x134\xe8\
41+
\xd8\x09l\xc4\xceG\xa6|\xa0.8K\xcdm\xb3\xb0\
42+
\xcd\x9f\x0d\xd1\x81\x0b5K\x9f\x10T\x1f\x99\xd4\x11\xd3\
43+
rx\x85|\x91\xd1p\x0f\xc4\x8c\x89\xf8\xff\xdd-w\
44+
\xd6\xb5\xa2\x10\x9c\x09B\x81\xde\xe4\xf0n\x04\xef\xc1\xeb\
45+
\x86m.\x08\x9b<\x04\xf0\xe7\x94?\x84J\xbaK\xe9\
46+
\xe1\x06C\xa4\x89\xf3\x10\xa9\xdb\x88\xe8\xb14\xc4\x82\xb3\
47+
\xefJ,\x95\xdf\x8d\x897\x92u\x0cAod\x06$\
48+
\xeb\xdb\xc0@\xa8\xb0\x0d\xcd\xc3\xc4R\xc9\xb9\xe65\xaf\
49+
\xa3\xc6\xfc\x95\xcbS+\x8cbb\xc8$\xb26tq\
50+
B\xb7\xf6\xdbKA\xb23\xc2\xa0\x07I\xf0\xc0N\x9c\
51+
p\xf3@hS\x08\xae\xaa\x0a\
5152
\x00\x00\x00\xbc\
5253
(\
5354
\xb5/\xfd \xf0\x9d\x05\x00\x22\x8c& `g\xab\x03\
@@ -136,13 +137,13 @@
136137
\x00\x00\x00\x00\x00\x00\x00\x00\
137138
\x00\x00\x00*\x00\x02\x00\x00\x00\x04\x00\x00\x00\x04\
138139
\x00\x00\x00\x00\x00\x00\x00\x00\
139-
\x00\x00\x00\x90\x00\x04\x00\x00\x00\x01\x00\x00\x03;\
140+
\x00\x00\x00\x90\x00\x04\x00\x00\x00\x01\x00\x00\x03N\
140141
\x00\x00\x01\x96+}A\xa5\
141142
\x00\x00\x00B\x00\x04\x00\x00\x00\x01\x00\x00\x00\x00\
142-
\x00\x00\x01\x963FC\xbc\
143-
\x00\x00\x00\xb8\x00\x04\x00\x00\x00\x01\x00\x00\x04\x0c\
143+
\x00\x00\x01\x963\x92\xc0\xb6\
144+
\x00\x00\x00\xb8\x00\x04\x00\x00\x00\x01\x00\x00\x04\x1f\
144145
\x00\x00\x01\x96+}A\xa5\
145-
\x00\x00\x00d\x00\x04\x00\x00\x00\x01\x00\x00\x02{\
146+
\x00\x00\x00d\x00\x04\x00\x00\x00\x01\x00\x00\x02\x8e\
146147
\x00\x00\x01\x96+}A\xa5\
147148
"
148149

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import os
2+
3+
import qstylizer.style
4+
from PySide6.QtGui import QColor
5+
6+
verbose = True
7+
compressLevel = 6
8+
compressAlgo = "zlib"
9+
compressThreshold = 0
10+
11+
style = qstylizer.style.StyleSheet()
12+
13+
color = QColor("#EEEEEE")
14+
background_color_base = QColor("#171D25")
15+
background_color_item = QColor("#282D36")
16+
background_color_hover = QColor("#464D58")
17+
background_color_pressed = QColor("#393F49")
18+
background_color_disabled = QColor("#1D2026")
19+
20+
border_radius_base = 2
21+
22+
margin_min = 1
23+
24+
padding_min = 1
25+
padding_base = 8
26+
padding_item = 4
27+
28+
subcontrol_width_base = 18
29+
subcontrol_width_sbar = subcontrol_width_base + padding_min
30+
subcontrol_width_sbar_control = subcontrol_width_base - padding_min
31+
32+
style.QWidget.setValues(
33+
color=color.name(),
34+
backgroundColor=background_color_base.name(),
35+
fontWeight=300,
36+
)
37+
38+
for widget in (
39+
style.QPushButton,
40+
style.QListWidget,
41+
style.QComboBox,
42+
style.QToolButton,
43+
style.QLineEdit,
44+
style.QHeaderView.section
45+
):
46+
widget.setValues(
47+
backgroundColor=background_color_item.name(),
48+
border=None,
49+
borderRadius=f"{border_radius_base}px",
50+
padding=f"{padding_base}px",
51+
)
52+
53+
style.QListWidget.item.setValues(padding=f"{padding_item}px")
54+
style.QPushButton.hover.setValues(backgroundColor=background_color_hover.name())
55+
style.QPushButton.pressed.setValues(backgroundColor=background_color_pressed.name())
56+
style.QPushButton.disabled.setValues(backgroundColor=background_color_disabled.name())
57+
58+
style.QHeaderView.setValues(padding=f"{padding_min}px")
59+
style.QHeaderView.section.setValues(padding=f"{padding_item}px")
60+
style.QHeaderView.section.horizontal.setValues(marginLeft="0px", marginRight="2px")
61+
style.QHeaderView.section.vertical.setValues(marginTop="0px", marginBottom="2px")
62+
style.QTableView.item.setValues(marginLeft="1px")
63+
64+
style.QComboBox.dropDown.setValues(
65+
subcontrolOrigin="border",
66+
subcontrolPosition="top right",
67+
padding=f"{padding_item / 2}px",
68+
paddingRight=f"{padding_item}px",
69+
border=None,
70+
borderRadius=f"{border_radius_base}px",
71+
width=f"{subcontrol_width_base - 2}px",
72+
image='url(":/resources/themes/steamdeck/icon-drop-down.svg")',
73+
)
74+
75+
style.QScrollBar.setValues(
76+
padding=f"{padding_min}px",
77+
borderRadius=f"{border_radius_base}px",
78+
backgroundColor="transparent",
79+
)
80+
style.QScrollBar.vertical.setValues(
81+
margin=f"{subcontrol_width_sbar}px 0px",
82+
width=f"{subcontrol_width_sbar}px",
83+
)
84+
style.QScrollBar.horizontal.setValues(
85+
margin=f"0px {subcontrol_width_sbar}px",
86+
height=f"{subcontrol_width_sbar}px",
87+
)
88+
89+
for subcontrol in (
90+
style.QScrollBar.addLine.vertical,
91+
style.QScrollBar.subLine.vertical,
92+
style.QScrollBar.addLine.horizontal,
93+
style.QScrollBar.subLine.horizontal,
94+
):
95+
subcontrol.setValues(
96+
margin=f"{margin_min}px",
97+
border=None,
98+
borderRadius=f"{border_radius_base}px",
99+
width=f"{subcontrol_width_sbar_control}px",
100+
height=f"{subcontrol_width_sbar_control}px",
101+
backgroundColor=background_color_item.name(),
102+
subcontrolOrigin="margin",
103+
)
104+
style.QScrollBar.addLine.vertical.subcontrolPosition.setValue("bottom")
105+
style.QScrollBar.subLine.vertical.subcontrolPosition.setValue("top")
106+
style.QScrollBar.addLine.horizontal.subcontrolPosition.setValue("right")
107+
style.QScrollBar.subLine.horizontal.subcontrolPosition.setValue("left")
108+
style.QScrollBar.handle.setValues(
109+
backgroundColor=background_color_item.name(),
110+
borderRadius=f"{border_radius_base}px",
111+
minWidth="30px",
112+
minHeight="30px",
113+
)
114+
scrollbar_arrow_style = {
115+
"width": "13px",
116+
"height": "13px",
117+
}
118+
style.QScrollBar.upArrow.setValues(
119+
**scrollbar_arrow_style,
120+
image='url(":/resources/themes/steamdeck/icon-up-arrow.svg")',
121+
)
122+
style.QScrollBar.downArrow.setValues(
123+
**scrollbar_arrow_style,
124+
image='url(":/resources/themes/steamdeck/icon-down-arrow.svg")',
125+
)
126+
127+
128+
if __name__ == "__main__":
129+
130+
with open(os.path.join(os.path.dirname(__file__), "stylesheet.qss"), "w", encoding="utf-8") as qss:
131+
qss.write(f'/* This file is auto-generated from "{os.path.basename(__file__)}" */\n')
132+
qss.write(f'/* DO NOT EDIT!!! */\n\n')
133+
qss.write(style.toString())

0 commit comments

Comments
 (0)