Skip to content

Commit 596337c

Browse files
committed
Add initial GDTF writer
1 parent 5d59e77 commit 596337c

File tree

12 files changed

+1044
-155
lines changed

12 files changed

+1044
-155
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
### Changelog
22

3+
#### 1.4.0
4+
5+
* Added initial GDTF writer
6+
* Add missing elements/attributes
7+
* Full support for GDTF 1.2
8+
39
#### 1.3.0
410

511
* Adding/improving the implementation for the following:

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,11 @@ This library is used for example by [BlenderDMX](https://blenderdmx.eu)
2525
[![Check links in markdown](https://github.com/open-stage/python-gdtf/actions/workflows/check-links.yaml/badge.svg)](https://github.com/open-stage/python-gdtf/actions/workflows/check-links.yaml)
2626
![GitHub Tag](https://img.shields.io/github/v/tag/open-stage/python-gdtf)
2727

28-
## Important changes when updating from 1.0
29-
30-
⚠️ List of DMX Channels provided by dmx\_mode.dmx\_channels is now a complete
31-
list of all DMX channels calculated by obtaining DMX channels for geometries,
32-
Geometry References and so on, no need to use the .utils methods anymore.
33-
34-
⚠️ The list of channels as dictionaries can be obtained by
35-
dmx\_mode.dmx\_channels.as\_dicts(), the "id" has been renamed to "attribute".
36-
DMX Channel now contains Logical Channels and then Channel Functions. The
37-
as\_dict() is now also in dmx\_modes, dmx\_mode, dmx\_channels and so on.
38-
39-
⚠️ Many of the .utils package methods have been moved directly to the main part
40-
of pygdtf. External usage of methods from .utils should not be needed anymore.
41-
4228
See [CHANGELOG](https://github.com/open-stage/python-gdtf/blob/master/CHANGELOG.md) for details.
4329

4430
## Status
4531

46-
- Reading of most aspects of GDTF 1.2 (DIN SPEC 15800:2022-02) should be covered.
47-
- Writing is currently not implemented.
32+
- Reading and Writing of all aspects of GDTF 1.2 (DIN SPEC 15800:2022-02)
4833

4934
## Installation
5035

@@ -68,6 +53,8 @@ uv add pygdtf --pre
6853

6954
## Usage
7055

56+
### GDTF files reading
57+
7158
```python
7259
# import
7360
import pygdtf
@@ -114,6 +101,22 @@ gdtf_fixture.dmx_modes[0].dmx_channels.as_dict()
114101
# see the source code for more methods
115102
```
116103

104+
### Writing a GDTF file
105+
106+
```python
107+
import pygdtf
108+
from pathlib import Path
109+
110+
# parse a GDTF file
111+
fixture = pygdtf.FixtureType("BlenderDMX@LED_PAR_64_RGBW@v0.3.gdtf")
112+
113+
# create writer that reuses the parsed XML tree and embedded resources
114+
writer = pygdtf.FixtureTypeWriter(fixture)
115+
116+
# write a new GDTF archive (DataVersion can be overridden if desired)
117+
writer.write_gdtf(Path("BlenderDMX@LED_PAR_64_RGBW@v0.3_roundtrip.gdtf"))
118+
```
119+
117120
See [BlenderDMX](https://github.com/open-stage/blender-dmx) and
118121
[tests](https://github.com/open-stage/python-gdtf/tree/master/tests) for
119122
reference implementation and usage examples.
@@ -167,7 +170,7 @@ please cite it as follows:
167170
title = {pyGDTF: Python Library for General Device Type Format},
168171
author = {{OpenStage}},
169172
year = {2025},
170-
version = {1.3.0},
173+
version = {1.4.0},
171174
url = {https://github.com/open-stage/python-gdtf}
172175
}
173176
```

licenserc.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ excludes = [
3030
"*.xml",
3131
"*.gdtf",
3232
"*.lock",
33+
"gdtf.xsd",
34+
3335
]
3436

3537
[git]

0 commit comments

Comments
 (0)