aioxlib 0.7.0__tar.gz → 0.7.2__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.7.0 → aioxlib-0.7.2}/PKG-INFO +72 -30
- aioxlib-0.7.2/README.md +162 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/__init__.py +1 -1
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/display.py +3 -12
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib.egg-info/PKG-INFO +72 -30
- aioxlib-0.7.0/README.md +0 -120
- {aioxlib-0.7.0 → aioxlib-0.7.2}/LICENSE +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/_extensions.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/api.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/authority.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/bigreq.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/connection.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/constants.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/dbe.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/dri3.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/glx.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/present.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/protocol.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/randr.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/render.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/shm.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib/widgets.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib.egg-info/SOURCES.txt +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib.egg-info/dependency_links.txt +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/aioxlib.egg-info/top_level.txt +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/pyproject.toml +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/setup.cfg +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_api.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_authority.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_bigreq.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_connection.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_constants.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_dbe.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_display.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_dri3.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_examples.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_extensions.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_glx.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_present.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_protocol.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_randr.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_render.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_shm.py +0 -0
- {aioxlib-0.7.0 → aioxlib-0.7.2}/tests/test_widgets.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aioxlib
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Human friendly interface to XLib subsystems using asyncio python
|
|
5
5
|
Author-email: Jose Tiago Macara Coutinho <coutinhotiago@gmail.com>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -31,18 +31,42 @@ Dynamic: license-file
|
|
|
31
31
|
[](https://pypi.org/project/aioxlib/)
|
|
32
32
|
[](https://pypi.org/project/aioxlib/)
|
|
33
33
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
34
|
+
[](https://aioxlib.readthedocs.io)
|
|
34
35
|
|
|
35
|
-
`aioxlib` is a pure-Python
|
|
36
|
-
|
|
36
|
+
`aioxlib` is a **pure-Python**, **asyncio-native** client for the X11 wire protocol.
|
|
37
|
+
Open displays, create windows, draw with GCs and the RENDER extension, and stream
|
|
38
|
+
events — without blocking the event loop and without linking to libX11 or xcb.
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
<p align="center">
|
|
41
|
+
<img src="docs/images/game_of_life.gif" style="height: 300px;" alt="Conway's Game of Life on X11 via aioxlib"/>
|
|
42
|
+
|
|
43
|
+
<img src="docs/images/3d_cube.gif" style="height: 300px;" alt="Rotating 3D wireframe via aioxlib"/>
|
|
44
|
+
</p>
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
- Local: `pip install --group docs && mkdocs serve`
|
|
46
|
+
<p align="center"><em>Examples shipped with the library: Game of Life · 3D wireframe</em></p>
|
|
42
47
|
|
|
43
|
-
##
|
|
48
|
+
## Why aioxlib?
|
|
49
|
+
|
|
50
|
+
| | **aioxlib** | python-xlib | xcffib / xpyb |
|
|
51
|
+
|---|---|---|---|
|
|
52
|
+
| Language | Pure Python | Pure Python | C (libxcb) + Python |
|
|
53
|
+
| Async | **asyncio first** | Blocking / threads | Blocking |
|
|
54
|
+
| Dependencies | None at runtime | None | libxcb |
|
|
55
|
+
| Protocol access | Pack/unpack helpers exposed | High-level only | Low-level |
|
|
56
|
+
| Extensions | RENDER, MIT-SHM, DBE, GLX, … | Many | Many |
|
|
57
|
+
|
|
58
|
+
Inspired by [linuxpy](https://github.com/tiagocoutinho/linuxpy) (same author):
|
|
59
|
+
a clean high-level API when you want it, full protocol detail when you need it.
|
|
60
|
+
|
|
61
|
+
## Requirements
|
|
62
|
+
|
|
63
|
+
- **Python ≥ 3.12**
|
|
64
|
+
- An X server (local or remote) and network/socket access to it
|
|
65
|
+
(`$DISPLAY` or an explicit URI)
|
|
44
66
|
|
|
45
|
-
|
|
67
|
+
No third-party Python packages are required at runtime.
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
46
70
|
|
|
47
71
|
```bash
|
|
48
72
|
pip install aioxlib
|
|
@@ -50,7 +74,7 @@ pip install aioxlib
|
|
|
50
74
|
|
|
51
75
|
## Quick start
|
|
52
76
|
|
|
53
|
-
|
|
77
|
+
### Functional API (simplest)
|
|
54
78
|
|
|
55
79
|
```python
|
|
56
80
|
import asyncio
|
|
@@ -91,19 +115,49 @@ async def main():
|
|
|
91
115
|
asyncio.run(main())
|
|
92
116
|
```
|
|
93
117
|
|
|
118
|
+
## Features
|
|
119
|
+
|
|
120
|
+
- **Windows & drawing** — create/map/configure windows, GCs, polylines, rectangles, arcs, text, images
|
|
121
|
+
- **Events** — non-blocking `async for event in display.events()` stream
|
|
122
|
+
- **Properties & atoms** — `WM_NAME`, protocols, custom properties
|
|
123
|
+
- **Extensions** — BIG-REQUESTS, RENDER, MIT-SHM, DBE, GLX, RANDR, DRI3, Present
|
|
124
|
+
- **Pipeline** — batch requests with `async with display.pipeline(): …`
|
|
125
|
+
- **Protocol transparent** — opcodes, pack/unpack helpers stay accessible
|
|
126
|
+
|
|
127
|
+
## Examples
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# clone the repo, then:
|
|
131
|
+
python examples/basic.py
|
|
132
|
+
python examples/game_of_life.py # Conway's Life (numpy)
|
|
133
|
+
python examples/3d.py # rotating 3D mesh
|
|
134
|
+
python examples/video_shm_dbe.py # shared memory + double buffering
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
| Example | What it shows |
|
|
138
|
+
|---------|----------------|
|
|
139
|
+
| `basic.py` | Window + delete protocol |
|
|
140
|
+
| `game_of_life.py` | Animated cellular automaton |
|
|
141
|
+
| `3d.py` | Perspective projection & wireframe |
|
|
142
|
+
| `render.py` / `tristrip.py` | RENDER extension |
|
|
143
|
+
| `shm.py` / `video_shm*.py` | MIT-SHM image transfer |
|
|
144
|
+
| `cube_dbe.py` | Double buffering (DBE) |
|
|
145
|
+
| `keyboard.py` | Key events |
|
|
146
|
+
|
|
94
147
|
## Package layout
|
|
95
148
|
|
|
96
149
|
| Module | Contents |
|
|
97
150
|
|--------|----------|
|
|
98
|
-
| **`aioxlib`** (root) |
|
|
151
|
+
| **`aioxlib`** (root) | Functional API + `get_display` + common constants |
|
|
99
152
|
| `aioxlib.constants` | X11 constants and enumerations |
|
|
100
|
-
| `aioxlib.protocol` |
|
|
153
|
+
| `aioxlib.protocol` | Pack/unpack helpers |
|
|
101
154
|
| `aioxlib.connection` | Socket connection, Xauthority |
|
|
102
|
-
| `aioxlib.
|
|
103
|
-
| `aioxlib.display` (Window, Screen, GC, …) | Window, Screen, GC |
|
|
104
|
-
| `aioxlib.display` | Display, Pipeline |
|
|
155
|
+
| `aioxlib.display` | `Display`, `Screen`, `Window`, `GC`, `Pipeline` |
|
|
105
156
|
| `aioxlib.render` / `shm` / `dbe` / … | Extensions |
|
|
106
157
|
|
|
158
|
+
Classes such as `Display`, `Window`, and `EventType` are imported from their
|
|
159
|
+
modules (or from the root where re-exported).
|
|
160
|
+
|
|
107
161
|
### Root functional API (selection)
|
|
108
162
|
|
|
109
163
|
| Function | Role |
|
|
@@ -114,28 +168,16 @@ asyncio.run(main())
|
|
|
114
168
|
| `flush`, `query_extension`, `get_atom`, … | Display operations |
|
|
115
169
|
| `close_default_display` | Tear down default connection |
|
|
116
170
|
|
|
117
|
-
Classes such as `Display`, `Window`, and `EventType` are **not** re-exported
|
|
118
|
-
from the root; import them from their modules.
|
|
119
|
-
|
|
120
171
|
## Documentation
|
|
121
172
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
mkdocs serve
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Examples
|
|
173
|
+
- Online: [aioxlib.readthedocs.io](https://aioxlib.readthedocs.io)
|
|
174
|
+
- Local:
|
|
128
175
|
|
|
129
176
|
```bash
|
|
130
|
-
python
|
|
131
|
-
|
|
177
|
+
pip install --group docs # or: pip install mkdocs mkdocs-material 'mkdocstrings[python]'
|
|
178
|
+
mkdocs serve
|
|
132
179
|
```
|
|
133
180
|
|
|
134
|
-
## Requirements
|
|
135
|
-
|
|
136
|
-
- Python ≥ 3.12
|
|
137
|
-
- An X11 server and `$DISPLAY` (or an explicit URI)
|
|
138
|
-
|
|
139
181
|
## License
|
|
140
182
|
|
|
141
183
|
GPLv3 or later — see [LICENSE](LICENSE).
|
aioxlib-0.7.2/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
[](https://aioxlib.readthedocs.io)
|
|
9
|
+
|
|
10
|
+
`aioxlib` is a **pure-Python**, **asyncio-native** client for the X11 wire protocol.
|
|
11
|
+
Open displays, create windows, draw with GCs and the RENDER extension, and stream
|
|
12
|
+
events — without blocking the event loop and without linking to libX11 or xcb.
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<img src="docs/images/game_of_life.gif" style="height: 300px;" alt="Conway's Game of Life on X11 via aioxlib"/>
|
|
16
|
+
|
|
17
|
+
<img src="docs/images/3d_cube.gif" style="height: 300px;" alt="Rotating 3D wireframe via aioxlib"/>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<p align="center"><em>Examples shipped with the library: Game of Life · 3D wireframe</em></p>
|
|
21
|
+
|
|
22
|
+
## Why aioxlib?
|
|
23
|
+
|
|
24
|
+
| | **aioxlib** | python-xlib | xcffib / xpyb |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| Language | Pure Python | Pure Python | C (libxcb) + Python |
|
|
27
|
+
| Async | **asyncio first** | Blocking / threads | Blocking |
|
|
28
|
+
| Dependencies | None at runtime | None | libxcb |
|
|
29
|
+
| Protocol access | Pack/unpack helpers exposed | High-level only | Low-level |
|
|
30
|
+
| Extensions | RENDER, MIT-SHM, DBE, GLX, … | Many | Many |
|
|
31
|
+
|
|
32
|
+
Inspired by [linuxpy](https://github.com/tiagocoutinho/linuxpy) (same author):
|
|
33
|
+
a clean high-level API when you want it, full protocol detail when you need it.
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- **Python ≥ 3.12**
|
|
38
|
+
- An X server (local or remote) and network/socket access to it
|
|
39
|
+
(`$DISPLAY` or an explicit URI)
|
|
40
|
+
|
|
41
|
+
No third-party Python packages are required at runtime.
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install aioxlib
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick start
|
|
50
|
+
|
|
51
|
+
### Functional API (simplest)
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import asyncio
|
|
55
|
+
import aioxlib
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
async def main():
|
|
59
|
+
wnd = await aioxlib.create_window(640, 480, title="Hello from aioxlib")
|
|
60
|
+
await wnd.show()
|
|
61
|
+
|
|
62
|
+
async for event in aioxlib.events():
|
|
63
|
+
if wnd.is_delete_window(event):
|
|
64
|
+
break
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
asyncio.run(main())
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Explicit display (object API)
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import asyncio
|
|
74
|
+
import aioxlib
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
async def main():
|
|
78
|
+
display = await aioxlib.get_display()
|
|
79
|
+
async with display:
|
|
80
|
+
screen = display.default_screen()
|
|
81
|
+
wnd = await screen.create_window(640, 480, title="Hello from aioxlib")
|
|
82
|
+
await wnd.show()
|
|
83
|
+
|
|
84
|
+
async for event in display.events():
|
|
85
|
+
if wnd.is_delete_window(event):
|
|
86
|
+
break
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
asyncio.run(main())
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Features
|
|
93
|
+
|
|
94
|
+
- **Windows & drawing** — create/map/configure windows, GCs, polylines, rectangles, arcs, text, images
|
|
95
|
+
- **Events** — non-blocking `async for event in display.events()` stream
|
|
96
|
+
- **Properties & atoms** — `WM_NAME`, protocols, custom properties
|
|
97
|
+
- **Extensions** — BIG-REQUESTS, RENDER, MIT-SHM, DBE, GLX, RANDR, DRI3, Present
|
|
98
|
+
- **Pipeline** — batch requests with `async with display.pipeline(): …`
|
|
99
|
+
- **Protocol transparent** — opcodes, pack/unpack helpers stay accessible
|
|
100
|
+
|
|
101
|
+
## Examples
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# clone the repo, then:
|
|
105
|
+
python examples/basic.py
|
|
106
|
+
python examples/game_of_life.py # Conway's Life (numpy)
|
|
107
|
+
python examples/3d.py # rotating 3D mesh
|
|
108
|
+
python examples/video_shm_dbe.py # shared memory + double buffering
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
| Example | What it shows |
|
|
112
|
+
|---------|----------------|
|
|
113
|
+
| `basic.py` | Window + delete protocol |
|
|
114
|
+
| `game_of_life.py` | Animated cellular automaton |
|
|
115
|
+
| `3d.py` | Perspective projection & wireframe |
|
|
116
|
+
| `render.py` / `tristrip.py` | RENDER extension |
|
|
117
|
+
| `shm.py` / `video_shm*.py` | MIT-SHM image transfer |
|
|
118
|
+
| `cube_dbe.py` | Double buffering (DBE) |
|
|
119
|
+
| `keyboard.py` | Key events |
|
|
120
|
+
|
|
121
|
+
## Package layout
|
|
122
|
+
|
|
123
|
+
| Module | Contents |
|
|
124
|
+
|--------|----------|
|
|
125
|
+
| **`aioxlib`** (root) | Functional API + `get_display` + common constants |
|
|
126
|
+
| `aioxlib.constants` | X11 constants and enumerations |
|
|
127
|
+
| `aioxlib.protocol` | Pack/unpack helpers |
|
|
128
|
+
| `aioxlib.connection` | Socket connection, Xauthority |
|
|
129
|
+
| `aioxlib.display` | `Display`, `Screen`, `Window`, `GC`, `Pipeline` |
|
|
130
|
+
| `aioxlib.render` / `shm` / `dbe` / … | Extensions |
|
|
131
|
+
|
|
132
|
+
Classes such as `Display`, `Window`, and `EventType` are imported from their
|
|
133
|
+
modules (or from the root where re-exported).
|
|
134
|
+
|
|
135
|
+
### Root functional API (selection)
|
|
136
|
+
|
|
137
|
+
| Function | Role |
|
|
138
|
+
|----------|------|
|
|
139
|
+
| `get_display` / `get_default_display` | Open connection |
|
|
140
|
+
| `create_window`, `map_window`, … | Windows |
|
|
141
|
+
| `events()`, `pipeline()` | Event stream / batched writes |
|
|
142
|
+
| `flush`, `query_extension`, `get_atom`, … | Display operations |
|
|
143
|
+
| `close_default_display` | Tear down default connection |
|
|
144
|
+
|
|
145
|
+
## Documentation
|
|
146
|
+
|
|
147
|
+
- Online: [aioxlib.readthedocs.io](https://aioxlib.readthedocs.io)
|
|
148
|
+
- Local:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
pip install --group docs # or: pip install mkdocs mkdocs-material 'mkdocstrings[python]'
|
|
152
|
+
mkdocs serve
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
GPLv3 or later — see [LICENSE](LICENSE).
|
|
158
|
+
|
|
159
|
+
## Author
|
|
160
|
+
|
|
161
|
+
José Tiago Macara Coutinho
|
|
162
|
+
<https://codeberg.org/tiagocoutinho>
|
|
@@ -317,20 +317,11 @@ class Window(Drawable):
|
|
|
317
317
|
display = self.display
|
|
318
318
|
protocols = []
|
|
319
319
|
if delete_on_close or take_focus:
|
|
320
|
-
# Atoms are normally cached in Display.__aenter__; fall back to
|
|
321
|
-
# get_atom so create_window still works before the context is entered.
|
|
322
|
-
async def _atom(attr, name):
|
|
323
|
-
value = getattr(display, attr, None)
|
|
324
|
-
if value is None:
|
|
325
|
-
value = await display.get_atom(name)
|
|
326
|
-
setattr(display, attr, value)
|
|
327
|
-
return value
|
|
328
|
-
|
|
329
320
|
if delete_on_close:
|
|
330
|
-
protocols.append(
|
|
321
|
+
protocols.append(display.WM_DELETE_WINDOW)
|
|
331
322
|
if take_focus:
|
|
332
|
-
protocols.append(
|
|
333
|
-
wm_protocols =
|
|
323
|
+
protocols.append(display.WM_TAKE_FOCUS)
|
|
324
|
+
wm_protocols = display.WM_PROTOCOLS
|
|
334
325
|
payload += pack_change_property(wid, wm_protocols, Atom.ATOM, 32, protocols, PropMode.Replace)
|
|
335
326
|
self.display.connection.write(payload)
|
|
336
327
|
return Window(self.display, wid)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aioxlib
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Human friendly interface to XLib subsystems using asyncio python
|
|
5
5
|
Author-email: Jose Tiago Macara Coutinho <coutinhotiago@gmail.com>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -31,18 +31,42 @@ Dynamic: license-file
|
|
|
31
31
|
[](https://pypi.org/project/aioxlib/)
|
|
32
32
|
[](https://pypi.org/project/aioxlib/)
|
|
33
33
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
34
|
+
[](https://aioxlib.readthedocs.io)
|
|
34
35
|
|
|
35
|
-
`aioxlib` is a pure-Python
|
|
36
|
-
|
|
36
|
+
`aioxlib` is a **pure-Python**, **asyncio-native** client for the X11 wire protocol.
|
|
37
|
+
Open displays, create windows, draw with GCs and the RENDER extension, and stream
|
|
38
|
+
events — without blocking the event loop and without linking to libX11 or xcb.
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
<p align="center">
|
|
41
|
+
<img src="docs/images/game_of_life.gif" style="height: 300px;" alt="Conway's Game of Life on X11 via aioxlib"/>
|
|
42
|
+
|
|
43
|
+
<img src="docs/images/3d_cube.gif" style="height: 300px;" alt="Rotating 3D wireframe via aioxlib"/>
|
|
44
|
+
</p>
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
- Local: `pip install --group docs && mkdocs serve`
|
|
46
|
+
<p align="center"><em>Examples shipped with the library: Game of Life · 3D wireframe</em></p>
|
|
42
47
|
|
|
43
|
-
##
|
|
48
|
+
## Why aioxlib?
|
|
49
|
+
|
|
50
|
+
| | **aioxlib** | python-xlib | xcffib / xpyb |
|
|
51
|
+
|---|---|---|---|
|
|
52
|
+
| Language | Pure Python | Pure Python | C (libxcb) + Python |
|
|
53
|
+
| Async | **asyncio first** | Blocking / threads | Blocking |
|
|
54
|
+
| Dependencies | None at runtime | None | libxcb |
|
|
55
|
+
| Protocol access | Pack/unpack helpers exposed | High-level only | Low-level |
|
|
56
|
+
| Extensions | RENDER, MIT-SHM, DBE, GLX, … | Many | Many |
|
|
57
|
+
|
|
58
|
+
Inspired by [linuxpy](https://github.com/tiagocoutinho/linuxpy) (same author):
|
|
59
|
+
a clean high-level API when you want it, full protocol detail when you need it.
|
|
60
|
+
|
|
61
|
+
## Requirements
|
|
62
|
+
|
|
63
|
+
- **Python ≥ 3.12**
|
|
64
|
+
- An X server (local or remote) and network/socket access to it
|
|
65
|
+
(`$DISPLAY` or an explicit URI)
|
|
44
66
|
|
|
45
|
-
|
|
67
|
+
No third-party Python packages are required at runtime.
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
46
70
|
|
|
47
71
|
```bash
|
|
48
72
|
pip install aioxlib
|
|
@@ -50,7 +74,7 @@ pip install aioxlib
|
|
|
50
74
|
|
|
51
75
|
## Quick start
|
|
52
76
|
|
|
53
|
-
|
|
77
|
+
### Functional API (simplest)
|
|
54
78
|
|
|
55
79
|
```python
|
|
56
80
|
import asyncio
|
|
@@ -91,19 +115,49 @@ async def main():
|
|
|
91
115
|
asyncio.run(main())
|
|
92
116
|
```
|
|
93
117
|
|
|
118
|
+
## Features
|
|
119
|
+
|
|
120
|
+
- **Windows & drawing** — create/map/configure windows, GCs, polylines, rectangles, arcs, text, images
|
|
121
|
+
- **Events** — non-blocking `async for event in display.events()` stream
|
|
122
|
+
- **Properties & atoms** — `WM_NAME`, protocols, custom properties
|
|
123
|
+
- **Extensions** — BIG-REQUESTS, RENDER, MIT-SHM, DBE, GLX, RANDR, DRI3, Present
|
|
124
|
+
- **Pipeline** — batch requests with `async with display.pipeline(): …`
|
|
125
|
+
- **Protocol transparent** — opcodes, pack/unpack helpers stay accessible
|
|
126
|
+
|
|
127
|
+
## Examples
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# clone the repo, then:
|
|
131
|
+
python examples/basic.py
|
|
132
|
+
python examples/game_of_life.py # Conway's Life (numpy)
|
|
133
|
+
python examples/3d.py # rotating 3D mesh
|
|
134
|
+
python examples/video_shm_dbe.py # shared memory + double buffering
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
| Example | What it shows |
|
|
138
|
+
|---------|----------------|
|
|
139
|
+
| `basic.py` | Window + delete protocol |
|
|
140
|
+
| `game_of_life.py` | Animated cellular automaton |
|
|
141
|
+
| `3d.py` | Perspective projection & wireframe |
|
|
142
|
+
| `render.py` / `tristrip.py` | RENDER extension |
|
|
143
|
+
| `shm.py` / `video_shm*.py` | MIT-SHM image transfer |
|
|
144
|
+
| `cube_dbe.py` | Double buffering (DBE) |
|
|
145
|
+
| `keyboard.py` | Key events |
|
|
146
|
+
|
|
94
147
|
## Package layout
|
|
95
148
|
|
|
96
149
|
| Module | Contents |
|
|
97
150
|
|--------|----------|
|
|
98
|
-
| **`aioxlib`** (root) |
|
|
151
|
+
| **`aioxlib`** (root) | Functional API + `get_display` + common constants |
|
|
99
152
|
| `aioxlib.constants` | X11 constants and enumerations |
|
|
100
|
-
| `aioxlib.protocol` |
|
|
153
|
+
| `aioxlib.protocol` | Pack/unpack helpers |
|
|
101
154
|
| `aioxlib.connection` | Socket connection, Xauthority |
|
|
102
|
-
| `aioxlib.
|
|
103
|
-
| `aioxlib.display` (Window, Screen, GC, …) | Window, Screen, GC |
|
|
104
|
-
| `aioxlib.display` | Display, Pipeline |
|
|
155
|
+
| `aioxlib.display` | `Display`, `Screen`, `Window`, `GC`, `Pipeline` |
|
|
105
156
|
| `aioxlib.render` / `shm` / `dbe` / … | Extensions |
|
|
106
157
|
|
|
158
|
+
Classes such as `Display`, `Window`, and `EventType` are imported from their
|
|
159
|
+
modules (or from the root where re-exported).
|
|
160
|
+
|
|
107
161
|
### Root functional API (selection)
|
|
108
162
|
|
|
109
163
|
| Function | Role |
|
|
@@ -114,28 +168,16 @@ asyncio.run(main())
|
|
|
114
168
|
| `flush`, `query_extension`, `get_atom`, … | Display operations |
|
|
115
169
|
| `close_default_display` | Tear down default connection |
|
|
116
170
|
|
|
117
|
-
Classes such as `Display`, `Window`, and `EventType` are **not** re-exported
|
|
118
|
-
from the root; import them from their modules.
|
|
119
|
-
|
|
120
171
|
## Documentation
|
|
121
172
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
mkdocs serve
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Examples
|
|
173
|
+
- Online: [aioxlib.readthedocs.io](https://aioxlib.readthedocs.io)
|
|
174
|
+
- Local:
|
|
128
175
|
|
|
129
176
|
```bash
|
|
130
|
-
python
|
|
131
|
-
|
|
177
|
+
pip install --group docs # or: pip install mkdocs mkdocs-material 'mkdocstrings[python]'
|
|
178
|
+
mkdocs serve
|
|
132
179
|
```
|
|
133
180
|
|
|
134
|
-
## Requirements
|
|
135
|
-
|
|
136
|
-
- Python ≥ 3.12
|
|
137
|
-
- An X11 server and `$DISPLAY` (or an explicit URI)
|
|
138
|
-
|
|
139
181
|
## License
|
|
140
182
|
|
|
141
183
|
GPLv3 or later — see [LICENSE](LICENSE).
|
aioxlib-0.7.0/README.md
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
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—without blocking the event loop and without linking to libX11.
|
|
11
|
-
|
|
12
|
-
## Documentation
|
|
13
|
-
|
|
14
|
-
- Online: [aioxlib.readthedocs.io](https://aioxlib.readthedocs.io)
|
|
15
|
-
- Local: `pip install --group docs && mkdocs serve`
|
|
16
|
-
|
|
17
|
-
## Installation
|
|
18
|
-
|
|
19
|
-
From within your favorite python environment:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pip install aioxlib
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Quick start
|
|
26
|
-
|
|
27
|
-
The **root package** exposes the functional API and `get_display` only:
|
|
28
|
-
|
|
29
|
-
```python
|
|
30
|
-
import asyncio
|
|
31
|
-
import aioxlib
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
async def main():
|
|
35
|
-
wnd = await aioxlib.create_window(640, 480, title="Hello from aioxlib")
|
|
36
|
-
await wnd.show()
|
|
37
|
-
|
|
38
|
-
async for event in aioxlib.events():
|
|
39
|
-
if wnd.is_delete_window(event):
|
|
40
|
-
break
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
asyncio.run(main())
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Explicit display (object API)
|
|
47
|
-
|
|
48
|
-
```python
|
|
49
|
-
import asyncio
|
|
50
|
-
import aioxlib
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
async def main():
|
|
54
|
-
display = await aioxlib.get_display()
|
|
55
|
-
async with display:
|
|
56
|
-
screen = display.default_screen()
|
|
57
|
-
wnd = await screen.create_window(640, 480, title="Hello from aioxlib")
|
|
58
|
-
await wnd.show()
|
|
59
|
-
|
|
60
|
-
async for event in display.events():
|
|
61
|
-
if wnd.is_delete_window(event):
|
|
62
|
-
break
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
asyncio.run(main())
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Package layout
|
|
69
|
-
|
|
70
|
-
| Module | Contents |
|
|
71
|
-
|--------|----------|
|
|
72
|
-
| **`aioxlib`** (root) | Constants/enums + functional API + `get_display` |
|
|
73
|
-
| `aioxlib.constants` | X11 constants and enumerations |
|
|
74
|
-
| `aioxlib.protocol` | Constants, enums, pack/unpack |
|
|
75
|
-
| `aioxlib.connection` | Socket connection, Xauthority |
|
|
76
|
-
| `aioxlib.resource` | Resource, Drawable, ResourceManager |
|
|
77
|
-
| `aioxlib.display` (Window, Screen, GC, …) | Window, Screen, GC |
|
|
78
|
-
| `aioxlib.display` | Display, Pipeline |
|
|
79
|
-
| `aioxlib.render` / `shm` / `dbe` / … | Extensions |
|
|
80
|
-
|
|
81
|
-
### Root functional API (selection)
|
|
82
|
-
|
|
83
|
-
| Function | Role |
|
|
84
|
-
|----------|------|
|
|
85
|
-
| `get_display` / `get_default_display` | Open connection |
|
|
86
|
-
| `create_window`, `map_window`, … | Windows |
|
|
87
|
-
| `events()`, `pipeline()` | Event stream / batched writes |
|
|
88
|
-
| `flush`, `query_extension`, `get_atom`, … | Display operations |
|
|
89
|
-
| `close_default_display` | Tear down default connection |
|
|
90
|
-
|
|
91
|
-
Classes such as `Display`, `Window`, and `EventType` are **not** re-exported
|
|
92
|
-
from the root; import them from their modules.
|
|
93
|
-
|
|
94
|
-
## Documentation
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
pip install mkdocs mkdocs-material 'mkdocstrings[python]'
|
|
98
|
-
mkdocs serve
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Examples
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
python examples/basic.py
|
|
105
|
-
python examples/functional.py
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Requirements
|
|
109
|
-
|
|
110
|
-
- Python ≥ 3.12
|
|
111
|
-
- An X11 server and `$DISPLAY` (or an explicit URI)
|
|
112
|
-
|
|
113
|
-
## License
|
|
114
|
-
|
|
115
|
-
GPLv3 or later — see [LICENSE](LICENSE).
|
|
116
|
-
|
|
117
|
-
## Author
|
|
118
|
-
|
|
119
|
-
José Tiago Macara Coutinho
|
|
120
|
-
<https://codeberg.org/tiagocoutinho>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|