Python SDK for JadeView - Create desktop applications with WebView
Project description
JadeUI
Python SDK for JadeView - Create desktop applications with WebView
JadeUI 是 JadeView 的 Python SDK,让你可以使用 Python + Web 技术构建现代桌面应用程序。
特性
- WebView 窗口 - 使用 HTML/CSS/JS 构建 UI
- 现代外观 - 支持 Windows 11 Mica/Acrylic 效果
- 主题切换 - Light/Dark/System 主题
- IPC 通信 - Python 与前端双向通信
安装
pip install jadeui
快速开始
from jadeui import JadeUIApp, Window
app = JadeUIApp()
app.initialize() # 可选参数见下方
@app.on_ready
def on_ready():
window = Window(
title="Hello JadeUI",
width=800,
height=600,
url="https://example.com"
)
window.show()
app.run()
初始化选项
app.initialize(
enable_dev_tools=True, # 启用开发者工具 (F12)
log_file="./app.log", # 日志文件路径
data_directory="./data", # WebView 数据目录,否则在当前目录解压资源
)
完整示例
加载本地 HTML
from jadeui import JadeUIApp, Window, LocalServer
app = JadeUIApp()
server = LocalServer()
@app.on_ready
def on_ready():
url = server.start("./web", "myapp")
window = Window(
title="My App",
width=1024,
height=768,
url=f"{url}/index.html",
remove_titlebar=True, # 无边框窗口
transparent=True,
)
window.show()
window.set_backdrop("mica") # Windows 11 效果
app.run()
IPC 通信
from jadeui import JadeUIApp, Window, IPCManager
app = JadeUIApp()
ipc = IPCManager()
# 注册消息处理器
@ipc.on("message")
def handle_message(window_id, message):
print(f"收到: {message}")
ipc.send(window_id, "reply", f"Echo: {message}")
return 1
@app.on_ready
def on_ready():
Window(title="IPC Demo", url="...").show()
app.run()
前端 JavaScript:
// 发送消息到 Python (使用 jade.ipcSend)
jade.ipcSend("message", "Hello from JS!");
// 接收 Python 消息 (使用 jade.ipcMain)
jade.ipcMain("reply", function(data) {
console.log("Python replied:", data);
});
窗口选项
window = Window(
title="My App",
width=1024,
height=768,
url="https://example.com",
# 外观
remove_titlebar=True, # 移除标题栏
transparent=True, # 透明背景
theme="Dark", # Light/Dark/System
# 大小限制
min_width=800,
min_height=600,
max_width=1920,
max_height=1080,
resizable=True,
# 位置
x=100, # -1 为居中
y=100,
# 状态
maximized=False,
fullscreen=False,
always_on_top=False,
# WebView
autoplay=False,
disable_right_click=False,
user_agent="Custom UA",
)
窗口方法
# 显示/隐藏
window.show()
window.hide()
window.close()
# 状态
window.minimize()
window.maximize()
window.restore()
window.focus()
window.set_fullscreen(True)
# 属性
window.set_title("New Title")
window.set_size(1280, 720)
window.set_position(100, 100)
window.center()
window.set_always_on_top(True)
# 主题
window.set_theme("Dark")
window.set_backdrop("mica") # none/mica/mica_alt/acrylic/tabbed
# WebView
window.load_url("https://example.com")
window.execute_js("console.log('Hello!')")
# 状态查询
window.is_visible
window.is_maximized
window.is_minimized
window.is_focused
API 文档
完整文档请访问: https://jade.run/python-sdk
系统要求
- 操作系统: Windows 10/11
- Python: 3.10+
- 依赖: 无(纯 Python + DLL)
许可证
MIT License
链接
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jadeui-0.1.0.tar.gz.
File metadata
- Download URL: jadeui-0.1.0.tar.gz
- Upload date:
- Size: 31.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ba263d4ab1415842ae10cd345210743c86ded224ebcf00c25e02ffa5a4c3e07
|
|
| MD5 |
3abcb6f46fecffe9dc6256899c303ea3
|
|
| BLAKE2b-256 |
1d447559660b0425fefa07b3491cff04cfe068e2fbc87893b32ac3ee8c380508
|
Provenance
The following attestation bundles were made for jadeui-0.1.0.tar.gz:
Publisher:
publish.yml on HG-ha/Jadeui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jadeui-0.1.0.tar.gz -
Subject digest:
3ba263d4ab1415842ae10cd345210743c86ded224ebcf00c25e02ffa5a4c3e07 - Sigstore transparency entry: 804653210
- Sigstore integration time:
-
Permalink:
HG-ha/Jadeui@6bed7118913ac98d8cc09ceb4cfd755f1a9a5a42 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/HG-ha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6bed7118913ac98d8cc09ceb4cfd755f1a9a5a42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file jadeui-0.1.0-py3-none-win_amd64.whl.
File metadata
- Download URL: jadeui-0.1.0-py3-none-win_amd64.whl
- Upload date:
- Size: 3.4 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f40182d19f22fa11e76b47f350245a80fa580b742f7daf1559fc7552fe50f0a3
|
|
| MD5 |
1d20e0ed0a07b6f2aa7e30175d53d31c
|
|
| BLAKE2b-256 |
2ee94c2b887989fcb51b1c0409ba9a8e884890e37ae70e31cb2c95261fab7d5c
|
Provenance
The following attestation bundles were made for jadeui-0.1.0-py3-none-win_amd64.whl:
Publisher:
publish.yml on HG-ha/Jadeui
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jadeui-0.1.0-py3-none-win_amd64.whl -
Subject digest:
f40182d19f22fa11e76b47f350245a80fa580b742f7daf1559fc7552fe50f0a3 - Sigstore transparency entry: 804653215
- Sigstore integration time:
-
Permalink:
HG-ha/Jadeui@6bed7118913ac98d8cc09ceb4cfd755f1a9a5a42 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/HG-ha
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6bed7118913ac98d8cc09ceb4cfd755f1a9a5a42 -
Trigger Event:
push
-
Statement type: