build: move icons from assets/ to src/tchmaterial-parser/assets/

Signed-off-by: 晨叶梦春 <wuziqian211@126.com>
This commit is contained in:
晨叶梦春
2026-08-04 23:08:15 +08:00
parent 0daae32296
commit adb9fac563
14 changed files with 44 additions and 15 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 53 B

+1
View File
@@ -0,0 +1 @@
../src/tchmaterial_parser/assets/crescent_moon_3d.png

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 53 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 51 B

+1
View File
@@ -0,0 +1 @@
../src/tchmaterial_parser/assets/information_3d.png

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 51 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 57 B

+1
View File
@@ -0,0 +1 @@
../src/tchmaterial_parser/assets/last_quarter_moon_3d.png

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 57 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 43 B

+1
View File
@@ -0,0 +1 @@
../src/tchmaterial_parser/assets/sun_3d.png

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 48 B

+1
View File
@@ -0,0 +1 @@
../src/tchmaterial_parser/assets/window_icon.png

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 48 B

+30 -1
View File
@@ -8,7 +8,8 @@ version = "4.0"
description = "国家中小学智慧教育平台 资源下载工具"
readme = "README.md"
requires-python = ">=3.10"
license = {text = "MIT"}
license = "MIT"
license-files = ["LICENSE", "licenses/*.txt"]
authors = [{name = "肥宅水水呀"}, {name = "晨叶梦春", email = "wuziqian211@126.com"}]
dependencies = [
"pillow>=10,<13",
@@ -19,10 +20,35 @@ dependencies = [
"sv-ttk>=2.6,<3",
"pywin32>=306; sys_platform == 'win32'",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Information Technology",
"Operating System :: MacOS",
"Operating System :: Microsoft",
"Operating System :: Microsoft :: Windows :: Windows 8.1",
"Operating System :: Microsoft :: Windows :: Windows 10",
"Operating System :: Microsoft :: Windows :: Windows 11",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Topic :: Education",
"Topic :: Utilities",
"Typing :: Typed",
]
[project.urls]
Homepage = "https://github.com/happycola233/tchMaterial-parser"
Repository = "https://github.com/happycola233/tchMaterial-parser"
Issues = "https://github.com/happycola233/tchMaterial-parser/issues"
[project.scripts]
"tchmaterial-parser" = "tchmaterial_parser.app:main"
@@ -33,6 +59,9 @@ package-dir = {"" = "src"}
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
tchmaterial_parser = ["assets/*.png"]
[tool.black]
line-length = 120
target-version = ["py310"]
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

-1
View File
@@ -89,7 +89,6 @@ def render_system_emoji(symbol: str, icon_size: int) -> Image.Image | None: #
icon.alpha_composite(resized, ((icon_size - resized.width) // 2, (icon_size - resized.height) // 2))
return icon
except Exception as e:
print_error(e)
continue
return None
+8 -5
View File
@@ -9,11 +9,14 @@ def print_error(e: Exception) -> None: # 打印错误信息到控制台
traceback.print_exception(e)
def resource_path(*parts: str) -> Path: # 获取源码或 PyInstaller 打包后的只读资源路径
# 源码入口位于 src/,资源位于项目根目录;PyInstaller 则把 datas 放到 sys._MEIPASS
# 因此不能依赖当前工作目录或可执行文件所在目录,后者在单文件模式下并非资源的实际位置
source_root = Path(__file__).resolve().parent.parent.parent # 本模块位于 src/tchmaterial_parser/ 下,上溯三级才是项目根目录
bundle_root = Path(getattr(sys, "_MEIPASS", source_root))
return bundle_root.joinpath(*parts)
bundle_root = getattr(sys, "_MEIPASS", None)
if bundle_root: # PyInstaller 中数据被放在 tchmaterial_parser/assets/
package_root = Path(bundle_root) / "tchmaterial_parser"
else: # 源码运行或 wheel 安装
package_root = Path(__file__).resolve().parent
return package_root.joinpath(*parts)
os_name = platform.system() # 获取操作系统类型
if os_name == "Windows": # 在 Windows 操作系统下,导入 Windows 相关库
+6 -8
View File
@@ -1,19 +1,17 @@
# -*- mode: python ; coding: utf-8 -*-
import sys
from pathlib import Path
from PyInstaller.utils.hooks import collect_data_files
is_mac = sys.platform.startswith('darwin')
# sv-ttk 通过 Path(__file__).with_name() 加载主题文件,需把随包的 .tcl 与 .png 一并收集进来;
# 下面 4 个图标文件是程序运行时读取的自有资源,目标目录保持为 assets/,与源码中的相对路径一致
data_files = collect_data_files('sv_ttk') + [
('assets/window_icon.png', 'assets'),
('assets/last_quarter_moon_3d.png', 'assets'),
('assets/sun_3d.png', 'assets'),
('assets/crescent_moon_3d.png', 'assets'),
('assets/information_3d.png', 'assets'),
# sv-ttk 通过 Path(__file__).with_name() 加载主题文件,需把随包的 .tcl 与 .png 一并收集进来;图标文件是程序运行时读取的自有资源
runtime_assets = [
(str(path), "tchmaterial_parser/assets")
for path in Path("src/tchmaterial_parser/assets").glob("*.png")
]
data_files = collect_data_files("sv_ttk") + runtime_assets
a = Analysis(
# 入口位于包外:PyInstaller 会把入口脚本当作 __main__ 分析,包内脚本的相对导入在此情形下不成立