添加构建时间

This commit is contained in:
2025-05-27 02:40:12 +08:00
parent 31b73937fe
commit 735a8e9a51
5 changed files with 23 additions and 3 deletions

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ dist
__pycache__
*.pyc
files
build_info.py

View File

@@ -26,6 +26,7 @@ if errorlevel 1 (
)
echo === 使用 pyinstaller 构建 ===
python .\utils\hook.py
pyinstaller .\main.spec
if errorlevel 1 (
echo [错误] 构建失败!

View File

@@ -20,7 +20,7 @@ splash = Splash(
'images\\splash.png',
binaries=a.binaries,
datas=a.datas,
text_pos=(35,378),
text_pos=(35, 378),
text_size=12,
text_color='black',
minify_script=True,

View File

@@ -1,8 +1,10 @@
from PySide6.QtGui import QDesktopServices, Qt
from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout
from pyparsing import version_info
from qfluentwidgets import PrimaryPushSettingCard, FluentIcon, GroupHeaderCardWidget, PushButton, ImageLabel, TitleLabel
from ui.components.widget import Widget
from utils.function import is_frozen
class AboutWidget(Widget):
@@ -17,11 +19,17 @@ class AboutWidget(Widget):
self.hBox.addWidget(self.logoImage, 0, Qt.AlignLeft)
self.hBox.addWidget(self.appNameLabel, 1, Qt.AlignLeft)
build_time_str = ''
if is_frozen():
from build_info import BUILD_TIME
build_time_str = f",构建时间:{BUILD_TIME}"
self.version_card = PrimaryPushSettingCard(
text="获取源码",
icon=FluentIcon.INFO,
title="关于",
content="作者许方杰。当前版本1.0.0\n本软件使用 GPLv3 开源协议进行分发,作者不对使用本软件造成的任何损失负责。"
content=f"作者许方杰。当前版本1.0.0{build_time_str}\n"
f"本软件使用 GPLv3 开源协议进行分发,作者不对使用本软件造成的任何损失负责。"
)
self.button_list = [
PushButton("访问网站"),

10
utils/hook.py Normal file
View File

@@ -0,0 +1,10 @@
from datetime import datetime
def gen_build_time():
with open('build_info.py', 'w', encoding='utf-8') as f:
f.write(f"# Auto-generated build info\n")
f.write(f"BUILD_TIME = '{datetime.now().isoformat(sep=' ', timespec='seconds')}'\n")
gen_build_time()