Skip to content

Commit 9e148c0

Browse files
committed
Merge branch 'icons'
2 parents 3f20ca8 + b1ae3c7 commit 9e148c0

File tree

10 files changed

+283
-38
lines changed

10 files changed

+283
-38
lines changed

.appveyor.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ test_script:
1818
- pip install -e .
1919
- pip install flake8 pyinstaller
2020
- flake8
21+
22+
# Create single file EXE redistributable:
23+
- choco install -y imagemagick
24+
- refreshenv
25+
- set "PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%"
26+
- magick -background none steam_acolyte/acolyte.svg -resize 16x16 _16.ico
27+
- magick -background none steam_acolyte/acolyte.svg -resize 32x32 _32.ico
28+
- magick -background none steam_acolyte/acolyte.svg -resize 48x48 _48.ico
29+
- magick -background none steam_acolyte/acolyte.svg -resize 64x64 _64.ico
30+
- magick -background none steam_acolyte/acolyte.svg -resize 128x128 _128.ico
31+
- magick -background none steam_acolyte/acolyte.svg -resize 256x256 _256.ico
32+
- magick -background none _16.ico _32.ico _48.ico _64.ico _128.ico _256.ico acolyte.ico
2133
- pyinstaller steam-acolyte.spec
2234
- move dist\steam-acolyte.exe dist\acolyte-%APPVEYOR_REPO_TAG_NAME%.exe
2335

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
include README.rst
22
include UNLICENSE
3-
recursive-include steam_acolyte *.css
3+
recursive-include steam_acolyte *.css *.svg

steam-acolyte.spec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# vim: ft=python
22
from PyInstaller.utils.hooks import collect_data_files
33

4+
import sys
5+
import os
6+
47

58
def get_version():
6-
import sys
7-
import os
89
if sys.platform != 'win32':
910
return None
1011
from PyInstaller.utils.win32.versioninfo import (
@@ -75,6 +76,6 @@ exe = EXE(
7576
[],
7677
name='steam-acolyte',
7778
console=False,
78-
icon=None,
79+
icon='acolyte.ico' if os.path.isfile('acolyte.ico') else None,
7980
version=get_version(),
8081
)

steam_acolyte/acolyte.svg

Lines changed: 64 additions & 0 deletions
Loading

steam_acolyte/app.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
1010
Options:
1111
-r ROOT, --root ROOT Steam root path
12+
--theme NAME Choose theme
1213
"""
1314

1415
from steam_acolyte import __version__
@@ -39,11 +40,12 @@ def main(args=None):
3940
steam.run()
4041
steam.store_login_cookie()
4142
else:
42-
run_gui(steam)
43+
run_gui(steam, theme_name=opts['--theme'])
4344

4445

45-
def run_gui(steam):
46+
def run_gui(steam, theme_name):
4647
from steam_acolyte.window import create_login_dialog
48+
from steam_acolyte.theme import load_theme
4749
import signal
4850
app = QApplication([])
4951
sys.excepthook = except_handler
@@ -54,7 +56,8 @@ def run_gui(steam):
5456
# http://stackoverflow.com/questions/4938723/what-is-the-correct-way-to-make-my-pyqt-application-quit-when-killed-from-the-console
5557
signal.signal(signal.SIGINT, interrupt_handler)
5658
safe_timer(50, lambda: None)
57-
steam.login_window = create_login_dialog(steam)
59+
theme = load_theme(steam, theme_name)
60+
steam.login_window = create_login_dialog(steam, theme)
5861
steam.login_window.show()
5962
return app.exec_()
6063

steam_acolyte/delete.svg

Lines changed: 17 additions & 0 deletions
Loading

steam_acolyte/plus.svg

Lines changed: 43 additions & 0 deletions
Loading

steam_acolyte/theme.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
from PyQt5.QtGui import QIcon
3+
4+
from importlib_resources import read_text, path
5+
6+
import os
7+
from types import SimpleNamespace
8+
9+
10+
def builtin_theme(steam):
11+
return SimpleNamespace(
12+
window_style = read_text(__package__, 'window.css'),
13+
window_icon = load_icon_resource('acolyte.svg'),
14+
delete_icon = load_icon_resource('delete.svg'),
15+
user_icon = load_icon_resource('user.svg', 32, 32),
16+
plus_icon = load_icon_resource('plus.svg', 32, 32),
17+
)
18+
19+
20+
def steam_theme(steam):
21+
return SimpleNamespace(
22+
window_style = read_text('steam_acolyte', 'window.css'),
23+
window_icon = load_icon_file(os.path.join(
24+
steam.data, 'public', 'steam_tray.ico')),
25+
delete_icon = load_icon_file(os.path.join(
26+
steam.data, 'clientui', 'images', 'icons',
27+
'stop_loading.png')),
28+
user_icon = load_icon_file(os.path.join(
29+
steam.data, 'clientui', 'images', 'icons',
30+
'nav_profile_idle.png'), 32, 32),
31+
plus_icon = load_icon_file(os.path.join(
32+
steam.data, 'clientui', 'images', 'icons',
33+
'nav_customize.png'), 32, 32),
34+
)
35+
36+
37+
THEMES = {
38+
'default': builtin_theme,
39+
'steam': steam_theme,
40+
}
41+
42+
43+
def load_theme(steam, theme_name):
44+
theme_name = theme_name or 'default'
45+
if theme_name not in THEMES:
46+
print('Warning: unknown theme {!r}'.format(theme_name))
47+
theme_name = 'default'
48+
return THEMES[theme_name](steam)
49+
50+
51+
def load_icon_file(filename, *size):
52+
if os.path.isfile(filename):
53+
icon = QIcon(filename)
54+
return icon.pixmap(*size) if size else icon
55+
56+
57+
def load_icon_resource(name, *size):
58+
with path(__package__, name) as p:
59+
return load_icon_file(str(p), *size)

steam_acolyte/user.svg

Lines changed: 64 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)