Beispiel #1
0
 def formHandler(self, button):
     print "received", button
     button_value = str(button).split(' ')
     btn_id = button_value[0]
     bNode = bt.btn_node(btn_id, self.json)
     bt.timeStamp(bNode)
     if bNode.has_key('action'):
         bAction = str(bNode['action'])   # ensure it's a string, not unicode
         if bAction == 'murfi':
             self.run = bNode['run']
             self.makoMurfiHandler(button_value, bNode)
         elif bAction == 'psychopy':
             self.makoDoStim(button_value, bNode)
         elif bAction == 'servenii':
             self.makoDoServ(button_value, bNode)
         elif bAction == "":    # Checkboxes have empty action fields
             self.makoCheckboxHandler(bNode)                
         else: 
             print 'mako_cherry: Unrecognized action from button: %s'%bAction
             sys.exit("realtime_app.py did not recognize button's action keyword.")
     else: 
         ## All buttons (including checkboxes) should have an action field. Something's wrong.
         print "mako_cherry: The button/checkbox you clicked is missing its action keyword."
         print "Check the json:",self.jsonpath
         print "You clicked on",button
     return self.renderAndSave()
Beispiel #2
0
 def getFlotInfo(self, button):
     print "received", button
     button_value = str(button).split(' ')
     btn_id = button_value[0]
     bNode = bt.btn_node(btn_id, self.json)
     if bNode.has_key('action'):
         bAction = str(bNode['action'])   # ensure it's a string, not unicode
         if bAction == 'murfi':
             visit = self.TabID
             run = bNode['run']
             active_url = 'subjects/%s/session%s/data/run%03d_active.json' %\
                          (self.subject, visit, run)
             reference_url = 'subjects/%s/session%s/data/run%03d_reference.json' %\
                             (self.subject, visit, run)
             placeholder = '#rtmodal'#'#rtgraph%d_%d' % (visit, run)
             return json.dumps({'active_url': active_url,
                                'reference_url': reference_url,
                                'placeholder': placeholder})