Skip to content

Commit 3430a59

Browse files
committed
update: 添加图标和资源
1 parent 7a4954a commit 3430a59

23 files changed

+306
-148
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2020, CROGRAM
3+
Copyright (c) 2020 - present, Jackson Dou
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
# GUI应用生成器
1+
# PyThub PyInstaller Desktop
2+
3+
> GUI应用生成器
4+
25

36
一个 PyInstaller 的 GUI 实现,使用 Python 语言开发,GUI 基于 Tkinter,利用 PyInstaller 将 Python 脚本语言打包发布成单个的可执行程序
47

58
预览图
69

7-
![WX20201114-205346@2x](screenshots/[email protected])
10+
![WX20201114-205346@2x](resources/screenshots/[email protected])

build.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
# _*_ coding:utf-8 _*_
22

3-
pyinstaller \
4-
--clean\
5-
--noconfirm\
6-
-w\
7-
build.spec
3+
pyinstaller -D -w -y --noconfirm build.spec

build.spec

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,72 @@
1-
# -*- mode: python -*-
1+
# -*- mode: python ; coding: utf-8 -*-
22

3-
BLOCK_CIPHER = None
4-
APP_NAME = 'PyinstallerDesktop'
5-
APP_NAME_DISPLAY = 'Pyinstaller桌面客户端'
6-
APP_APP = 'PyinstallerDesktop.app'
7-
APP_COPYRIGHT = 'Copyright © 2020-2022 Jackson Dou All Rights Reserved'
8-
APP_VERSION = '0.0.2'
9-
SCRIPTS = ['src/app.py']
10-
BINARIES = []
11-
DATAS = []
12-
HIDDEN_IMPORTS = [] # 源文件的依赖模块
13-
HOOKSPATH = []
14-
EXCLUDES = [] # 不需要打包的模块
15-
RUNTIME_HOOKS = []
16-
BUNDLE_IDENTIFIER = 'org.pythub.app.pyinstaller-desktop' # 一般情况下Bundle ID的格式为:com.公司名称.项目名称
3+
block_cipher = None
4+
APP_ID = 'org.pythub.pyinstaller-desktop'
5+
APP_NAME = 'PyInstaller Desktop'
6+
APP_NAME_DISPLAY = 'PyInstaller 桌面客户端'
7+
APP_APP = 'PyThub PyInstaller Desktop.app'
8+
APP_VERSION = '1.0.0'
9+
APP_BUILD = 1
10+
APP_COPYRIGHT = 'Copyright © 2020-present Jackson Dou All Rights Reserved.'
11+
# HIDDEN_IMPORTS = ['PyInstaller.__main__'] # 源文件的依赖模块
12+
EXCLUDES = ['altgraph', 'numpy', 'psutil', 'wheel', 'setuptools', 'PIL'] # 不需要打包的模块
1713
UPX = True # 如果有UPX安装(执行Configure.py时检测),会压缩执行文件(Windows系统中的DLL也会)
18-
PATHEX = ['src']
14+
MacDeveloperID='Developer ID Application: CROGRAM INC. (4LWSS9P873)'
1915

20-
a = Analysis(SCRIPTS,
21-
pathex=PATHEX,
22-
binaries=BINARIES,
23-
datas=DATAS,
24-
hiddenimports=HIDDEN_IMPORTS,
25-
hookspath=HOOKSPATH,
26-
runtime_hooks=RUNTIME_HOOKS,
27-
excludes=EXCLUDES,
28-
win_no_prefer_redirects=False,
29-
win_private_assemblies=False,
30-
cipher=BLOCK_CIPHER,
31-
noarchive=False
32-
)
33-
pyz = PYZ(a.pure, a.zipped_data, cipher=BLOCK_CIPHER)
34-
exe = EXE(
35-
pyz,
16+
17+
a = Analysis(['src/app.py'],
18+
pathex=['src'],
19+
binaries=[],
20+
datas=[],
21+
hiddenimports=None,
22+
hookspath=[],
23+
hooksconfig={},
24+
runtime_hooks=[],
25+
excludes=EXCLUDES,
26+
win_no_prefer_redirects=False,
27+
win_private_assemblies=False,
28+
cipher=block_cipher,
29+
noarchive=False)
30+
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
31+
32+
exe = EXE(pyz,
3633
a.scripts, [],
3734
exclude_binaries=True,
3835
name=APP_NAME,
3936
debug=False,
4037
bootloader_ignore_signals=False,
4138
strip=False,
4239
upx=UPX,
43-
console=False
44-
)
45-
coll = COLLECT(
46-
exe,
40+
console=False,
41+
disable_windowed_traceback=False,
42+
target_arch=None,
43+
codesign_identity=None,
44+
entitlements_file=None)
45+
coll = COLLECT(exe,
4746
a.binaries,
4847
a.zipfiles,
4948
a.datas,
5049
strip=False,
5150
upx=UPX,
52-
name=APP_NAME
53-
)
54-
app = BUNDLE(
55-
coll,
51+
upx_exclude=[],
52+
name=APP_NAME)
53+
app = BUNDLE(coll,
5654
name=APP_APP,
57-
icon=None,
58-
bundle_identifier=BUNDLE_IDENTIFIER,
55+
icon='resources/app.icns',
56+
bundle_identifier=APP_ID,
5957
info_plist={
6058
'CFBundleName': APP_NAME,
6159
'CFBundleDisplayName': APP_NAME_DISPLAY,
60+
'CFBundleDevelopmentRegion': 'zh_CN',
6261
'CFBundleExecutable': APP_NAME,
6362
'CFBundlePackageType': 'APPL',
6463
'CFBundleSupportedPlatforms': ['MacOSX'],
65-
'CFBundleGetInfoString': "Jackson Dou",
66-
'CFBundleIdentifier': BUNDLE_IDENTIFIER,
67-
'CFBundleVersion': APP_VERSION,
68-
'CFBundleInfoDictionaryVersion': APP_VERSION,
64+
'CFBundleGetInfoString': 'Jackson Dou',
65+
'CFBundleIdentifier': APP_ID,
6966
'CFBundleShortVersionString': APP_VERSION,
67+
'CFBundleVersion': APP_BUILD,
68+
# 'CFBundleInfoDictionaryVersion': '6.0',
7069
'NSHighResolutionCapable': True,
70+
'LSApplicationCategoryType': 'public.app-category.utilities',
7171
'NSHumanReadableCopyright': APP_COPYRIGHT
72-
}
73-
)
72+
})

resources/app.icns

505 KB
Binary file not shown.
10.8 KB
Loading
27.5 KB
Loading

resources/app.iconset/icon_16x16.png

863 Bytes
Loading
1.82 KB
Loading
27.5 KB
Loading
74.6 KB
Loading

resources/app.iconset/icon_32x32.png

1.82 KB
Loading
4.27 KB
Loading
74.6 KB
Loading
214 KB
Loading

resources/build_icon.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
mkdir app.iconset
2+
sips -z 16 16 logo.png --out ./app.iconset/icon_16x16.png
3+
sips -z 32 32 logo.png --out ./app.iconset/[email protected]
4+
sips -z 32 32 logo.png --out ./app.iconset/icon_32x32.png
5+
sips -z 64 64 logo.png --out ./app.iconset/[email protected]
6+
sips -z 128 128 logo.png --out ./app.iconset/icon_128x128.png
7+
sips -z 256 256 logo.png --out ./app.iconset/[email protected]
8+
sips -z 256 256 logo.png --out ./app.iconset/icon_256x256.png
9+
sips -z 512 512 logo.png --out ./app.iconset/[email protected]
10+
sips -z 512 512 logo.png --out ./app.iconset/icon_512x512.png
11+
sips -z 1024 1024 logo.png --out ./app.iconset/[email protected]
12+
13+
iconutil -c icns ./app.iconset -o app.icns

resources/logo.png

214 KB
Loading

resources/logo.svg

Lines changed: 127 additions & 0 deletions
Loading

resources/logo.vectornator

1.62 MB
Binary file not shown.

src/app.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
from utils import set_window_center
66
from view import View
7-
# import PyInstaller
8-
# import PyInstaller.__main__
9-
107

118
class App(Tk):
129
'''
@@ -17,7 +14,7 @@ class App(Tk):
1714

1815
def __init__(self):
1916
Tk.__init__(self)
20-
self.title('Pyinstaller Desktop')
17+
self.title('PyInstaller Desktop')
2118
View(self)
2219
set_window_center(self)
2320
self.mainloop()

src/utils.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,3 @@ def get_window_size(window):
4545
"""获取窗口 宽、高"""
4646
window.update()
4747
return window.winfo_width(), window.winfo_height()
48-
49-
50-
def treeview_sort_column(tv, col, reverse):
51-
"""Treeview、列名、排列方式"""
52-
l = [(tv.set(k, col), k) for k in tv.get_children('')]
53-
# print(tv.get_children(''))
54-
l.sort(reverse=reverse) # 排序方式
55-
# rearrange items in sorted positions
56-
for index, (val, k) in enumerate(l): # 根据排序后索引移动
57-
tv.move(k, '', index)
58-
# print(k)
59-
tv.heading(col, command=lambda: treeview_sort_column(
60-
tv, col, not reverse)) # 重写标题,使之成为再点倒序的标题

0 commit comments

Comments
 (0)