lumenui 0.0.7__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.
- lumen/__init__.py +90 -0
- lumen/_ffi.py +985 -0
- lumen/_lib.py +48 -0
- lumen/_version.py +10 -0
- lumen/api.py +472 -0
- lumen/dom.py +719 -0
- lumen/errors.py +199 -0
- lumen/model.py +173 -0
- lumen/py.typed +0 -0
- lumen/raw.py +212 -0
- lumen/signals.py +369 -0
- lumenui-0.0.7.dist-info/METADATA +283 -0
- lumenui-0.0.7.dist-info/RECORD +14 -0
- lumenui-0.0.7.dist-info/WHEEL +4 -0
lumen/__init__.py
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Python SDK for the Lumen UI framework, built on ``ctypes`` over the
|
|
2
|
+
``lumen`` C ABI. Stdlib-only -- no compiled extension, no ``cffi``,
|
|
3
|
+
no build step of its own; it just needs ``liblumen`` built once
|
|
4
|
+
(``cargo build -p lumen``) and loadable at import time.
|
|
5
|
+
|
|
6
|
+
Typical usage::
|
|
7
|
+
|
|
8
|
+
import lumen
|
|
9
|
+
|
|
10
|
+
class Counter(lumen.Model): # fields ARE typed signals
|
|
11
|
+
count: int = 0
|
|
12
|
+
label: str = "0 clicks"
|
|
13
|
+
|
|
14
|
+
app = lumen.App("path/to/app", title="Counter")
|
|
15
|
+
state = Counter(app)
|
|
16
|
+
|
|
17
|
+
@app.on_click("bump")
|
|
18
|
+
def bump(_):
|
|
19
|
+
state.count += 1 # typed, autocompleted, syncs to runtime
|
|
20
|
+
state.label = f"{state.count} clicks"
|
|
21
|
+
|
|
22
|
+
app.run() # blocks until the window closes
|
|
23
|
+
|
|
24
|
+
The surface, from most to least abstract:
|
|
25
|
+
|
|
26
|
+
* :class:`Model` / :class:`Field` - declarative reactive state.
|
|
27
|
+
* :class:`Signal` (typed handle), :func:`computed`, :class:`Color`.
|
|
28
|
+
* :mod:`lumen.raw` - the thin ``lumen_signal_*`` layer under all of the
|
|
29
|
+
above; reach for it only when you need a raw C call.
|
|
30
|
+
|
|
31
|
+
See ``lumen.errors`` for the exception hierarchy every ``lumen_*`` call
|
|
32
|
+
can raise, and the package README for install/run instructions.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
from . import dom, raw
|
|
36
|
+
from ._version import __version__
|
|
37
|
+
from .api import App, get_library
|
|
38
|
+
from .dom import Event, Listener, Node
|
|
39
|
+
from .model import Field, Model
|
|
40
|
+
from .signals import Color, Signal, computed
|
|
41
|
+
from .errors import (
|
|
42
|
+
LumenAbiVersionError,
|
|
43
|
+
LumenAssetError,
|
|
44
|
+
LumenBadArgError,
|
|
45
|
+
LumenBadPathError,
|
|
46
|
+
LumenCssError,
|
|
47
|
+
LumenError,
|
|
48
|
+
LumenInternalError,
|
|
49
|
+
LumenInvalidHandleError,
|
|
50
|
+
LumenInvalidValueError,
|
|
51
|
+
LumenIoError,
|
|
52
|
+
LumenLibraryNotFoundError,
|
|
53
|
+
LumenPanicError,
|
|
54
|
+
LumenParseError,
|
|
55
|
+
LumenRuntimeError,
|
|
56
|
+
LumenScriptError,
|
|
57
|
+
LumenWindowError,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
__all__ = [
|
|
61
|
+
"App",
|
|
62
|
+
"Model",
|
|
63
|
+
"Field",
|
|
64
|
+
"Signal",
|
|
65
|
+
"Color",
|
|
66
|
+
"computed",
|
|
67
|
+
"raw",
|
|
68
|
+
"dom",
|
|
69
|
+
"Node",
|
|
70
|
+
"Event",
|
|
71
|
+
"Listener",
|
|
72
|
+
"get_library",
|
|
73
|
+
"LumenError",
|
|
74
|
+
"LumenBadPathError",
|
|
75
|
+
"LumenBadArgError",
|
|
76
|
+
"LumenRuntimeError",
|
|
77
|
+
"LumenInternalError",
|
|
78
|
+
"LumenParseError",
|
|
79
|
+
"LumenCssError",
|
|
80
|
+
"LumenAssetError",
|
|
81
|
+
"LumenWindowError",
|
|
82
|
+
"LumenScriptError",
|
|
83
|
+
"LumenIoError",
|
|
84
|
+
"LumenInvalidHandleError",
|
|
85
|
+
"LumenInvalidValueError",
|
|
86
|
+
"LumenPanicError",
|
|
87
|
+
"LumenLibraryNotFoundError",
|
|
88
|
+
"LumenAbiVersionError",
|
|
89
|
+
"__version__",
|
|
90
|
+
]
|