jadeui 0.1.0__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.
@@ -0,0 +1,68 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ venv/
25
+ ENV/
26
+ env/
27
+ .venv/
28
+
29
+ # IDE
30
+ .idea/
31
+ .vscode/
32
+ *.swp
33
+ *.swo
34
+ *~
35
+ .cursor/
36
+
37
+ # Testing
38
+ .tox/
39
+ .nox/
40
+ .coverage
41
+ .coverage.*
42
+ htmlcov/
43
+ .pytest_cache/
44
+ .mypy_cache/
45
+
46
+ # Build
47
+ *.manifest
48
+ *.spec
49
+
50
+ # DLL (development only, included in wheel)
51
+ jadeui/dll/
52
+
53
+ # Logs
54
+ *.log
55
+ JadeViewDemo_error.log
56
+ JadeUI_error.log
57
+
58
+ # Node.js
59
+ node_modules/
60
+ package-lock.json
61
+
62
+ # OS
63
+ .DS_Store
64
+ Thumbs.db
65
+
66
+ # uv
67
+ .uv/
68
+
jadeui-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,247 @@
1
+ Metadata-Version: 2.4
2
+ Name: jadeui
3
+ Version: 0.1.0
4
+ Summary: Python SDK for JadeView - Create desktop applications with WebView
5
+ Project-URL: Homepage, https://jade.run
6
+ Project-URL: Documentation, https://jade.run/python-sdk
7
+ Project-URL: Repository, https://github.com/ArcletProject/jadeui
8
+ Project-URL: Issues, https://github.com/ArcletProject/jadeui/issues
9
+ Author: JadeView Team
10
+ License: MIT
11
+ Keywords: desktop,gui,jadeui,jadeview,ui,webview
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Desktop Environment
21
+ Classifier: Topic :: Software Development :: User Interfaces
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: imageio>=2.37.2
24
+ Requires-Dist: nuitka>=2.8.9
25
+ Provides-Extra: dev
26
+ Requires-Dist: build>=1.0; extra == 'dev'
27
+ Requires-Dist: mypy>=1.0; extra == 'dev'
28
+ Requires-Dist: pytest>=7.0; extra == 'dev'
29
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # JadeUI
33
+
34
+ <p align="center">
35
+ <strong>Python SDK for JadeView - Create desktop applications with WebView</strong>
36
+ </p>
37
+
38
+ <p align="center">
39
+ <a href="https://pypi.org/project/jadeui/"><img src="https://img.shields.io/pypi/v/jadeui.svg" alt="PyPI version"></a>
40
+ <a href="https://pypi.org/project/jadeui/"><img src="https://img.shields.io/pypi/pyversions/jadeui.svg" alt="Python versions"></a>
41
+ </p>
42
+
43
+ ---
44
+
45
+ JadeUI 是 [JadeView](https://jade.run) 的 Python SDK,让你可以使用 Python + Web 技术构建现代桌面应用程序。
46
+
47
+ ## 特性
48
+
49
+ - **WebView 窗口** - 使用 HTML/CSS/JS 构建 UI
50
+ - **现代外观** - 支持 Windows 11 Mica/Acrylic 效果
51
+ - **主题切换** - Light/Dark/System 主题
52
+ - **IPC 通信** - Python 与前端双向通信
53
+
54
+ ## 安装
55
+
56
+ ```bash
57
+ pip install jadeui
58
+ ```
59
+
60
+ ## 快速开始
61
+
62
+ ```python
63
+ from jadeui import JadeUIApp, Window
64
+
65
+ app = JadeUIApp()
66
+ app.initialize() # 可选参数见下方
67
+
68
+ @app.on_ready
69
+ def on_ready():
70
+ window = Window(
71
+ title="Hello JadeUI",
72
+ width=800,
73
+ height=600,
74
+ url="https://example.com"
75
+ )
76
+ window.show()
77
+
78
+ app.run()
79
+ ```
80
+
81
+ ### 初始化选项
82
+
83
+ ```python
84
+ app.initialize(
85
+ enable_dev_tools=True, # 启用开发者工具 (F12)
86
+ log_file="./app.log", # 日志文件路径
87
+ data_directory="./data", # WebView 数据目录,否则在当前目录解压资源
88
+ )
89
+ ```
90
+
91
+ ## 完整示例
92
+
93
+ ### 加载本地 HTML
94
+
95
+ ```python
96
+ from jadeui import JadeUIApp, Window, LocalServer
97
+
98
+ app = JadeUIApp()
99
+ server = LocalServer()
100
+
101
+ @app.on_ready
102
+ def on_ready():
103
+ url = server.start("./web", "myapp")
104
+
105
+ window = Window(
106
+ title="My App",
107
+ width=1024,
108
+ height=768,
109
+ url=f"{url}/index.html",
110
+ remove_titlebar=True, # 无边框窗口
111
+ transparent=True,
112
+ )
113
+ window.show()
114
+ window.set_backdrop("mica") # Windows 11 效果
115
+
116
+ app.run()
117
+ ```
118
+
119
+ ### IPC 通信
120
+
121
+ ```python
122
+ from jadeui import JadeUIApp, Window, IPCManager
123
+
124
+ app = JadeUIApp()
125
+ ipc = IPCManager()
126
+
127
+ # 注册消息处理器
128
+ @ipc.on("message")
129
+ def handle_message(window_id, message):
130
+ print(f"收到: {message}")
131
+ ipc.send(window_id, "reply", f"Echo: {message}")
132
+ return 1
133
+
134
+ @app.on_ready
135
+ def on_ready():
136
+ Window(title="IPC Demo", url="...").show()
137
+
138
+ app.run()
139
+ ```
140
+
141
+ **前端 JavaScript:**
142
+
143
+ ```javascript
144
+ // 发送消息到 Python (使用 jade.ipcSend)
145
+ jade.ipcSend("message", "Hello from JS!");
146
+
147
+ // 接收 Python 消息 (使用 jade.ipcMain)
148
+ jade.ipcMain("reply", function(data) {
149
+ console.log("Python replied:", data);
150
+ });
151
+ ```
152
+
153
+ ## 窗口选项
154
+
155
+ ```python
156
+ window = Window(
157
+ title="My App",
158
+ width=1024,
159
+ height=768,
160
+ url="https://example.com",
161
+
162
+ # 外观
163
+ remove_titlebar=True, # 移除标题栏
164
+ transparent=True, # 透明背景
165
+ theme="Dark", # Light/Dark/System
166
+
167
+ # 大小限制
168
+ min_width=800,
169
+ min_height=600,
170
+ max_width=1920,
171
+ max_height=1080,
172
+ resizable=True,
173
+
174
+ # 位置
175
+ x=100, # -1 为居中
176
+ y=100,
177
+
178
+ # 状态
179
+ maximized=False,
180
+ fullscreen=False,
181
+ always_on_top=False,
182
+
183
+ # WebView
184
+ autoplay=False,
185
+ disable_right_click=False,
186
+ user_agent="Custom UA",
187
+ )
188
+ ```
189
+
190
+ ## 窗口方法
191
+
192
+ ```python
193
+ # 显示/隐藏
194
+ window.show()
195
+ window.hide()
196
+ window.close()
197
+
198
+ # 状态
199
+ window.minimize()
200
+ window.maximize()
201
+ window.restore()
202
+ window.focus()
203
+ window.set_fullscreen(True)
204
+
205
+ # 属性
206
+ window.set_title("New Title")
207
+ window.set_size(1280, 720)
208
+ window.set_position(100, 100)
209
+ window.center()
210
+ window.set_always_on_top(True)
211
+
212
+ # 主题
213
+ window.set_theme("Dark")
214
+ window.set_backdrop("mica") # none/mica/mica_alt/acrylic/tabbed
215
+
216
+ # WebView
217
+ window.load_url("https://example.com")
218
+ window.execute_js("console.log('Hello!')")
219
+
220
+ # 状态查询
221
+ window.is_visible
222
+ window.is_maximized
223
+ window.is_minimized
224
+ window.is_focused
225
+ ```
226
+
227
+ ## API 文档
228
+
229
+ 完整文档请访问: https://jade.run/python-sdk
230
+
231
+ ## 系统要求
232
+
233
+ - **操作系统**: Windows 10/11
234
+ - **Python**: 3.10+
235
+ - **依赖**: 无(纯 Python + DLL)
236
+
237
+ ## 许可证
238
+
239
+ MIT License
240
+
241
+ ## 链接
242
+
243
+ - [Python SDK 文档](https://jade.run/python-sdk)
244
+ - [JadeView 官网](https://jade.run)
245
+ - [GitHub](https://github.com/ArcletProject/jadeui)
246
+ - [PyPI](https://pypi.org/project/jadeui/)
247
+
jadeui-0.1.0/README.md ADDED
@@ -0,0 +1,216 @@
1
+ # JadeUI
2
+
3
+ <p align="center">
4
+ <strong>Python SDK for JadeView - Create desktop applications with WebView</strong>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://pypi.org/project/jadeui/"><img src="https://img.shields.io/pypi/v/jadeui.svg" alt="PyPI version"></a>
9
+ <a href="https://pypi.org/project/jadeui/"><img src="https://img.shields.io/pypi/pyversions/jadeui.svg" alt="Python versions"></a>
10
+ </p>
11
+
12
+ ---
13
+
14
+ JadeUI 是 [JadeView](https://jade.run) 的 Python SDK,让你可以使用 Python + Web 技术构建现代桌面应用程序。
15
+
16
+ ## 特性
17
+
18
+ - **WebView 窗口** - 使用 HTML/CSS/JS 构建 UI
19
+ - **现代外观** - 支持 Windows 11 Mica/Acrylic 效果
20
+ - **主题切换** - Light/Dark/System 主题
21
+ - **IPC 通信** - Python 与前端双向通信
22
+
23
+ ## 安装
24
+
25
+ ```bash
26
+ pip install jadeui
27
+ ```
28
+
29
+ ## 快速开始
30
+
31
+ ```python
32
+ from jadeui import JadeUIApp, Window
33
+
34
+ app = JadeUIApp()
35
+ app.initialize() # 可选参数见下方
36
+
37
+ @app.on_ready
38
+ def on_ready():
39
+ window = Window(
40
+ title="Hello JadeUI",
41
+ width=800,
42
+ height=600,
43
+ url="https://example.com"
44
+ )
45
+ window.show()
46
+
47
+ app.run()
48
+ ```
49
+
50
+ ### 初始化选项
51
+
52
+ ```python
53
+ app.initialize(
54
+ enable_dev_tools=True, # 启用开发者工具 (F12)
55
+ log_file="./app.log", # 日志文件路径
56
+ data_directory="./data", # WebView 数据目录,否则在当前目录解压资源
57
+ )
58
+ ```
59
+
60
+ ## 完整示例
61
+
62
+ ### 加载本地 HTML
63
+
64
+ ```python
65
+ from jadeui import JadeUIApp, Window, LocalServer
66
+
67
+ app = JadeUIApp()
68
+ server = LocalServer()
69
+
70
+ @app.on_ready
71
+ def on_ready():
72
+ url = server.start("./web", "myapp")
73
+
74
+ window = Window(
75
+ title="My App",
76
+ width=1024,
77
+ height=768,
78
+ url=f"{url}/index.html",
79
+ remove_titlebar=True, # 无边框窗口
80
+ transparent=True,
81
+ )
82
+ window.show()
83
+ window.set_backdrop("mica") # Windows 11 效果
84
+
85
+ app.run()
86
+ ```
87
+
88
+ ### IPC 通信
89
+
90
+ ```python
91
+ from jadeui import JadeUIApp, Window, IPCManager
92
+
93
+ app = JadeUIApp()
94
+ ipc = IPCManager()
95
+
96
+ # 注册消息处理器
97
+ @ipc.on("message")
98
+ def handle_message(window_id, message):
99
+ print(f"收到: {message}")
100
+ ipc.send(window_id, "reply", f"Echo: {message}")
101
+ return 1
102
+
103
+ @app.on_ready
104
+ def on_ready():
105
+ Window(title="IPC Demo", url="...").show()
106
+
107
+ app.run()
108
+ ```
109
+
110
+ **前端 JavaScript:**
111
+
112
+ ```javascript
113
+ // 发送消息到 Python (使用 jade.ipcSend)
114
+ jade.ipcSend("message", "Hello from JS!");
115
+
116
+ // 接收 Python 消息 (使用 jade.ipcMain)
117
+ jade.ipcMain("reply", function(data) {
118
+ console.log("Python replied:", data);
119
+ });
120
+ ```
121
+
122
+ ## 窗口选项
123
+
124
+ ```python
125
+ window = Window(
126
+ title="My App",
127
+ width=1024,
128
+ height=768,
129
+ url="https://example.com",
130
+
131
+ # 外观
132
+ remove_titlebar=True, # 移除标题栏
133
+ transparent=True, # 透明背景
134
+ theme="Dark", # Light/Dark/System
135
+
136
+ # 大小限制
137
+ min_width=800,
138
+ min_height=600,
139
+ max_width=1920,
140
+ max_height=1080,
141
+ resizable=True,
142
+
143
+ # 位置
144
+ x=100, # -1 为居中
145
+ y=100,
146
+
147
+ # 状态
148
+ maximized=False,
149
+ fullscreen=False,
150
+ always_on_top=False,
151
+
152
+ # WebView
153
+ autoplay=False,
154
+ disable_right_click=False,
155
+ user_agent="Custom UA",
156
+ )
157
+ ```
158
+
159
+ ## 窗口方法
160
+
161
+ ```python
162
+ # 显示/隐藏
163
+ window.show()
164
+ window.hide()
165
+ window.close()
166
+
167
+ # 状态
168
+ window.minimize()
169
+ window.maximize()
170
+ window.restore()
171
+ window.focus()
172
+ window.set_fullscreen(True)
173
+
174
+ # 属性
175
+ window.set_title("New Title")
176
+ window.set_size(1280, 720)
177
+ window.set_position(100, 100)
178
+ window.center()
179
+ window.set_always_on_top(True)
180
+
181
+ # 主题
182
+ window.set_theme("Dark")
183
+ window.set_backdrop("mica") # none/mica/mica_alt/acrylic/tabbed
184
+
185
+ # WebView
186
+ window.load_url("https://example.com")
187
+ window.execute_js("console.log('Hello!')")
188
+
189
+ # 状态查询
190
+ window.is_visible
191
+ window.is_maximized
192
+ window.is_minimized
193
+ window.is_focused
194
+ ```
195
+
196
+ ## API 文档
197
+
198
+ 完整文档请访问: https://jade.run/python-sdk
199
+
200
+ ## 系统要求
201
+
202
+ - **操作系统**: Windows 10/11
203
+ - **Python**: 3.10+
204
+ - **依赖**: 无(纯 Python + DLL)
205
+
206
+ ## 许可证
207
+
208
+ MIT License
209
+
210
+ ## 链接
211
+
212
+ - [Python SDK 文档](https://jade.run/python-sdk)
213
+ - [JadeView 官网](https://jade.run)
214
+ - [GitHub](https://github.com/ArcletProject/jadeui)
215
+ - [PyPI](https://pypi.org/project/jadeui/)
216
+
@@ -0,0 +1,21 @@
1
+ # JadeUI Examples
2
+
3
+ 示例程序,展示 JadeUI 的各种用法。
4
+
5
+ ## 示例列表
6
+
7
+ | 示例 | 说明 |
8
+ |------|------|
9
+ | [calculator](./calculator/) | 简单计算器,演示基础窗口和 IPC |
10
+ | [router_demo](./router_demo/) | 内置路由系统,多页面应用 |
11
+ | [custom_template](./custom_template/) | 自定义 HTML 模板 |
12
+ | [backdrop_demo](./backdrop_demo/) | Windows 11 背景材料效果 |
13
+ | [vue_app](./vue_app/) | Vue.js 前端框架集成 |
14
+
15
+ ## 运行方式
16
+
17
+ ```bash
18
+ cd examples/<示例名>
19
+ python app.py
20
+ ```
21
+
@@ -0,0 +1,36 @@
1
+ # Backdrop Demo
2
+
3
+ Windows 11 背景材料效果演示。
4
+
5
+ ## 功能
6
+
7
+ - Mica 效果
8
+ - Mica Alt 效果
9
+ - Acrylic 效果
10
+ - 主题切换
11
+
12
+ ## 运行
13
+
14
+ ```bash
15
+ python app.py
16
+ ```
17
+
18
+ ## 打包
19
+
20
+ ```bash
21
+ python ..\..\scripts\build.py app.py --output backdrop_demo
22
+ ```
23
+
24
+ ## 背景材料
25
+
26
+ | 类型 | 说明 |
27
+ |------|------|
28
+ | `mica` | 从桌面壁纸采样颜色,性能最佳 |
29
+ | `micaAlt` | Mica 的替代版本,效果更明显 |
30
+ | `acrylic` | 半透明模糊效果 |
31
+
32
+ ## 注意
33
+
34
+ - 需要 Windows 11
35
+ - 窗口必须设置 `transparent=True`
36
+
@@ -0,0 +1,38 @@
1
+ # Calculator
2
+
3
+ 简单计算器示例,演示基础的窗口创建和 IPC 通信。
4
+
5
+ ## 功能
6
+
7
+ - 自定义标题栏
8
+ - 键盘输入支持
9
+ - Python 后端计算
10
+ - Mica 透明背景效果
11
+ - 应用图标
12
+
13
+ ## 运行
14
+
15
+ ```bash
16
+ python examples/calculator/app.py
17
+ ```
18
+
19
+ ## 打包
20
+
21
+ 在 `examples/calculator` 目录下执行:
22
+
23
+ ```bash
24
+ python ..\..\scripts\build.py app.py --output calculator
25
+ ```
26
+
27
+ 脚本会自动包含 `web` 目录和 `web/favicon.png` 图标。
28
+
29
+ ## 文件结构
30
+
31
+ ```
32
+ calculator/
33
+ ├── app.py # Python 后端
34
+ ├── README.md # 说明文档
35
+ └── web/
36
+ ├── index.html # 前端界面
37
+ └── favicon.png # 应用图标
38
+ ```
@@ -0,0 +1,49 @@
1
+ # Custom Template
2
+
3
+ 自定义 HTML 模板示例,完全控制应用布局。
4
+
5
+ ## 功能
6
+
7
+ - 自定义导航栏布局
8
+ - 自定义主题切换
9
+ - 使用 Router 处理页面内容
10
+
11
+ ## 运行
12
+
13
+ ```bash
14
+ python app.py
15
+ ```
16
+
17
+ ## 打包
18
+
19
+ ```bash
20
+ python ..\..\scripts\build.py app.py --output custom_template
21
+ ```
22
+
23
+ ## 文件结构
24
+
25
+ ```
26
+ custom_template/
27
+ ├── app.py # Python 后端
28
+ └── web/
29
+ ├── index.html # 自定义模板
30
+ ├── css/
31
+ │ └── custom.css # 自定义样式
32
+ └── pages/ # 页面内容
33
+ ```
34
+
35
+ ## 自定义模板要求
36
+
37
+ 1. 包含 `id="page-content"` 的元素用于渲染页面
38
+ 2. 监听 `router:update` IPC 消息
39
+ 3. 发送 `router:ready` 通知后端
40
+
41
+ ```javascript
42
+ jade.ipcMain('router:update', async function(data) {
43
+ const navData = JSON.parse(data);
44
+ // 加载页面内容到 #page-content
45
+ });
46
+
47
+ jade.ipcSend('router:ready', '');
48
+ ```
49
+
@@ -0,0 +1,45 @@
1
+ # Router Demo
2
+
3
+ 内置路由系统示例,展示多页面应用的实现。
4
+
5
+ ## 功能
6
+
7
+ - 后端驱动的路由
8
+ - 自动生成侧边栏导航
9
+ - 主题切换(浅色/深色/跟随系统)
10
+ - 动态页面加载
11
+
12
+ ## 运行
13
+
14
+ ```bash
15
+ python app.py
16
+ ```
17
+
18
+ ## 打包
19
+
20
+ ```bash
21
+ python ..\..\scripts\build.py app.py --output router_demo
22
+ ```
23
+
24
+ ## 文件结构
25
+
26
+ ```
27
+ router_demo/
28
+ ├── app.py # Python 后端,定义路由
29
+ └── web/
30
+ ├── _app.html # 自动生成的框架
31
+ ├── css/
32
+ │ └── jadeui.css # 内置样式
33
+ └── pages/ # 页面模板
34
+ ├── home.html
35
+ ├── dashboard.html
36
+ ├── users.html
37
+ └── ...
38
+ ```
39
+
40
+ ## 添加新页面
41
+
42
+ ```python
43
+ router.page("/new", "pages/new.html", title="新页面", icon="📄")
44
+ ```
45
+