添加构建时间
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -5,4 +5,5 @@ dist
|
|||||||
.idea
|
.idea
|
||||||
__pycache__
|
__pycache__
|
||||||
*.pyc
|
*.pyc
|
||||||
files
|
files
|
||||||
|
build_info.py
|
||||||
@@ -26,6 +26,7 @@ if errorlevel 1 (
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo === 使用 pyinstaller 构建 ===
|
echo === 使用 pyinstaller 构建 ===
|
||||||
|
python .\utils\hook.py
|
||||||
pyinstaller .\main.spec
|
pyinstaller .\main.spec
|
||||||
if errorlevel 1 (
|
if errorlevel 1 (
|
||||||
echo [错误] 构建失败!
|
echo [错误] 构建失败!
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ splash = Splash(
|
|||||||
'images\\splash.png',
|
'images\\splash.png',
|
||||||
binaries=a.binaries,
|
binaries=a.binaries,
|
||||||
datas=a.datas,
|
datas=a.datas,
|
||||||
text_pos=(35,378),
|
text_pos=(35, 378),
|
||||||
text_size=12,
|
text_size=12,
|
||||||
text_color='black',
|
text_color='black',
|
||||||
minify_script=True,
|
minify_script=True,
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
from PySide6.QtGui import QDesktopServices, Qt
|
from PySide6.QtGui import QDesktopServices, Qt
|
||||||
from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout
|
from PySide6.QtWidgets import QVBoxLayout, QHBoxLayout
|
||||||
|
from pyparsing import version_info
|
||||||
from qfluentwidgets import PrimaryPushSettingCard, FluentIcon, GroupHeaderCardWidget, PushButton, ImageLabel, TitleLabel
|
from qfluentwidgets import PrimaryPushSettingCard, FluentIcon, GroupHeaderCardWidget, PushButton, ImageLabel, TitleLabel
|
||||||
|
|
||||||
from ui.components.widget import Widget
|
from ui.components.widget import Widget
|
||||||
|
from utils.function import is_frozen
|
||||||
|
|
||||||
|
|
||||||
class AboutWidget(Widget):
|
class AboutWidget(Widget):
|
||||||
@@ -17,11 +19,17 @@ class AboutWidget(Widget):
|
|||||||
self.hBox.addWidget(self.logoImage, 0, Qt.AlignLeft)
|
self.hBox.addWidget(self.logoImage, 0, Qt.AlignLeft)
|
||||||
self.hBox.addWidget(self.appNameLabel, 1, 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(
|
self.version_card = PrimaryPushSettingCard(
|
||||||
text="获取源码",
|
text="获取源码",
|
||||||
icon=FluentIcon.INFO,
|
icon=FluentIcon.INFO,
|
||||||
title="关于",
|
title="关于",
|
||||||
content="作者:许方杰。当前版本:1.0.0\n本软件使用 GPLv3 开源协议进行分发,作者不对使用本软件造成的任何损失负责。"
|
content=f"作者:许方杰。当前版本:1.0.0{build_time_str}\n"
|
||||||
|
f"本软件使用 GPLv3 开源协议进行分发,作者不对使用本软件造成的任何损失负责。"
|
||||||
)
|
)
|
||||||
self.button_list = [
|
self.button_list = [
|
||||||
PushButton("访问网站"),
|
PushButton("访问网站"),
|
||||||
|
|||||||
10
utils/hook.py
Normal file
10
utils/hook.py
Normal 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()
|
||||||
Reference in New Issue
Block a user