PKdwuHã+ãáÙÙpysimpledmx/pysimpledmx.pyimport serial, sys START_VAL = 0x7E END_VAL = 0xE7 COM_BAUD = 57600 COM_TIMEOUT = 1 COM_PORT = 7 DMX_SIZE = 512 LABELS = { 'GET_WIDGET_PARAMETERS' :3, #unused 'SET_WIDGET_PARAMETERS' :4, #unused 'RX_DMX_PACKET' :5, #unused 'TX_DMX_PACKET' :6, 'TX_RDM_PACKET_REQUEST' :7, #unused 'RX_DMX_ON_CHANGE' :8, #unused } class DMXConnection(object): def __init__(self, comport = None): ''' On Windows, the only argument is the port number. On *nix, it's the path to the serial device. For example: DMXConnection(4) # Windows DMXConnection('/dev/tty2') # Linux DMXConnection("/dev/ttyUSB0") # Linux ''' self.dmx_frame = [0] * DMX_SIZE try: self.com = serial.Serial(comport, baudrate = COM_BAUD, timeout = COM_TIMEOUT) except: com_name = 'COM%s' % (comport + 1) if type(comport) == int else comport print "Could not open device %s. Quitting application." % com_name sys.exit(0) print "Opened %s." % (self.com.portstr) def setChannel(self, chan, val, autorender = False): ''' Takes channel and value arguments to set a channel level in the local DMX frame, to be rendered the next time the render() method is called. ''' if not 1 <= chan-1 <= DMX_SIZE: print 'Invalid channel specified: %s' % chan-1 return # clamp value val = max(0, min(val, 255)) self.dmx_frame[chan-1] = val if autorender: self.render() def clear(self, chan = 0): ''' Clears all channels to zero. blackout. With optional channel argument, clears only one channel. ''' if chan == 0: self.dmx_frame = [0] * DMX_SIZE else: self.dmx_frame[chan-1] = 0 def render(self): '''' Updates the DMX output from the USB DMX Pro with the values from self.dmx_frame. ''' packet = [ START_VAL, LABELS['TX_DMX_PACKET'], len(self.dmx_frame) & 0xFF, (len(self.dmx_frame) >> 8) & 0xFF, ] packet += self.dmx_frame packet.append(END_VAL) packet = map(chr, packet) self.com.write(''.join(packet)) def close(self): self.com.close() PKdwuH\áïDpysimpledmx/__init__.pyfrom pysimpledmx import *PKÅxuH ¤|¢ ¢ +pysimpledmx-0.1.1.dist-info/DESCRIPTION.rstpySimpleDMX =========== ### c0z3n 2012, GPL v3 ### pySimpleDMX is a simple python module designed to make basic DMX control in python easy. pySimpleDMX is designed for and requires an [Enttec USB DMX Pro](http://www.enttec.com/index.php?main_menu=Products&pn=70304&show=description&name=dmxusbpro) or compatible hardware for communication over a DMX network. #### Installation #### ``` # stable pip install pysimpledmx # head pip install git+https://github.com/c0z3n/pySimpleDMX.git ``` #### Initialization #### To initialize pySimpleDMX, initialize a `pysimpledmx.DMXConnection()` object, using the com port number of your enttec DMX USB Pro as an argument. For example, if our DMX USB Pro is on com port 3, we would initialize our dmx connection using `dmx = pysimpledmx.DMXConnection(3)` If for any reason the dmx connection fails to initialize on the provided com port, pysimpledmx will let you know via the console and close. # example import pysimpledmx mydmx = pysimpledmx.DMXConnection(3) ... #### Usage #### DMX output through pySimpleDMX is managed using a local list of size 512 in the `DMXConnection()` object, which represents the values for all 512 dmx channels in a single universe. When initialized, the default value for each channel is zero. to push the current list of values out over the dmx network, or 'update' the network, you must call the `.render()` method on your `DMXConnection()` object. to change the value for a channel, use the `setChannel()` method on your `DMXConnection()` object. `setChannel()` requires `chan` (channel) and `val` (value) arguments, as well as an optional `autorender` argument, which should be set to `True` if you wish to have PySimpleDMX automatically update the dmx output immediately upon changing the specified channel value. the `chan` and `val` arguments should be between 1 and 512 and between 0 and 255, respectively. unless the `autorender` argument is specified `True`, the `.render()` method must be called to update the dmx output. because of the serial communication with the DMX USB Pro, this is a relatively slow operation, and thus rendering should be done sparingly to avoid bottlenecking and setting `autorender` is not reccomended. # example import pysimpledmx mydmx = pysimpledmx.DMXConnection(3) mydmx.setChannel(1, 255) # set DMX channel 1 to full mydmx.setChannel(2, 128) # set DMX channel 2 to 128 mydmx.setChannel(3, 0) # set DMX channel 3 to 0 mydmx.render() render # render all of the above changes onto the DMX network mydmx.setChannel(4, 255, autorender=True) # set channel 4 to full and render to the network #### Development ##### ##### Bumping Version ##### 1. Change version in `./setup.py` 2. `python setup.py sdist bdist_wheel upload` (requires `pip install wheel`) 3. `git commit -am 'bump version to x.x.x'` 3. `git tag x.x.x` 4. `git push --tags` 5. Add release to github tag, with changes and releasion name. PKÅxuHrÚŽûŽŽ)pysimpledmx-0.1.1.dist-info/metadata.json{"classifiers": ["Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Intended Audience :: Other Audience", "Topic :: Artistic Software"], "extensions": {"python.details": {"contacts": [{"name": "c0z3n", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://github.com/c0z3n/pySimpleDMX"}}}, "extras": [], "generator": "bdist_wheel (0.26.0)", "license": "GPLV3", "metadata_version": "2.0", "name": "pysimpledmx", "run_requires": [{"requires": ["pyserial"]}], "summary": "simple dmx control for the Enttec DMX USB Pro", "version": "0.1.1"}PKÄxuHRTM )pysimpledmx-0.1.1.dist-info/top_level.txtpysimpledmx PKÅxuHŒ''\\!pysimpledmx-0.1.1.dist-info/WHEELWheel-Version: 1.0 Generator: bdist_wheel (0.26.0) Root-Is-Purelib: true Tag: py2-none-any PKÅxuH7q„§‚ ‚ $pysimpledmx-0.1.1.dist-info/METADATAMetadata-Version: 2.0 Name: pysimpledmx Version: 0.1.1 Summary: simple dmx control for the Enttec DMX USB Pro Home-page: https://github.com/c0z3n/pySimpleDMX Author: c0z3n Author-email: UNKNOWN License: GPLV3 Platform: UNKNOWN Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Intended Audience :: Other Audience Classifier: Topic :: Artistic Software Requires-Dist: pyserial pySimpleDMX =========== ### c0z3n 2012, GPL v3 ### pySimpleDMX is a simple python module designed to make basic DMX control in python easy. pySimpleDMX is designed for and requires an [Enttec USB DMX Pro](http://www.enttec.com/index.php?main_menu=Products&pn=70304&show=description&name=dmxusbpro) or compatible hardware for communication over a DMX network. #### Installation #### ``` # stable pip install pysimpledmx # head pip install git+https://github.com/c0z3n/pySimpleDMX.git ``` #### Initialization #### To initialize pySimpleDMX, initialize a `pysimpledmx.DMXConnection()` object, using the com port number of your enttec DMX USB Pro as an argument. For example, if our DMX USB Pro is on com port 3, we would initialize our dmx connection using `dmx = pysimpledmx.DMXConnection(3)` If for any reason the dmx connection fails to initialize on the provided com port, pysimpledmx will let you know via the console and close. # example import pysimpledmx mydmx = pysimpledmx.DMXConnection(3) ... #### Usage #### DMX output through pySimpleDMX is managed using a local list of size 512 in the `DMXConnection()` object, which represents the values for all 512 dmx channels in a single universe. When initialized, the default value for each channel is zero. to push the current list of values out over the dmx network, or 'update' the network, you must call the `.render()` method on your `DMXConnection()` object. to change the value for a channel, use the `setChannel()` method on your `DMXConnection()` object. `setChannel()` requires `chan` (channel) and `val` (value) arguments, as well as an optional `autorender` argument, which should be set to `True` if you wish to have PySimpleDMX automatically update the dmx output immediately upon changing the specified channel value. the `chan` and `val` arguments should be between 1 and 512 and between 0 and 255, respectively. unless the `autorender` argument is specified `True`, the `.render()` method must be called to update the dmx output. because of the serial communication with the DMX USB Pro, this is a relatively slow operation, and thus rendering should be done sparingly to avoid bottlenecking and setting `autorender` is not reccomended. # example import pysimpledmx mydmx = pysimpledmx.DMXConnection(3) mydmx.setChannel(1, 255) # set DMX channel 1 to full mydmx.setChannel(2, 128) # set DMX channel 2 to 128 mydmx.setChannel(3, 0) # set DMX channel 3 to 0 mydmx.render() render # render all of the above changes onto the DMX network mydmx.setChannel(4, 255, autorender=True) # set channel 4 to full and render to the network #### Development ##### ##### Bumping Version ##### 1. Change version in `./setup.py` 2. `python setup.py sdist bdist_wheel upload` (requires `pip install wheel`) 3. `git commit -am 'bump version to x.x.x'` 3. `git tag x.x.x` 4. `git push --tags` 5. Add release to github tag, with changes and releasion name. PKÅxuHlhtm¨¨"pysimpledmx-0.1.1.dist-info/RECORDpysimpledmx/__init__.py,sha256=cIePSRVpR5obIuFpIP-yMSlA1inmrOBl-r_hhzh5_y4,25 pysimpledmx/pysimpledmx.py,sha256=pQN098NVh9vsfO4s33cha01e1869udAqNL0-ktz4yqo,2265 pysimpledmx-0.1.1.dist-info/DESCRIPTION.rst,sha256=6ek4XwMYSjRzHVBy2ILvlh5LmE2dMO2kQahhHJabTr0,2978 pysimpledmx-0.1.1.dist-info/METADATA,sha256=CeVGMXaK_lH-5RWr9quJ_D9e-3EoSWnCFu8uF3SqdUY,3458 pysimpledmx-0.1.1.dist-info/RECORD,, pysimpledmx-0.1.1.dist-info/WHEEL,sha256=JTb7YztR8fkPg6aSjc571Q4eiVHCwmUDlX8PhuuqIIE,92 pysimpledmx-0.1.1.dist-info/metadata.json,sha256=A-NFfPj9Pg_kE2ZATVIwrAbGt_P0X4DBPy4NXMY6uk0,654 pysimpledmx-0.1.1.dist-info/top_level.txt,sha256=jn4xg9rwae-8B3SC7HVtSyrWQxCiUDhbWGs8Pmvg4vs,12 PKdwuHã+ãáÙÙpysimpledmx/pysimpledmx.pyPKdwuH\áïD pysimpledmx/__init__.pyPKÅxuH ¤|¢ ¢ +_ pysimpledmx-0.1.1.dist-info/DESCRIPTION.rstPKÅxuHrÚŽûŽŽ)Jpysimpledmx-0.1.1.dist-info/metadata.jsonPKÄxuHRTM )pysimpledmx-0.1.1.dist-info/top_level.txtPKÅxuHŒ''\\!rpysimpledmx-0.1.1.dist-info/WHEELPKÅxuH7q„§‚ ‚ $ pysimpledmx-0.1.1.dist-info/METADATAPKÅxuHlhtm¨¨"Ñ&pysimpledmx-0.1.1.dist-info/RECORDPK…¹)