jadeui 2.3.2__tar.gz → 2.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jadeui-2.3.2 → jadeui-2.3.3}/PKG-INFO +3 -7
- {jadeui-2.3.2 → jadeui-2.3.3}/README.md +2 -6
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/__init__.py +1 -1
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/app.py +1 -3
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/cli/build.py +111 -23
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/cli/doctor.py +7 -7
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/cli/japk.py +0 -1
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/cli/main.py +9 -3
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/cli/project.py +3 -1
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/events.py +3 -1
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/menu.py +1 -3
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/server.py +1 -3
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/window.py +1 -3
- {jadeui-2.3.2 → jadeui-2.3.3}/pyproject.toml +2 -3
- {jadeui-2.3.2 → jadeui-2.3.3}/.gitignore +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/examples/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/examples/backdrop_demo/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/examples/calculator/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/examples/custom_template/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/examples/dialog_notification_demo/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/examples/router_demo/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/examples/simple/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/examples/v23_demo/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/examples/vue_app/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/cli/__init__.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/cli/__main__.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/cli/init.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/cli/run.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/clipboard.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/core/__init__.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/core/dll.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/core/lifecycle.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/core/types.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/dialog.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/downloader.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/exceptions.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/hotkey.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/ipc.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/japk.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/notification.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/router.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/__init__.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/html/.gitignore +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/html/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/html/app.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/html/pyproject.toml +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/html/web/index.html +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/react/.gitignore +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/react/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/react/app.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/react/frontend/index.html +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/react/frontend/package.json +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/react/frontend/src/App.jsx +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/react/frontend/src/main.jsx +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/react/frontend/vite.config.js +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/react/pyproject.toml +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/vue/.gitignore +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/vue/README.md +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/vue/app.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/vue/frontend/index.html +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/vue/frontend/package.json +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/vue/frontend/src/App.vue +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/vue/frontend/src/main.js +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/vue/frontend/vite.config.js +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/scaffolds/vue/pyproject.toml +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/storage.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/system.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/templates/__init__.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/tray.py +0 -0
- {jadeui-2.3.2 → jadeui-2.3.3}/jadeui/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jadeui
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.3
|
|
4
4
|
Summary: Python SDK for JadeView - Create desktop applications with WebView
|
|
5
5
|
Project-URL: Homepage, https://jade.run
|
|
6
6
|
Project-URL: Documentation, https://jade.run/python-sdk
|
|
@@ -211,15 +211,11 @@ Window(title="My App").run(japk="dist/app.japk")
|
|
|
211
211
|
|
|
212
212
|
## 打包发布(宿主 exe)
|
|
213
213
|
|
|
214
|
-
默认使用 **Nuitka** 将 Python 宿主打包为独立可执行文件;也可用 PyInstaller
|
|
214
|
+
默认使用 **Nuitka** 将 Python 宿主打包为独立可执行文件;也可用 PyInstaller。
|
|
215
|
+
缺少打包器时会**自动安装**(`nuitka>=4.0` 或 PyInstaller,可用 `--no-auto-deps` 关闭):
|
|
215
216
|
|
|
216
217
|
```bash
|
|
217
|
-
# Nuitka(推荐;onefile 建议使用 4.0rc7)
|
|
218
|
-
# pip install https://github.com/HG-ha/jadeui/raw/main/scripts/nuitka-4.0.rc7.zip
|
|
219
218
|
jadeui build app.py -o your_app
|
|
220
|
-
|
|
221
|
-
# 可选 PyInstaller
|
|
222
|
-
pip install jadeui[pyinstaller]
|
|
223
219
|
jadeui build app.py -o your_app --packager pyinstaller
|
|
224
220
|
```
|
|
225
221
|
|
|
@@ -174,15 +174,11 @@ Window(title="My App").run(japk="dist/app.japk")
|
|
|
174
174
|
|
|
175
175
|
## 打包发布(宿主 exe)
|
|
176
176
|
|
|
177
|
-
默认使用 **Nuitka** 将 Python 宿主打包为独立可执行文件;也可用 PyInstaller
|
|
177
|
+
默认使用 **Nuitka** 将 Python 宿主打包为独立可执行文件;也可用 PyInstaller。
|
|
178
|
+
缺少打包器时会**自动安装**(`nuitka>=4.0` 或 PyInstaller,可用 `--no-auto-deps` 关闭):
|
|
178
179
|
|
|
179
180
|
```bash
|
|
180
|
-
# Nuitka(推荐;onefile 建议使用 4.0rc7)
|
|
181
|
-
# pip install https://github.com/HG-ha/jadeui/raw/main/scripts/nuitka-4.0.rc7.zip
|
|
182
181
|
jadeui build app.py -o your_app
|
|
183
|
-
|
|
184
|
-
# 可选 PyInstaller
|
|
185
|
-
pip install jadeui[pyinstaller]
|
|
186
182
|
jadeui build app.py -o your_app --packager pyinstaller
|
|
187
183
|
```
|
|
188
184
|
|
|
@@ -606,9 +606,7 @@ class JadeUIApp(EventEmitter):
|
|
|
606
606
|
self.on("window-all-closed", callback)
|
|
607
607
|
return callback
|
|
608
608
|
|
|
609
|
-
def on_second_instance(
|
|
610
|
-
self, callback: Callable[[Any], Any]
|
|
611
|
-
) -> Callable[[Any], Any]:
|
|
609
|
+
def on_second_instance(self, callback: Callable[[Any], Any]) -> Callable[[Any], Any]:
|
|
612
610
|
"""Decorator for second-instance event (requires ``single_instance=True``).
|
|
613
611
|
|
|
614
612
|
Args:
|
|
@@ -9,9 +9,30 @@ import sys
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
from typing import List, Optional, Tuple
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
# Nuitka 4.0+ 已在正式版修复 onefile 缺 VCRUNTIME140 的问题(#3706)
|
|
13
|
+
NUITKA_PIP_SPEC = "nuitka>=4.0"
|
|
14
|
+
NUITKA_INSTALL_CMD = f'pip install "{NUITKA_PIP_SPEC}"'
|
|
15
|
+
PYINSTALLER_INSTALL_CMD = "pip install pyinstaller"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _nuitka_major(version_line: Optional[str]) -> Optional[int]:
|
|
19
|
+
"""Parse major version from ``nuitka --version`` first line (e.g. ``4.1.3``)."""
|
|
20
|
+
if not version_line:
|
|
21
|
+
return None
|
|
22
|
+
token = version_line.strip().split()[0]
|
|
23
|
+
# Accept 4.1.3 / 4.0rc7 / 4.0.0.post1
|
|
24
|
+
major = ""
|
|
25
|
+
for ch in token:
|
|
26
|
+
if ch.isdigit():
|
|
27
|
+
major += ch
|
|
28
|
+
elif ch == "." and major:
|
|
29
|
+
break
|
|
30
|
+
else:
|
|
31
|
+
break
|
|
32
|
+
try:
|
|
33
|
+
return int(major) if major else None
|
|
34
|
+
except ValueError:
|
|
35
|
+
return None
|
|
15
36
|
|
|
16
37
|
|
|
17
38
|
def check_nuitka() -> Tuple[bool, Optional[str]]:
|
|
@@ -43,6 +64,63 @@ def check_pyinstaller() -> Tuple[bool, Optional[str]]:
|
|
|
43
64
|
return False, None
|
|
44
65
|
|
|
45
66
|
|
|
67
|
+
def _pip_install(*packages: str) -> bool:
|
|
68
|
+
cmd = [sys.executable, "-m", "pip", "install", *packages]
|
|
69
|
+
print("执行:", " ".join(cmd))
|
|
70
|
+
code = subprocess.call(cmd)
|
|
71
|
+
return code == 0
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def ensure_nuitka(*, auto_install: bool = True) -> Tuple[bool, Optional[str]]:
|
|
75
|
+
"""Ensure Nuitka >= 4.0 is available; auto-install from PyPI when missing."""
|
|
76
|
+
ok, ver = check_nuitka()
|
|
77
|
+
if ok:
|
|
78
|
+
return True, ver
|
|
79
|
+
if not auto_install:
|
|
80
|
+
print("错误: 未安装 Nuitka")
|
|
81
|
+
print(f" 安装: {NUITKA_INSTALL_CMD}")
|
|
82
|
+
return False, None
|
|
83
|
+
|
|
84
|
+
print(f"未检测到 Nuitka,正在自动安装 {NUITKA_PIP_SPEC} …")
|
|
85
|
+
print("(Nuitka 4.0+ 已修复 onefile 在纯净 Windows 上缺 VC++ 运行时的问题)")
|
|
86
|
+
if not _pip_install(NUITKA_PIP_SPEC):
|
|
87
|
+
print("错误: Nuitka 自动安装失败")
|
|
88
|
+
print(f" 请手动执行: {NUITKA_INSTALL_CMD}")
|
|
89
|
+
return False, None
|
|
90
|
+
|
|
91
|
+
ok, ver = check_nuitka()
|
|
92
|
+
if not ok:
|
|
93
|
+
print("错误: Nuitka 安装后仍不可用,请检查当前 Python 环境")
|
|
94
|
+
return False, None
|
|
95
|
+
print(f"已安装 Nuitka: {ver}")
|
|
96
|
+
return True, ver
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def ensure_pyinstaller(*, auto_install: bool = True) -> Tuple[bool, Optional[str]]:
|
|
100
|
+
"""Ensure PyInstaller is available; auto-install when missing."""
|
|
101
|
+
ok, ver = check_pyinstaller()
|
|
102
|
+
if ok:
|
|
103
|
+
return True, ver
|
|
104
|
+
if not auto_install:
|
|
105
|
+
print("错误: 未安装 PyInstaller")
|
|
106
|
+
print(f" 安装: {PYINSTALLER_INSTALL_CMD}")
|
|
107
|
+
print(" # 或: pip install jadeui[pyinstaller]")
|
|
108
|
+
return False, None
|
|
109
|
+
|
|
110
|
+
print("未检测到 PyInstaller,正在自动安装 …")
|
|
111
|
+
if not _pip_install("pyinstaller"):
|
|
112
|
+
print("错误: PyInstaller 自动安装失败")
|
|
113
|
+
print(f" 请手动执行: {PYINSTALLER_INSTALL_CMD}")
|
|
114
|
+
return False, None
|
|
115
|
+
|
|
116
|
+
ok, ver = check_pyinstaller()
|
|
117
|
+
if not ok:
|
|
118
|
+
print("错误: PyInstaller 安装后仍不可用,请检查当前 Python 环境")
|
|
119
|
+
return False, None
|
|
120
|
+
print(f"已安装 PyInstaller: {ver}")
|
|
121
|
+
return True, ver
|
|
122
|
+
|
|
123
|
+
|
|
46
124
|
def get_jadeui_dll_path() -> Optional[Path]:
|
|
47
125
|
try:
|
|
48
126
|
from jadeui.downloader import find_dll
|
|
@@ -64,7 +142,11 @@ def get_jadeui_dll_path() -> Optional[Path]:
|
|
|
64
142
|
def find_matching_dir(base_path: Path) -> Optional[Path]:
|
|
65
143
|
if not base_path.exists():
|
|
66
144
|
return None
|
|
67
|
-
for pattern in [
|
|
145
|
+
for pattern in [
|
|
146
|
+
f"JadeView_win_{arch}_static_*",
|
|
147
|
+
f"JadeView_win_{arch}_dynamic_*",
|
|
148
|
+
f"JadeView_win_{arch}_*",
|
|
149
|
+
]:
|
|
68
150
|
matches = list(base_path.glob(pattern))
|
|
69
151
|
if matches:
|
|
70
152
|
return sorted(matches)[-1]
|
|
@@ -156,30 +238,34 @@ def build_nuitka(
|
|
|
156
238
|
include_jadeui_dll: bool = True,
|
|
157
239
|
compression_level: int = 1,
|
|
158
240
|
onefile: bool = True,
|
|
241
|
+
auto_install_deps: bool = True,
|
|
159
242
|
) -> int:
|
|
160
243
|
source_path = Path(source_file)
|
|
161
244
|
if not source_path.exists():
|
|
162
245
|
print(f"错误: 源文件不存在: {source_file}")
|
|
163
246
|
return 1
|
|
164
247
|
|
|
165
|
-
nuitka_installed, nuitka_version =
|
|
248
|
+
nuitka_installed, nuitka_version = ensure_nuitka(auto_install=auto_install_deps)
|
|
166
249
|
if not nuitka_installed:
|
|
167
|
-
print("错误: 未安装 Nuitka")
|
|
168
|
-
print()
|
|
169
|
-
print("请先安装 Nuitka 4.0rc7 (推荐,onefile 模式无需 VC++ 运行时):")
|
|
170
|
-
print(f" {NUITKA_INSTALL_CMD}")
|
|
171
|
-
print()
|
|
172
|
-
print("或安装 PyPI 稳定版:")
|
|
173
|
-
print(" pip install nuitka")
|
|
174
250
|
return 1
|
|
175
251
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
252
|
+
major = _nuitka_major(nuitka_version)
|
|
253
|
+
if onefile and (major is None or major < 4):
|
|
254
|
+
print(f"提示: 当前 Nuitka 版本 ({nuitka_version}) 低于 4.0")
|
|
255
|
+
print(" onefile 在纯净 Windows 上可能缺少 VCRUNTIME140.dll")
|
|
256
|
+
if auto_install_deps:
|
|
257
|
+
print(f" 正在升级到 {NUITKA_PIP_SPEC} …")
|
|
258
|
+
if _pip_install("--upgrade", NUITKA_PIP_SPEC):
|
|
259
|
+
ok, ver = check_nuitka()
|
|
260
|
+
if ok and (_nuitka_major(ver) or 0) >= 4:
|
|
261
|
+
nuitka_version = ver
|
|
262
|
+
print(f"已升级 Nuitka: {nuitka_version}")
|
|
263
|
+
else:
|
|
264
|
+
print(f" 升级后仍不足 4.0,请手动执行: {NUITKA_INSTALL_CMD}")
|
|
265
|
+
else:
|
|
266
|
+
print(f" 升级失败,请手动执行: {NUITKA_INSTALL_CMD}")
|
|
267
|
+
else:
|
|
268
|
+
print(f" 推荐升级: {NUITKA_INSTALL_CMD}")
|
|
183
269
|
print()
|
|
184
270
|
|
|
185
271
|
if output_name is None:
|
|
@@ -257,17 +343,15 @@ def build_pyinstaller(
|
|
|
257
343
|
show_console: bool = False,
|
|
258
344
|
include_jadeui_dll: bool = True,
|
|
259
345
|
onefile: bool = True,
|
|
346
|
+
auto_install_deps: bool = True,
|
|
260
347
|
) -> int:
|
|
261
348
|
source_path = Path(source_file)
|
|
262
349
|
if not source_path.exists():
|
|
263
350
|
print(f"错误: 源文件不存在: {source_file}")
|
|
264
351
|
return 1
|
|
265
352
|
|
|
266
|
-
installed, version =
|
|
353
|
+
installed, version = ensure_pyinstaller(auto_install=auto_install_deps)
|
|
267
354
|
if not installed:
|
|
268
|
-
print("错误: 未安装 PyInstaller")
|
|
269
|
-
print(" pip install pyinstaller")
|
|
270
|
-
print(" # 或: pip install jadeui[pyinstaller]")
|
|
271
355
|
return 1
|
|
272
356
|
|
|
273
357
|
if output_name is None:
|
|
@@ -345,6 +429,7 @@ def build(
|
|
|
345
429
|
include_jadeui_dll: bool = True,
|
|
346
430
|
compression_level: int = 1,
|
|
347
431
|
onefile: bool = True,
|
|
432
|
+
auto_install_deps: bool = True,
|
|
348
433
|
) -> int:
|
|
349
434
|
if packager == "pyinstaller":
|
|
350
435
|
return build_pyinstaller(
|
|
@@ -357,6 +442,7 @@ def build(
|
|
|
357
442
|
show_console=show_console,
|
|
358
443
|
include_jadeui_dll=include_jadeui_dll,
|
|
359
444
|
onefile=onefile,
|
|
445
|
+
auto_install_deps=auto_install_deps,
|
|
360
446
|
)
|
|
361
447
|
return build_nuitka(
|
|
362
448
|
source_file=source_file,
|
|
@@ -370,6 +456,7 @@ def build(
|
|
|
370
456
|
include_jadeui_dll=include_jadeui_dll,
|
|
371
457
|
compression_level=compression_level,
|
|
372
458
|
onefile=onefile,
|
|
459
|
+
auto_install_deps=auto_install_deps,
|
|
373
460
|
)
|
|
374
461
|
|
|
375
462
|
|
|
@@ -421,4 +508,5 @@ def run_build(args: argparse.Namespace) -> int:
|
|
|
421
508
|
include_jadeui_dll=not args.no_jadeui_dll,
|
|
422
509
|
compression_level=args.compress,
|
|
423
510
|
onefile=not args.no_onefile,
|
|
511
|
+
auto_install_deps=not getattr(args, "no_auto_deps", False),
|
|
424
512
|
)
|
|
@@ -66,17 +66,17 @@ def run_doctor(_args: argparse.Namespace) -> int:
|
|
|
66
66
|
blocking += 1
|
|
67
67
|
|
|
68
68
|
# Nuitka
|
|
69
|
-
from .build import NUITKA_INSTALL_CMD, check_nuitka
|
|
69
|
+
from .build import NUITKA_INSTALL_CMD, _nuitka_major, check_nuitka
|
|
70
70
|
|
|
71
71
|
ok, ver = check_nuitka()
|
|
72
72
|
if ok:
|
|
73
73
|
note = ""
|
|
74
|
-
if
|
|
75
|
-
note = "(建议升级到 4.
|
|
74
|
+
if (_nuitka_major(ver) or 0) < 4:
|
|
75
|
+
note = "(建议升级到 >=4.0,onefile 才不依赖目标机 VC++ 运行时)"
|
|
76
76
|
_ok(f"Nuitka: {ver}{note}")
|
|
77
77
|
else:
|
|
78
|
-
_warn("未安装 Nuitka(jadeui build
|
|
79
|
-
print(f"
|
|
78
|
+
_warn("未安装 Nuitka(jadeui build 默认会自动安装 nuitka>=4.0)")
|
|
79
|
+
print(f" 也可手动: {NUITKA_INSTALL_CMD}")
|
|
80
80
|
|
|
81
81
|
# PyInstaller
|
|
82
82
|
from .build import check_pyinstaller
|
|
@@ -85,8 +85,8 @@ def run_doctor(_args: argparse.Namespace) -> int:
|
|
|
85
85
|
if ok:
|
|
86
86
|
_ok(f"PyInstaller: {ver}")
|
|
87
87
|
else:
|
|
88
|
-
_warn("未安装 PyInstaller
|
|
89
|
-
print("
|
|
88
|
+
_warn("未安装 PyInstaller(jadeui build --packager pyinstaller 时会自动安装)")
|
|
89
|
+
print(" 也可手动: pip install pyinstaller")
|
|
90
90
|
|
|
91
91
|
# MSVC / clang hints
|
|
92
92
|
if sys.platform == "win32":
|
|
@@ -6,7 +6,6 @@ import argparse
|
|
|
6
6
|
import sys
|
|
7
7
|
from typing import List, Optional, Sequence
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
_COMMANDS = ("init", "build", "japk", "doctor", "run", "download", "clean")
|
|
11
10
|
|
|
12
11
|
|
|
@@ -117,6 +116,9 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
117
116
|
jadeui build --include-data-dir web=web --console
|
|
118
117
|
jadeui build --no-onefile -c 2
|
|
119
118
|
|
|
119
|
+
默认会在缺少打包器时自动安装(Nuitka>=4.0 / PyInstaller,均来自 PyPI)。
|
|
120
|
+
可用 --no-auto-deps 关闭。
|
|
121
|
+
|
|
120
122
|
输出名优先级:
|
|
121
123
|
-o → tool.jadeui.output / tool.jadeui.name → project.name → 源文件名
|
|
122
124
|
""",
|
|
@@ -174,6 +176,11 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
174
176
|
action="store_true",
|
|
175
177
|
help="打包为目录而非单文件",
|
|
176
178
|
)
|
|
179
|
+
p_build.add_argument(
|
|
180
|
+
"--no-auto-deps",
|
|
181
|
+
action="store_true",
|
|
182
|
+
help="禁止自动安装缺失的打包器(Nuitka / PyInstaller)",
|
|
183
|
+
)
|
|
177
184
|
|
|
178
185
|
# ---- japk ----
|
|
179
186
|
p_japk = _add_subparser(
|
|
@@ -229,8 +236,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
|
|
229
236
|
"run",
|
|
230
237
|
help="运行当前项目",
|
|
231
238
|
description=(
|
|
232
|
-
"运行当前目录下的 JadeUI
|
|
233
|
-
"未指定时读 tool.jadeui.entry,否则 app.py。"
|
|
239
|
+
"运行当前目录下的 JadeUI 入口脚本。未指定时读 tool.jadeui.entry,否则 app.py。"
|
|
234
240
|
),
|
|
235
241
|
epilog="""
|
|
236
242
|
示例:
|
|
@@ -172,7 +172,9 @@ def resolve_output_name(
|
|
|
172
172
|
return sanitize_output_name(source_stem), "source stem"
|
|
173
173
|
|
|
174
174
|
|
|
175
|
-
def resolve_entry(
|
|
175
|
+
def resolve_entry(
|
|
176
|
+
cli_script: Optional[str], meta: ProjectMeta, default: str = "app.py"
|
|
177
|
+
) -> Tuple[str, str]:
|
|
176
178
|
if cli_script:
|
|
177
179
|
return cli_script, "CLI"
|
|
178
180
|
if meta.entry:
|
|
@@ -375,7 +375,9 @@ class Events:
|
|
|
375
375
|
FAVICON_UPDATED = "favicon-updated" # 图标更新(别名)
|
|
376
376
|
JAVASCRIPT_RESULT = "javascript-result" # JS执行结果 -> @window.on_js_result
|
|
377
377
|
WEBVIEW_DOWNLOAD_STARTED = "webview-download-started" # 下载开始,可返回"1"阻止 -> @window.on_download_started (v0.3.1+)
|
|
378
|
-
WEBVIEW_DOWNLOAD_COMPLETED =
|
|
378
|
+
WEBVIEW_DOWNLOAD_COMPLETED = (
|
|
379
|
+
"webview-download-completed" # 下载完成 -> @window.on_download_completed
|
|
380
|
+
)
|
|
379
381
|
POSTMESSAGE_RECEIVED = "postmessage-received" # 接收 PostMessage 消息 (v1.0.2+)
|
|
380
382
|
|
|
381
383
|
# ==================== 文件事件 ====================
|
|
@@ -161,9 +161,7 @@ class Menu:
|
|
|
161
161
|
return dll.jade_menu_item_destroy(menu_id) == 1
|
|
162
162
|
|
|
163
163
|
@classmethod
|
|
164
|
-
def _build_items(
|
|
165
|
-
cls, items: List[MenuItemSpec], parent_menu_id: int = 0
|
|
166
|
-
) -> List[int]:
|
|
164
|
+
def _build_items(cls, items: List[MenuItemSpec], parent_menu_id: int = 0) -> List[int]:
|
|
167
165
|
"""在 context-menu 回调内递归构建菜单项,返回该层级的 menu_id 列表。"""
|
|
168
166
|
ids: List[int] = []
|
|
169
167
|
for it in items:
|
|
@@ -104,9 +104,7 @@ class LocalServer:
|
|
|
104
104
|
raise ServerError(f"Root path does not exist: {path}")
|
|
105
105
|
|
|
106
106
|
self._root_path = os.path.abspath(path)
|
|
107
|
-
is_japk_file = os.path.isfile(self._root_path) and self._root_path.lower().endswith(
|
|
108
|
-
".japk"
|
|
109
|
-
)
|
|
107
|
+
is_japk_file = os.path.isfile(self._root_path) and self._root_path.lower().endswith(".japk")
|
|
110
108
|
# hot_reload only valid for directory mode per official docs
|
|
111
109
|
effective_hot_reload = bool(hot_reload) and not is_japk_file
|
|
112
110
|
|
|
@@ -1518,9 +1518,7 @@ class Window(EventEmitter):
|
|
|
1518
1518
|
if headers:
|
|
1519
1519
|
headers_json = _json_dumps(headers, ensure_ascii=False).encode("utf-8")
|
|
1520
1520
|
# JadeView 2.x: navigate_to_url(window_id, url, headers_json)
|
|
1521
|
-
self.dll_manager.navigate_to_url(
|
|
1522
|
-
self.id, url.encode("utf-8"), headers_json
|
|
1523
|
-
)
|
|
1521
|
+
self.dll_manager.navigate_to_url(self.id, url.encode("utf-8"), headers_json)
|
|
1524
1522
|
return self
|
|
1525
1523
|
|
|
1526
1524
|
def navigate(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "jadeui"
|
|
3
|
-
version = "2.3.
|
|
3
|
+
version = "2.3.3"
|
|
4
4
|
description = "Python SDK for JadeView - Create desktop applications with WebView"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = {text = "MIT"}
|
|
@@ -35,8 +35,7 @@ dev = [
|
|
|
35
35
|
"mypy>=1.0",
|
|
36
36
|
"build>=1.0",
|
|
37
37
|
"imageio",
|
|
38
|
-
#
|
|
39
|
-
# pip install https://github.com/HG-ha/jadeui/raw/main/scripts/nuitka-4.0.rc7.zip
|
|
38
|
+
# Nuitka:jadeui build 默认会自动安装 nuitka>=4.0(正式版已修复 onefile VC++ 问题)
|
|
40
39
|
]
|
|
41
40
|
pyinstaller = [
|
|
42
41
|
"pyinstaller>=6.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|