Ejemplo n.º 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()
Ejemplo n.º 2
0
 def subjectMoved(self, reason, moved="false"):
     print self.TabID, reason, moved
     ## timestamp and store comment
     infoNode = lib.get_node(self.json, ['protocol',self.TabID,'visit_info'])
     bt.timeStamp(infoNode)
     infoNode['comments'].append(reason)
     ## determine which steps need to be redone
     if moved == "true":
         ## QUESTION: should we be on an active visit only?
         ## enable & clear printed timestamp on localizers & test equipment
         bt.movementRedo(self.json, self.TabID)
         ## REMINDER: on functional runs, they should get to hit "end" (minor bug)
     elif moved == "false":
         pass  ## just adding the comment to visit_info
     else:
         raise Exception("Invalid value for 'moved' from radio button!")
     return self.renderAndSave()
Ejemplo n.º 3
0
 def subjectMoved(reason):
     print self.tab, reason
     infoNode = lib.get_node(self.json, ['Protocol',self.tab,'visit_info'])
     bt.timeStamp(infoNode)
     infoNode['comments'].append(reason)
     return self.renderAndSave()