General Device Type Format library for Python
Project description
python-gdtf
Python library for General Device Type Format
GDTF specification as per https://gdtf.eu/gdtf/prologue/introduction/
See source code for documentation. Naming conventions, in general, are identical to that on the GDTF, CamelCase is replaced with underscore_delimiters.
Credits
Originally created by Jack Page. Forked to Open-Stage, used for example by BlenderDMX.
Installation
pip install pygdtf
To install latest version from this git repository, run pip:
python -m pip install https://codeload.github.com/open-stage/python-gdtf/zip/refs/heads/master
Usage
# import
import pygdtf
# parse a GDTF file
gdtf_fixture = pygdtf.FixtureType("BlenderDMX@LED_PAR_64_RGBW@v0.3.gdtf")
# get info about DMX Modes:
pygdtf.utils.get_dmx_modes_info(gdtf_fixture)
# [{'mode_id': 0,
# 'mode_name': 'Default',
# 'mode_dmx_channel_count': 5,
# 'mode_virtual_channel_count': 0}]
# get list of DMX channels with geometries, channels functions
pygdtf.utils.get_dmx_channels(gdtf_fixture, "Default")
# [[{'dmx': 1,
# 'id': 'Dimmer',
# 'default': 0,
# 'geometry': 'Beam',
# 'break': 1,
# 'channel_functions': [<pygdtf.ChannelFunction at 0x7f122435c8b0>]},
# {'dmx': 2,
# 'id': 'ColorAdd_R',
# 'default': 255,
# 'geometry': 'Beam',
# 'break': 1,
# 'channel_functions': [<pygdtf.ChannelFunction at 0x7f122435e860>]},
# {'dmx': 3,
# 'id': 'ColorAdd_G',
# 'default': 255,
# 'geometry': 'Beam',
# 'break': 1,
# 'channel_functions': [<pygdtf.ChannelFunction at 0x7f122435f0d0>]},
# {'dmx': 4,
# 'id': 'ColorAdd_B',
# 'default': 255,
# 'geometry': 'Beam',
# 'break': 1,
# 'channel_functions': [<pygdtf.ChannelFunction at 0x7f1224e56c20>]},
# {'dmx': 5,
# 'id': 'ColorAdd_W',
# 'default': 0,
# 'geometry': 'Beam',
# 'break': 1,
# 'channel_functions': [<pygdtf.ChannelFunction at 0x7f122435fdf0>]}]]
See BlenderDMX and tests for reference implementation.
Usage principles
-
for list of channels, use
pygdtf.utils.get_dmx_channels
as per example above, do not presume that plain layout of DMX Channels in a DMX Mode is defining the DMX footprint of the device. Geometry references are (frequently) used to re-use parts of the device. This means that a channel(s) defined once can be multiplied, over several times duplicated geometry (tree). -
do not use geometry names for anything related to function of the geometry (yoke, pan, tilt, head), use attached GDTF attributes ("Pan", "Tilt")
-
only Beam, Camera and Wiring geometry types are currently used special types of geometry. Other types (Axis...) are not really relevant as even Normal geometry can have for example "Pan" GDTF attribute attached, to indicate movement.
Status
- GDTF 1.1 with some portions of GDTF 1.2 being included
Development
PRs appreciated.
Typing
- At this point, the
--no-strict-optional
is needed for mypy tests to pass:
mypy pygdtf/*py --pretty --no-strict-optional
Format
- to format, use black)
Testing
- to test, run:
pytest
- to test typing with mypy run pytest:
pytest --mypy -m mypy pygdtf/*py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pygdtf-1.0.4.tar.gz
.
File metadata
- Download URL: pygdtf-1.0.4.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce7056c088266a7209cdb92ae761a6c4db4fefe571ad80ca92ba40e87fc80bd3 |
|
MD5 | ae3f8911f93f5ce68f3562fbc725fde2 |
|
BLAKE2b-256 | 5ef4cba5f3b21311b87e14ea9c155e47ff0e61c3b2ddb144a99c708207c7a3f4 |
File details
Details for the file pygdtf-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: pygdtf-1.0.4-py3-none-any.whl
- Upload date:
- Size: 16.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e237c8b2d9b1eae9d63751a4c8c021a775c86d043b59b35f2ce1f4ffcad30e1f |
|
MD5 | 77fc66e07f313adcf4f635aee4c7e375 |
|
BLAKE2b-256 | 424d55e3990c97aaa7fb8454d312a4a710fa2ff4b1034ccc4ae7599a393cbf8d |