aioxlib 0.1.0__tar.gz → 0.2.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.
- aioxlib-0.2.0/PKG-INFO +196 -0
- aioxlib-0.2.0/README.md +172 -0
- {aioxlib-0.1.0 → aioxlib-0.2.0}/aioxlib/__init__.py +608 -31
- aioxlib-0.2.0/aioxlib.egg-info/PKG-INFO +196 -0
- {aioxlib-0.1.0 → aioxlib-0.2.0}/pyproject.toml +6 -4
- {aioxlib-0.1.0 → aioxlib-0.2.0}/tests/test_aioxlib.py +851 -19
- aioxlib-0.1.0/PKG-INFO +0 -149
- aioxlib-0.1.0/README.md +0 -125
- aioxlib-0.1.0/aioxlib.egg-info/PKG-INFO +0 -149
- {aioxlib-0.1.0 → aioxlib-0.2.0}/aioxlib.egg-info/SOURCES.txt +0 -0
- {aioxlib-0.1.0 → aioxlib-0.2.0}/aioxlib.egg-info/dependency_links.txt +0 -0
- {aioxlib-0.1.0 → aioxlib-0.2.0}/aioxlib.egg-info/top_level.txt +0 -0
- {aioxlib-0.1.0 → aioxlib-0.2.0}/setup.cfg +0 -0
aioxlib-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aioxlib
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Human friendly interface to XLib subsystems using asyncio python
|
|
5
|
+
Author-email: Jose Tiago Macara Coutinho <coutinhotiago@gmail.com>
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Documentation, https://codeberg.org/tiagocoutinho/aioxlib/
|
|
8
|
+
Project-URL: Homepage, https://codeberg.org/tiagocoutinho/aioxlib/
|
|
9
|
+
Project-URL: Repository, https://codeberg.org/tiagocoutinho/aioxlib/
|
|
10
|
+
Keywords: x11,asyncio
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: Operating System :: POSIX
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Multimedia :: Video
|
|
21
|
+
Classifier: Topic :: Multimedia :: Video :: Capture
|
|
22
|
+
Requires-Python: >=3.12
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# aioxlib
|
|
26
|
+
|
|
27
|
+
**Human-friendly asyncio interface to the X11 protocol**
|
|
28
|
+
|
|
29
|
+
[](https://pypi.org/project/aioxlib/)
|
|
30
|
+
[](https://pypi.org/project/aioxlib/)
|
|
31
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
32
|
+
|
|
33
|
+
`aioxlib` is a pure-Python library that speaks the X11 wire protocol over
|
|
34
|
+
asyncio. It aims to make displays, windows, drawing, events, and extensions
|
|
35
|
+
feel natural in async Python—without blocking the event loop and without
|
|
36
|
+
linking to libX11.
|
|
37
|
+
|
|
38
|
+
Inspired by [linuxpy](https://github.com/tiagocoutinho/linuxpy) (same author):
|
|
39
|
+
a clean high-level API with protocol details still available when you need
|
|
40
|
+
them.
|
|
41
|
+
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
- Fully asynchronous connection to the X server (Unix socket or TCP)
|
|
45
|
+
- High-level objects: `Display`, `Screen`, `Window`, `GC`, resources
|
|
46
|
+
- Event stream via `async for event in display.events()`
|
|
47
|
+
- Windows: create/map/configure/reparent, WM name & delete handling
|
|
48
|
+
- Core drawing: rectangles, arcs, segments, points, text, images
|
|
49
|
+
- **RENDER**: pictures, solid fills, gradients, triangles/trapezoids/strips, glyphs
|
|
50
|
+
- **MIT-SHM** for high-throughput image transfer
|
|
51
|
+
- **DOUBLE-BUFFER**, **BIG-REQUESTS**, plus GLX / DRI3 / Present helpers
|
|
52
|
+
- Atoms, properties (with type encode/decode), fonts, colormaps
|
|
53
|
+
- Python ≥ 3.12, GPLv3, **no third-party runtime dependencies**
|
|
54
|
+
- Implementation in a single module
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install aioxlib
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
From source:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://codeberg.org/tiagocoutinho/aioxlib.git
|
|
66
|
+
cd aioxlib
|
|
67
|
+
pip install -e .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Quick start
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import asyncio
|
|
74
|
+
import aioxlib
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
async def main():
|
|
78
|
+
wnd = await aioxlib.create_window(
|
|
79
|
+
width=640,
|
|
80
|
+
height=480,
|
|
81
|
+
title="Hello from aioxlib",
|
|
82
|
+
)
|
|
83
|
+
await wnd.show()
|
|
84
|
+
|
|
85
|
+
async for event in aioxlib.events():
|
|
86
|
+
if wnd.is_delete_window(event):
|
|
87
|
+
break
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
asyncio.run(main())
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`create_window(..., delete_on_close=True)` (the default) registers
|
|
94
|
+
`WM_DELETE_WINDOW`. Use `Window.is_delete_window(event)` in the event loop.
|
|
95
|
+
|
|
96
|
+
## Documentation
|
|
97
|
+
|
|
98
|
+
User guide and full API reference (Material for MkDocs + mkdocstrings):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pip install mkdocs mkdocs-material 'mkdocstrings[python]'
|
|
102
|
+
mkdocs serve
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Then open <http://127.0.0.1:8000/>.
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
| File | Description |
|
|
110
|
+
|------|-------------|
|
|
111
|
+
| `basic.py` | Minimal window + close handling |
|
|
112
|
+
| `text.py` | Text on Expose |
|
|
113
|
+
| `grid.py` | Grid of filled rectangles |
|
|
114
|
+
| `points.py` / `segments.py` | Points and line segments |
|
|
115
|
+
| `3d.py` | Rotating mesh (Penger) |
|
|
116
|
+
| `cube_render_triangles.py` | Cube with RENDER gradients |
|
|
117
|
+
| `tristrip.py` | RENDER triangle strip |
|
|
118
|
+
| `render.py` | RENDER basics |
|
|
119
|
+
| `dbe.py` / `cube_dbe.py` | Double buffering |
|
|
120
|
+
| `shm.py` | MIT-SHM image path |
|
|
121
|
+
| `video.py` / `video_shm.py` | V4L2 video (optional) |
|
|
122
|
+
| `configure.py` | ConfigureWindow |
|
|
123
|
+
| `game_of_life.py` | Small interactive demo |
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
python examples/basic.py
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## API overview
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
display = await aioxlib.get_display() # or get_display(":0")
|
|
133
|
+
async with display:
|
|
134
|
+
screen = display.default_screen()
|
|
135
|
+
|
|
136
|
+
wnd = await screen.create_window(
|
|
137
|
+
width=800,
|
|
138
|
+
height=600,
|
|
139
|
+
title="Demo",
|
|
140
|
+
event_mask=aioxlib.EventMask.Exposure,
|
|
141
|
+
)
|
|
142
|
+
await wnd.show()
|
|
143
|
+
|
|
144
|
+
gc = await wnd.create_gc(foreground=0x00FFFF, background=0)
|
|
145
|
+
await wnd.poly_fill_rectangles(gc, [(10, 10, 100, 50)])
|
|
146
|
+
await wnd.poly_fill_arcs(gc, [(50, 50, 80, 80, 0, 360 * 64)])
|
|
147
|
+
|
|
148
|
+
# Optional: RENDER
|
|
149
|
+
render = await display.query_extension("RENDER")
|
|
150
|
+
if render:
|
|
151
|
+
formats = await render.query_picture_formats()
|
|
152
|
+
...
|
|
153
|
+
|
|
154
|
+
async for event in display.events():
|
|
155
|
+
if wnd.is_delete_window(event):
|
|
156
|
+
break
|
|
157
|
+
if event["code"] == aioxlib.EventType.Expose:
|
|
158
|
+
...
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Events are dicts; core codes are in `aioxlib.EventType`.
|
|
162
|
+
|
|
163
|
+
### Properties
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
await wnd.change_property(aioxlib.Atom.WM_NAME, aioxlib.Atom.STRING, data="Title")
|
|
167
|
+
reply = await wnd.get_property(aioxlib.Atom.WM_NAME)
|
|
168
|
+
print(reply["value"]) # decoded str / list[int] / …
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Requirements
|
|
172
|
+
|
|
173
|
+
- Python ≥ 3.12
|
|
174
|
+
- An X11 server (Xorg, Xwayland, Xephyr, …)
|
|
175
|
+
- `$DISPLAY` set, or pass the display URI explicitly
|
|
176
|
+
|
|
177
|
+
## Development
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
pip install -e .
|
|
181
|
+
pip install pytest pytest-asyncio pytest-cov
|
|
182
|
+
pytest
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
GPLv3 or later — see [LICENSE](LICENSE).
|
|
188
|
+
|
|
189
|
+
## Author
|
|
190
|
+
|
|
191
|
+
José Tiago Macara Coutinho
|
|
192
|
+
<https://codeberg.org/tiagocoutinho>
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
*aioxlib 0.1.0 — feedback and contributions welcome.*
|
aioxlib-0.2.0/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# aioxlib
|
|
2
|
+
|
|
3
|
+
**Human-friendly asyncio interface to the X11 protocol**
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/aioxlib/)
|
|
6
|
+
[](https://pypi.org/project/aioxlib/)
|
|
7
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
8
|
+
|
|
9
|
+
`aioxlib` is a pure-Python library that speaks the X11 wire protocol over
|
|
10
|
+
asyncio. It aims to make displays, windows, drawing, events, and extensions
|
|
11
|
+
feel natural in async Python—without blocking the event loop and without
|
|
12
|
+
linking to libX11.
|
|
13
|
+
|
|
14
|
+
Inspired by [linuxpy](https://github.com/tiagocoutinho/linuxpy) (same author):
|
|
15
|
+
a clean high-level API with protocol details still available when you need
|
|
16
|
+
them.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Fully asynchronous connection to the X server (Unix socket or TCP)
|
|
21
|
+
- High-level objects: `Display`, `Screen`, `Window`, `GC`, resources
|
|
22
|
+
- Event stream via `async for event in display.events()`
|
|
23
|
+
- Windows: create/map/configure/reparent, WM name & delete handling
|
|
24
|
+
- Core drawing: rectangles, arcs, segments, points, text, images
|
|
25
|
+
- **RENDER**: pictures, solid fills, gradients, triangles/trapezoids/strips, glyphs
|
|
26
|
+
- **MIT-SHM** for high-throughput image transfer
|
|
27
|
+
- **DOUBLE-BUFFER**, **BIG-REQUESTS**, plus GLX / DRI3 / Present helpers
|
|
28
|
+
- Atoms, properties (with type encode/decode), fonts, colormaps
|
|
29
|
+
- Python ≥ 3.12, GPLv3, **no third-party runtime dependencies**
|
|
30
|
+
- Implementation in a single module
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install aioxlib
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
From source:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://codeberg.org/tiagocoutinho/aioxlib.git
|
|
42
|
+
cd aioxlib
|
|
43
|
+
pip install -e .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Quick start
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
import asyncio
|
|
50
|
+
import aioxlib
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
async def main():
|
|
54
|
+
wnd = await aioxlib.create_window(
|
|
55
|
+
width=640,
|
|
56
|
+
height=480,
|
|
57
|
+
title="Hello from aioxlib",
|
|
58
|
+
)
|
|
59
|
+
await wnd.show()
|
|
60
|
+
|
|
61
|
+
async for event in aioxlib.events():
|
|
62
|
+
if wnd.is_delete_window(event):
|
|
63
|
+
break
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
asyncio.run(main())
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`create_window(..., delete_on_close=True)` (the default) registers
|
|
70
|
+
`WM_DELETE_WINDOW`. Use `Window.is_delete_window(event)` in the event loop.
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
User guide and full API reference (Material for MkDocs + mkdocstrings):
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install mkdocs mkdocs-material 'mkdocstrings[python]'
|
|
78
|
+
mkdocs serve
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Then open <http://127.0.0.1:8000/>.
|
|
82
|
+
|
|
83
|
+
## Examples
|
|
84
|
+
|
|
85
|
+
| File | Description |
|
|
86
|
+
|------|-------------|
|
|
87
|
+
| `basic.py` | Minimal window + close handling |
|
|
88
|
+
| `text.py` | Text on Expose |
|
|
89
|
+
| `grid.py` | Grid of filled rectangles |
|
|
90
|
+
| `points.py` / `segments.py` | Points and line segments |
|
|
91
|
+
| `3d.py` | Rotating mesh (Penger) |
|
|
92
|
+
| `cube_render_triangles.py` | Cube with RENDER gradients |
|
|
93
|
+
| `tristrip.py` | RENDER triangle strip |
|
|
94
|
+
| `render.py` | RENDER basics |
|
|
95
|
+
| `dbe.py` / `cube_dbe.py` | Double buffering |
|
|
96
|
+
| `shm.py` | MIT-SHM image path |
|
|
97
|
+
| `video.py` / `video_shm.py` | V4L2 video (optional) |
|
|
98
|
+
| `configure.py` | ConfigureWindow |
|
|
99
|
+
| `game_of_life.py` | Small interactive demo |
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
python examples/basic.py
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## API overview
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
display = await aioxlib.get_display() # or get_display(":0")
|
|
109
|
+
async with display:
|
|
110
|
+
screen = display.default_screen()
|
|
111
|
+
|
|
112
|
+
wnd = await screen.create_window(
|
|
113
|
+
width=800,
|
|
114
|
+
height=600,
|
|
115
|
+
title="Demo",
|
|
116
|
+
event_mask=aioxlib.EventMask.Exposure,
|
|
117
|
+
)
|
|
118
|
+
await wnd.show()
|
|
119
|
+
|
|
120
|
+
gc = await wnd.create_gc(foreground=0x00FFFF, background=0)
|
|
121
|
+
await wnd.poly_fill_rectangles(gc, [(10, 10, 100, 50)])
|
|
122
|
+
await wnd.poly_fill_arcs(gc, [(50, 50, 80, 80, 0, 360 * 64)])
|
|
123
|
+
|
|
124
|
+
# Optional: RENDER
|
|
125
|
+
render = await display.query_extension("RENDER")
|
|
126
|
+
if render:
|
|
127
|
+
formats = await render.query_picture_formats()
|
|
128
|
+
...
|
|
129
|
+
|
|
130
|
+
async for event in display.events():
|
|
131
|
+
if wnd.is_delete_window(event):
|
|
132
|
+
break
|
|
133
|
+
if event["code"] == aioxlib.EventType.Expose:
|
|
134
|
+
...
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Events are dicts; core codes are in `aioxlib.EventType`.
|
|
138
|
+
|
|
139
|
+
### Properties
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
await wnd.change_property(aioxlib.Atom.WM_NAME, aioxlib.Atom.STRING, data="Title")
|
|
143
|
+
reply = await wnd.get_property(aioxlib.Atom.WM_NAME)
|
|
144
|
+
print(reply["value"]) # decoded str / list[int] / …
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Requirements
|
|
148
|
+
|
|
149
|
+
- Python ≥ 3.12
|
|
150
|
+
- An X11 server (Xorg, Xwayland, Xephyr, …)
|
|
151
|
+
- `$DISPLAY` set, or pass the display URI explicitly
|
|
152
|
+
|
|
153
|
+
## Development
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
pip install -e .
|
|
157
|
+
pip install pytest pytest-asyncio pytest-cov
|
|
158
|
+
pytest
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
GPLv3 or later — see [LICENSE](LICENSE).
|
|
164
|
+
|
|
165
|
+
## Author
|
|
166
|
+
|
|
167
|
+
José Tiago Macara Coutinho
|
|
168
|
+
<https://codeberg.org/tiagocoutinho>
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
*aioxlib 0.1.0 — feedback and contributions welcome.*
|