webview读取ui/dist/index.html、显示版本号
This commit is contained in:
parent
faeeffe34d
commit
20613844db
2 changed files with 4 additions and 2 deletions
|
@ -9,5 +9,5 @@
|
||||||
前端运行 `npm run build` 生成 `ui/dist`,之后安装 PyInstaller,运行
|
前端运行 `npm run build` 生成 `ui/dist`,之后安装 PyInstaller,运行
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pyinstaller -w -F --add-data ui/dist:dist main.py
|
pyinstaller -w -F --add-data ui/dist:ui/dist main.py
|
||||||
```
|
```
|
||||||
|
|
4
main.py
4
main.py
|
@ -4,6 +4,8 @@ from subprocess import PIPE, STDOUT, Popen
|
||||||
|
|
||||||
import webview
|
import webview
|
||||||
|
|
||||||
|
version = "2024-10-10"
|
||||||
|
|
||||||
config_path = Path("launcher.json")
|
config_path = Path("launcher.json")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -65,7 +67,7 @@ class Api:
|
||||||
custom_event(line)
|
custom_event(line)
|
||||||
|
|
||||||
|
|
||||||
window = webview.create_window("mower-ng launcher", "dist/index.html", js_api=Api())
|
window = webview.create_window(f"mower-ng launcher {version}", "ui/dist/index.html", js_api=Api())
|
||||||
webview.start()
|
webview.start()
|
||||||
|
|
||||||
with config_path.open("w") as f:
|
with config_path.open("w") as f:
|
||||||
|
|
Loading…
Reference in a new issue