decoui 0.1.0__py3-none-any.whl
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.
- decoui/icon.png +0 -0
- decoui-0.1.0.dist-info/METADATA +211 -0
- decoui-0.1.0.dist-info/RECORD +5 -0
- decoui-0.1.0.dist-info/WHEEL +4 -0
- decoui-0.1.0.dist-info/licenses/LICENSE +21 -0
decoui/icon.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: decoui
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Decorator-driven GUI framework for Python — generate PySide6 UIs from type annotations
|
|
5
|
+
Project-URL: Homepage, https://github.com/luvmagi/decoui
|
|
6
|
+
Project-URL: Repository, https://github.com/luvmagi/decoui
|
|
7
|
+
Project-URL: Issues, https://github.com/luvmagi/decoui/issues
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: decorator,framework,gui,pyside6,qt,ui
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: pyside6>=6.6.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# decoui
|
|
26
|
+
|
|
27
|
+
Decorator-driven GUI framework for Python. Annotate your methods — decoui generates a full PySide6 desktop app automatically.
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- **Zero UI code** — decorate a class and its methods, call `gui_main()`
|
|
36
|
+
- **Native type mapping** — `str`, `int`, `float`, `bool`, `list`, `dict`, `Enum` → widgets automatically
|
|
37
|
+
- **Async execution** — every tool runs in a thread; stdout and `logging` are captured in real time
|
|
38
|
+
- **Execution history** — every run is persisted to SQLite with parameters, logs, and status
|
|
39
|
+
- **Replay** — restore any past run's parameters with one click
|
|
40
|
+
- **Light theme** — clean built-in stylesheet, Consolas / 微软雅黑 / Meiryo font stack
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install decoui
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Requires Python 3.10+ and PySide6 6.6+.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import logging
|
|
58
|
+
from decoui import tool, toolset, gui_main
|
|
59
|
+
|
|
60
|
+
@toolset(label="Text Tools", tags=["text"])
|
|
61
|
+
class TextTools:
|
|
62
|
+
|
|
63
|
+
@tool(label="Count Characters",
|
|
64
|
+
description="Count chars, words and lines.",
|
|
65
|
+
placeholders={"content": "Paste text here…"})
|
|
66
|
+
def count(self, content: str = "") -> str:
|
|
67
|
+
words = len(content.split())
|
|
68
|
+
logging.info("words=%d", words)
|
|
69
|
+
return f"{len(content)} chars / {words} words"
|
|
70
|
+
|
|
71
|
+
if __name__ == "__main__":
|
|
72
|
+
gui_main(title="My Tools")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`gui_main()` auto-discovers every `@toolset` class in the caller's global scope — no explicit registration needed.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## API Reference
|
|
80
|
+
|
|
81
|
+
### `@toolset`
|
|
82
|
+
|
|
83
|
+
Applied to a class. Groups its `@tool` methods under one sidebar entry.
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
@toolset(
|
|
87
|
+
label="CSV Tools", # required — sidebar display name
|
|
88
|
+
tags=["file", "batch"], # optional — used by the tag filter bar
|
|
89
|
+
description="...", # optional — tooltip on hover in the sidebar
|
|
90
|
+
)
|
|
91
|
+
class CsvTools:
|
|
92
|
+
...
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
| Parameter | Type | Description |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `label` | `str` | Required. Display name in the sidebar. |
|
|
98
|
+
| `tags` | `list[str]` | Tag filter bar labels. Multiple tags = AND filter. |
|
|
99
|
+
| `description` | `str` | Shown as a tooltip when hovering the toolset in the nav tree. |
|
|
100
|
+
|
|
101
|
+
### `@tool`
|
|
102
|
+
|
|
103
|
+
Applied to a method inside a `@toolset` class.
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
@tool(
|
|
107
|
+
label="Merge Files",
|
|
108
|
+
description="Merge multiple files into one.",
|
|
109
|
+
placeholders={"files": "one path per line"},
|
|
110
|
+
confirm=True, # show confirmation dialog before running
|
|
111
|
+
timeout=120, # cancel after N seconds (None = unlimited)
|
|
112
|
+
)
|
|
113
|
+
def merge(self, files: list, output: str = "out.txt") -> str:
|
|
114
|
+
...
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
| Parameter | Type | Default | Description |
|
|
118
|
+
|---|---|---|---|
|
|
119
|
+
| `label` | `str` | required | Tool display name. |
|
|
120
|
+
| `description` | `str` | `""` | Shown in a bordered box below the title. |
|
|
121
|
+
| `placeholders` | `dict[str,str]` | `{}` | Placeholder text per parameter name. |
|
|
122
|
+
| `confirm` | `bool` | `False` | Show a Yes/No confirmation dialog before running. |
|
|
123
|
+
| `timeout` | `int\|None` | `None` | Execution timeout in seconds. |
|
|
124
|
+
|
|
125
|
+
### `gui_main`
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
gui_main(title="My App", db_path="~/.myapp/history.db")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
| Parameter | Type | Default | Description |
|
|
132
|
+
|---|---|---|---|
|
|
133
|
+
| `title` | `str` | `"decoui"` | Window title. |
|
|
134
|
+
| `db_path` | `str\|Path\|None` | `~/.decoui/history.db` | SQLite database path for execution history. |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Type → Widget Mapping
|
|
139
|
+
|
|
140
|
+
| Python annotation | Widget | Notes |
|
|
141
|
+
|---|---|---|
|
|
142
|
+
| `str` | `QLineEdit` | Single-line text. |
|
|
143
|
+
| `int` | `QSpinBox` | Integer, full int range. |
|
|
144
|
+
| `float` | `QDoubleSpinBox` | 4 decimal places. |
|
|
145
|
+
| `bool` | `QCheckBox` | Checked / unchecked. |
|
|
146
|
+
| `list` | `QTextEdit` | One item per line or comma-separated. |
|
|
147
|
+
| `dict` | `QTextEdit` | JSON input; parsed with `json.loads` then `ast.literal_eval`. Raises on invalid input. |
|
|
148
|
+
| `Enum` subclass | `QComboBox` | Dropdown of enum members. |
|
|
149
|
+
|
|
150
|
+
- Required parameters (no default) are marked with a red `*` in the form label.
|
|
151
|
+
- `Optional[X]` is unwrapped to `X`.
|
|
152
|
+
- Default values are pre-filled into widgets automatically.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Output & Logging
|
|
157
|
+
|
|
158
|
+
Tool methods can use `print()` and the standard `logging` module. Both are captured and rendered in the output console with colour coding:
|
|
159
|
+
|
|
160
|
+
| Source | Colour |
|
|
161
|
+
|---|---|
|
|
162
|
+
| `print` / stdout | White |
|
|
163
|
+
| `logging.DEBUG` | Gray |
|
|
164
|
+
| `logging.INFO` | Cyan |
|
|
165
|
+
| `logging.WARNING` | Yellow |
|
|
166
|
+
| `logging.ERROR` | Red |
|
|
167
|
+
| `logging.CRITICAL` | Bold Red |
|
|
168
|
+
|
|
169
|
+
Return values from tool methods are **not** displayed in the GUI. Use `logging` or `print` for any output you want users to see.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Tool Page Buttons
|
|
174
|
+
|
|
175
|
+
| Button | Action |
|
|
176
|
+
|---|---|
|
|
177
|
+
| **Run** | Type-coerce parameters, run the method in a background thread. |
|
|
178
|
+
| **Reset** | Expand the parameter panel and clear the output console. Parameters are kept. |
|
|
179
|
+
| **Stop** | Request cancellation of the running task. |
|
|
180
|
+
| **Replay** | Open the History panel pre-filtered to this tool's past runs. |
|
|
181
|
+
| **Copy** | Copy current console output to clipboard. |
|
|
182
|
+
| **View Log** | Open the current console output in a resizable log viewer window. |
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Execution History
|
|
187
|
+
|
|
188
|
+
Every run is stored in SQLite. The History panel (sidebar button) shows:
|
|
189
|
+
|
|
190
|
+
- Timestamp, tool name, status badge, duration
|
|
191
|
+
- Per-row checkboxes with **Select All / Deselect All / Delete Selected**
|
|
192
|
+
- Filter by tool, status, and time range
|
|
193
|
+
- Click any row to see the parameter snapshot
|
|
194
|
+
- **Replay Params** — restores that run's parameters to the tool's form
|
|
195
|
+
- **View Full Log** — opens the full log in a resizable window with level filters and search
|
|
196
|
+
|
|
197
|
+
History is stored at `~/.decoui/history.db` by default. Override with `db_path` in `gui_main()`.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Example
|
|
202
|
+
|
|
203
|
+
See [`src/decoui/example.py`](src/decoui/example.py) for a complete demo covering all supported widget types.
|
|
204
|
+
|
|
205
|
+
Run it with:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
uv run python main.py
|
|
209
|
+
# or
|
|
210
|
+
python main.py
|
|
211
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
decoui/icon.png,sha256=7qdORrTzDjj0oHNYHbwB06Mhb4uuYVsWS4hxiNT9EAY,82054
|
|
2
|
+
decoui-0.1.0.dist-info/METADATA,sha256=2b-CvLFz9FC1rKb6p2iVTZvEAyxzN0mpWNB59Caytb0,6803
|
|
3
|
+
decoui-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
4
|
+
decoui-0.1.0.dist-info/licenses/LICENSE,sha256=iumbcqW-tKuArmv7MT1xGpb294kr5Kif3DsQFWhFZXI,1085
|
|
5
|
+
decoui-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 luvMagi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|