Commit d5bb76ce authored by Dave Pena PhD's avatar Dave Pena PhD

initial commit

parents
{"nodes":[{"nid":0,"version":"1.0.0","uid":1,"category":"function","type":"Start","x":10,"y":10,"headerStyle":{"background":""},"fields":{"in":[],"out":[{"name":"start"}]},"python":"def start():\n return {'Start':True,'Settings':{'Verbose':False},'Status':{},'Threads':[]}\n","python_import":"","python_exec":"start","settings":[],"icon":"./static/media/start.c59e7ea6.svg","data":{},"kwargs":{},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nThe Start Node \n\n_This node is required to run a standard nodegraph that use the onstart decorator_\n\n\n## This Node Changes\n\nThis node initializes all standard kwargs\n\n## Getting This Node to Work\n\nThis node takes no inputs and only one can be connected in any given nodegraph. It sets Verbose to True by default, this setting outputs nodes run in the terminal when they are running and other debugging information. \n\n\n### Input State Requirements\n\nNone\n\n### Output State\n\n```python\nkwargs={\n Start: {},\n Settings: {Verbose:True},\n Data:{},\n Status: {}\n }\n```\n\n## Example Usage\n\n![STREMEExample](http://go.pluricorp.com/websitemedia/gitlab/example.gif)\n\n## Todo\n\n## Known Issues\n\nNo known Issues\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n\nThis node signifies the beginning of your node graph by the streme server. The start node passes true from the start output pin initiating the nodes it is connected to.","showExecution":false,"showDescription":false,"showImports":false,"showFunction":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[]","stringPins":"{\"in\":[],\"out\":[{\"name\":\"start\"}]}","togglePins":false,"executionClass":"","descriptionClass":"","importsClass":"","functionClass":"uk-active","pintracker":false,"dialogtracker":false,"descriptiontracker":false},{"nid":1,"version":"1.0.0","uid":10,"category":"function","type":"Stop","x":1206,"y":26,"headerStyle":{"background":"#ad1562"},"fields":{"in":[{"name":"start"}],"out":[]},"python":"@on_start\ndef stop(*args,**kwargs):\n print('exiting')\n sys.exit()\n ","python_import":"import sys","python_exec":"stop","settings":[],"icon":"./static/media/stop.a2171794.svg","data":{},"kwargs":{},"description":"This node ends the existing node experiment. It will not stop processes that have started in parallel using split nodes.","showExecution":false,"showDescription":false,"showImports":false,"showFunction":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[]}","togglePins":false},{"nid":36,"version":"0.0.1","uid":5,"category":"logical","type":"stremePyGame","x":744,"y":1,"fields":{"in":[{"name":"start"},{"name":"event1"},{"name":"event2"},{"name":"event3"},{"name":"event4"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef stremePyGame|||(*args, **kwargs):\n pg.mixer.pre_init(44100, -16, 1) \n pg.init()\n pluriPalette = {{\n \"pluri\":(135,138,238),\n \"pluriDark\":(89,45,84),\n \"pop1\":(252,22,139),\n \"alert\":(222,83,96),\n \"muted\":(212,212,212),\n \"pop2\":(85,216,203),\n \"white\":(255,255,255),\n \"black\":(0,0,0)\n }} \n screen = pg.display.set_mode([800,800])\n screen.fill(pluriPalette['pluri'])\n pg.display.set_caption(\"Experiment\")\n font = pg.font.Font(pg.font.match_font('lato'), 72)\n text = font.render('SomeText', True, pluriPalette['white'])\n \n\n \n \n kwargs['Data'] = True # nodes will see anything placed in kwargs\n\n########### Keeps an error from occuring when nodes are not connected #######\n event1 = \"\"\n event2 = \"\"\n event3 = \"\"\n event4 = \"\"\n##############################################################################\n \n while kwargs['Data']:\n screen.blit(text, (10,10))\n###################### BACK PIN EVENTS #######################################\n kwargs = {event1}\n###############################################################################\n {event2}\n {event3}\n {event4}\n if kwargs['Data']:\n for i in pg.event.get():\n if i.type == pg.QUIT:\n kwargs['Data'] = False\n pg.quit()\n pg.display.flip()\n \n\n\n return kwargs\n ","python_import":"import pygame as pg\nimport pygame.gfxdraw as gfx \nimport time","python_exec":"stremePyGame|||","settings":[],"icon":"./static/media/blankNode.38260d5b.svg","data":{},"kwargs":{},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":true,"executionClass":"","descriptionClass":"","importsClass":"","functionClass":"uk-active","showDescription":false,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[]","stringPins":"{\"in\":[{\"name\":\"start\"},{\"name\":\"event1\"},{\"name\":\"event2\"},{\"name\":\"event3\"},{\"name\":\"event4\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"showImports":false},{"nid":37,"version":"0.0.1","uid":5,"category":"logical","type":"arduinoInit","x":1045,"y":270,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef arduinoInit(*args,**kwargs):\n #stores all the board details in kwargs Settings for Use in other nodes\n kwargs['Settings']['Arduino']={{'Board']:pyfirmata.Arduino('{board}')}}\n kwargs['Settings']['Arduino']['Iterator'] = pyfirmata.util.Iterator(kwargs['Settings']['Arduino']['Board'])\n kwargs['Settings']['Arduino']['Iterator'].start()\n\n return kwargs","python_import":"import pyfirmata\n","python_exec":"arduinoInit","settings":[{"key":"board","label":"path to your arduino board ex. /dev/ttyACM0 "}],"icon":"./static/media/blankNode.38260d5b.svg","data":{"standard":"","board":"/dev/ttyACM0"},"kwargs":{},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":false,"executionClass":"","descriptionClass":"uk-active","importsClass":"","functionClass":"","showDescription":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[{\"key\":\"board\",\"label\":\"path to your arduino board ex. /dev/ttyACM0 \"}]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"showImports":false,"headerStyle":{"background":"#15ad60"}},{"nid":38,"uid":"custom","category":"logical","type":"arduinoWrite","x":1050,"y":301,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef arduinoWrite|||(*args,**kwargs):\n board.get_pin('{pin}').write({value})\n\n return kwargs","python_import":"import pyfirmata\n","python_exec":"arduinoWrite|||","settings":[{"key":"pin","label":"Pin to write to ex. d:13:o "},{"key":"value","label":"Pin value ex. 1"}],"icon":"./static/media/blankNode.38260d5b.svg","data":{"standard":"","board":"d:13:o","value":"1","pin":"d:13:o"},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":false,"executionClass":"","descriptionClass":"uk-active","importsClass":"","functionClass":"","showDescription":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[{\"key\":\"pin\",\"label\":\"Pin to write to ex. d:13:o \"},{\"key\":\"value\",\"label\":\"Pin value ex. 1\"}]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"version":"0.0.1","showImports":false,"headerStyle":{"background":"#15ad60"}},{"nid":39,"uid":"custom","category":"logical","type":"arduinoWrite (House Light On)","x":435,"y":81,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef arduinoWrite|||(*args,**kwargs):\n board.get_pin('{pin}').write({value})\n\n return kwargs","python_import":"import pyfirmata\n","python_exec":"arduinoWrite|||","settings":[{"key":"pin","label":"Pin to write to ex. d:13:o "},{"key":"value","label":"Pin value ex. 1"}],"icon":"./static/media/blankNode.38260d5b.svg","data":{"standard":"","board":"d:13:o","value":"1","pin":"d:13:o"},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":false,"executionClass":"","descriptionClass":"uk-active","importsClass":"","functionClass":"","showDescription":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[{\"key\":\"pin\",\"label\":\"Pin to write to ex. d:13:o \"},{\"key\":\"value\",\"label\":\"Pin value ex. 1\"}]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"headerStyle":{"background":"#adac15"}},{"nid":40,"uid":"custom","category":"logical","type":"arduinoInit","x":34,"y":96,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef arduinoInit(*args,**kwargs):\n #stores all the board details in kwargs Settings for Use in other nodes\n kwargs['Settings']['Arduino']={{'Board']:pyfirmata.Arduino('{board}')}}\n kwargs['Settings']['Arduino']['Iterator'] = pyfirmata.util.Iterator(kwargs['Settings']['Arduino']['Board'])\n kwargs['Settings']['Arduino']['Iterator'].start()\n\n return kwargs","python_import":"import pyfirmata\n","python_exec":"arduinoInit","settings":[{"key":"board","label":"path to your arduino board ex. /dev/ttyACM0 "}],"icon":"./static/media/blankNode.38260d5b.svg","data":{"standard":"","board":"/dev/ttyACM0"},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","headerStyle":{"background":"#15ad60"}},{"nid":41,"uid":"custom","category":"logical","type":"arduinoWrite (House Light Off)","x":991,"y":20,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef arduinoWrite|||(*args,**kwargs):\n board.get_pin('{pin}').write({value})\n\n return kwargs","python_import":"import pyfirmata\n","python_exec":"arduinoWrite|||","settings":[{"key":"pin","label":"Pin to write to ex. d:13:o "},{"key":"value","label":"Pin value ex. 1"}],"icon":"./static/media/blankNode.38260d5b.svg","data":{"standard":"","board":"d:13:o","value":"0","pin":"d:13:o"},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":false,"executionClass":"","descriptionClass":"uk-active","importsClass":"","functionClass":"","showDescription":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[{\"key\":\"pin\",\"label\":\"Pin to write to ex. d:13:o \"},{\"key\":\"value\",\"label\":\"Pin value ex. 1\"}]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"headerStyle":{"background":"#adac15"}},{"nid":42,"uid":"custom","category":"logical","type":"arduinoRead","x":1052,"y":336,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef arduinoWrite|||(*args,**kwargs):\n kwargs['Data'] = board.get_pin('{pin}').read()\n\n return kwargs","python_import":"import pyfirmata\n","python_exec":"arduinoWrite|||","settings":[{"key":"pin","label":"Pin to write to ex. d:13:o "}],"icon":"./static/media/blankNode.38260d5b.svg","data":{"standard":"","board":"d:13:o","value":"1","pin":"d:13:o"},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":false,"executionClass":"","descriptionClass":"uk-active","importsClass":"","functionClass":"","showDescription":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[{\"key\":\"pin\",\"label\":\"Pin to write to ex. d:13:o \"}]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"showImports":false,"headerStyle":{"background":"#15ad60"},"version":"0.0.1"},{"nid":43,"uid":"custom","category":"logical","type":"arduinoRead (Lickometer)","x":441,"y":192,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef arduinoWrite|||(*args,**kwargs):\n kwargs['Data'] = board.get_pin('{pin}').read()\n\n return kwargs","python_import":"import pyfirmata\n","python_exec":"arduinoWrite|||","settings":[{"key":"pin","label":"Pin to write to ex. d:13:o "}],"icon":"./static/media/blankNode.38260d5b.svg","data":{"standard":"","board":"d:13:o","value":"1","pin":"d:13:o"},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","headerStyle":{"background":"#adac15"},"showExecution":false,"showFunction":false,"executionClass":"","descriptionClass":"uk-active","importsClass":"","functionClass":"","showDescription":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[{\"key\":\"pin\",\"label\":\"Pin to write to ex. d:13:o \"}]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false},{"nid":44,"uid":"custom","category":"logical","type":"arduinoWrite (Dispenser)","x":439,"y":281,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef arduinoWrite|||(*args,**kwargs):\n board.get_pin('{pin}').write({value})\n\n return kwargs","python_import":"import pyfirmata\n","python_exec":"arduinoWrite|||","settings":[{"key":"pin","label":"Pin to write to ex. d:13:o "},{"key":"value","label":"Pin value ex. 1"}],"icon":"./static/media/blankNode.38260d5b.svg","data":{"standard":"","board":"d:13:o","value":"1","pin":"d:13:o"},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":false,"executionClass":"","descriptionClass":"uk-active","importsClass":"","functionClass":"","showDescription":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[{\"key\":\"pin\",\"label\":\"Pin to write to ex. d:13:o \"},{\"key\":\"value\",\"label\":\"Pin value ex. 1\"}]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"headerStyle":{"background":"#adac15"}},{"nid":45,"uid":"custom","category":"logical","type":"arduinoWrite (Flash Light)","x":181,"y":324,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"@on_start\ndef arduinoWrite|||(*args,**kwargs):\n board.get_pin('{pin}').write({value})\n\n return kwargs","python_import":"import pyfirmata\n","python_exec":"arduinoWrite|||","settings":[{"key":"pin","label":"Pin to write to ex. d:13:o "},{"key":"value","label":"Pin value ex. 1"}],"icon":"./static/media/blankNode.38260d5b.svg","data":{"standard":"","board":"d:13:o","value":"1","pin":"d:13:o"},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n_One Sentence on what problem your node solves_\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":false,"executionClass":"","descriptionClass":"uk-active","importsClass":"","functionClass":"","showDescription":true,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[{\"key\":\"pin\",\"label\":\"Pin to write to ex. d:13:o \"},{\"key\":\"value\",\"label\":\"Pin value ex. 1\"}]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"headerStyle":{"background":"#adac15"}},{"nid":46,"version":"0.0.1","uid":5,"category":"logical","type":"playTone","x":1039,"y":482,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"class Note(Sound):\n\n def __init__(self, frequency, volume=.1):\n self.frequency = frequency\n Sound.__init__(self, self.build_samples())\n self.set_volume(volume)\n\n def build_samples(self):\n period = int(round(get_init()[0] / self.frequency))\n samples = array(\"h\", [0] * period)\n amplitude = 2 ** (abs(get_init()[1]) - 1) - 1\n for time in range(period):\n if time < period / 2:\n samples[time] = amplitude\n else:\n samples[time] = -amplitude\n return samples\n \n@on_start\ndef playTone|||(*args,**kwargs):\n Note(440).play(-1)\n \n return kwargs","python_import":"from array import array\nfrom pygame.mixer import Sound, get_init\n","python_exec":"playTone|||","settings":[],"icon":"./static/media/blankNode.38260d5b.svg","data":{},"kwargs":{},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":true,"executionClass":"","descriptionClass":"","importsClass":"","functionClass":"uk-active","showDescription":false,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"showImports":false},{"nid":47,"version":"0.0.1","uid":5,"category":"logical","type":"KeyPresses","x":607,"y":419,"fields":{"in":[{"name":"start"}],"out":[{"name":"pass"}]},"python":"class Note(Sound):\n\n def __init__(self, frequency, volume=.1):\n self.frequency = frequency\n Sound.__init__(self, self.build_samples())\n self.set_volume(volume)\n\n def build_samples(self):\n period = int(round(get_init()[0] / self.frequency))\n samples = array(\"h\", [0] * period)\n amplitude = 2 ** (abs(get_init()[1]) - 1) - 1\n for time in range(period):\n if time < period / 2:\n samples[time] = amplitude\n else:\n samples[time] = -amplitude\n return samples\n \n@on_start\ndef keydown|||(*args,**kwargs):\n pressed = pg.key.get_pressed()\n if pressed[pg.K_w]:\n print(\"w is pressed\")\n if pressed[pg.K_s]:\n print(\"s is pressed\")\n if pressed[pg.K_ESCAPE]:\n kwargs['Data'] = False\n if pressed[pg.K_SPACE]:\n print(\"Spacebar Pressed\")\n Note(440).play(100) # Frequency of Tone and how long to play it\n\n \n return kwargs","python_import":"from array import array\nfrom pygame.mixer import Sound, get_init","python_exec":"keydown|||","settings":[],"icon":"./static/media/blankNode.38260d5b.svg","data":{},"kwargs":{},"description":"![STREMECOVER](http://go.pluricorp.com/websitemedia/gitlab/templatetop.svg)\n\nInclude a brief title for your node and a small description. \n\n\n## License\n\nUsage of this node is provided under the [MIT License](http://http//opensource.org/licenses/mit-license.php). See LICENSE for the full details.\n","showExecution":false,"showFunction":true,"executionClass":"","descriptionClass":"","importsClass":"","functionClass":"uk-active","showDescription":false,"toggleMarkdown":false,"toggleUserDialog":false,"stringDialog":"[]","stringPins":"{\"in\":[{\"name\":\"start\"}],\"out\":[{\"name\":\"pass\"}]}","togglePins":false,"pintracker":false,"dialogtracker":false,"descriptiontracker":false,"showImports":false}],"connections":[{"from_node":45,"from":"pass","to_node":44,"to":"start"},{"from_node":0,"from":"start","to_node":36,"to":"start"},{"from_node":47,"from":"pass","to_node":36,"to":"event1"}],"title":"mastbehavior","showPopup":false,"current":40,"count":48,"servers":{},"serverselection":null}
\ No newline at end of file
#!/usr/bin/env python
from decorator import decorator
import time
from array import array
import pygame as pg
from pygame.mixer import Sound, get_init
import pygame.gfxdraw as gfx
@decorator
def on_start(func,*args, **kwargs):
if kwargs !={}:
try:
if kwargs['Start']:
if 'Verbose' in kwargs['Settings']:
if kwargs['Settings']['Verbose']:
print(func)
pass
response= func(*args,**kwargs)
return response
else:
kwargs['Start'] = False
print(func,"DID NOT START")
return(kwargs)
except Exception as e:
print('NODE ERROR OCCURED TRYING TO START NODE FUNCTION:')
print('===========================================')
print(func,e)
print('===========================================')
print('LAST STATE SET TO:')
print('===========================================')
print('ekwargs')
print('===========================================')
print('LAST NODE FUNCTION SET TO:')
print('===========================================')
print('efunc')
print('===========================================')
global ekwargs
global efunc
ekwargs = kwargs
efunc = func
print('HALTING')
raise
else:
print('Empty kwargs')
return ()
def start():
return {'Start':True,'Settings':{'Verbose':False},'Status':{},'Threads':[]}
@on_start
def stremePyGame_node_36(*args, **kwargs):
pg.mixer.pre_init(44100, -16, 1)
pg.init()
pluriPalette = {
"pluri":(135,138,238),
"pluriDark":(89,45,84),
"pop1":(252,22,139),
"alert":(222,83,96),
"muted":(212,212,212),
"pop2":(85,216,203),
"white":(255,255,255),
"black":(0,0,0)
}
screen = pg.display.set_mode([800,800])
screen.fill(pluriPalette['pluri'])
pg.display.set_caption("Experiment")
font = pg.font.Font(pg.font.match_font('lato'), 72)
text = font.render('SomeText', True, pluriPalette['white'])
kwargs['Data'] = True # nodes will see anything placed in kwargs
########### Keeps an error from occuring when nodes are not connected #######
event1 = ""
event2 = ""
event3 = ""
event4 = ""
##############################################################################
while kwargs['Data']:
screen.blit(text, (10,10))
###################### BACK PIN EVENTS #######################################
kwargs = keydown_node_47(**kwargs)
###############################################################################
{event2}
{event3}
{event4}
if kwargs['Data']:
for i in pg.event.get():
if i.type == pg.QUIT:
kwargs['Data'] = False
pg.quit()
pg.display.flip()
return kwargs
class Note(Sound):
def __init__(self, frequency, volume=.1):
self.frequency = frequency
Sound.__init__(self, self.build_samples())
self.set_volume(volume)
def build_samples(self):
period = int(round(get_init()[0] / self.frequency))
samples = array("h", [0] * period)
amplitude = 2 ** (abs(get_init()[1]) - 1) - 1
for time in range(period):
if time < period / 2:
samples[time] = amplitude
else:
samples[time] = -amplitude
return samples
@on_start
def keydown_node_47(*args,**kwargs):
pressed = pg.key.get_pressed()
if pressed[pg.K_w]:
print("w is pressed")
if pressed[pg.K_s]:
print("s is pressed")
if pressed[pg.K_ESCAPE]:
kwargs['Data'] = False
if pressed[pg.K_SPACE]:
print("Spacebar Pressed")
Note(440).play(100)
return kwargs
class StremeNode:
def __init__(self):
pass
def run(self,*args,**kwargs):
self.kwargs=stremePyGame_node_36(**kwargs)
return (self.kwargs)
class liveprocess:
def __init__(self):
pass
def run(self,expname="Local"):
self.response=stremePyGame_node_36(**start())
return(self.response)
if __name__ == '__main__':
process = liveprocess()
process.run()
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment