Skip to content

Instantly share code, notes, and snippets.

@raganmd
Last active December 12, 2017 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raganmd/79474bcc32f60835a1dc4bc257d14b5a to your computer and use it in GitHub Desktop.
Save raganmd/79474bcc32f60835a1dc4bc257d14b5a to your computer and use it in GitHub Desktop.
# me - this DAT
# scriptOp - the OP which is cooking
#
# press 'Setup Parameters' in the OP to call this function to re-create the parameters.
# define where pars is coming from
pars = parent().fetch( 'set_up_attr' )
def setupParameters(scriptOp):
return
# called whenever custom pulse parameter is pushed
def onPulse(par):
return
def cook(scriptOp):
scriptOp.clear()
# insert header row
scriptOp.insertRow( [ 'path', 'parameter', 'value', 'enable' ] )
# loop through dictionary for pars
for key, value in pars.items():
for item_key, item_value in value.items():
scriptOp.appendRow( [ key, item_key, item_value, 1 ] )
# set up parent pars for heigh and width
parent_height = max( [ pars[ 'container_ui' ][ 'h' ], pars[ 'container_led_display' ][ 'h' ] ] )
parent_width = sum( [ pars[ 'container_ui' ][ 'w' ], pars[ 'container_led_display' ][ 'w' ] ] )
scriptOp.appendRow( [ '..', 'w', parent_width, 1 ] )
scriptOp.appendRow( [ '..', 'h', parent_height, 1 ] )
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment