Beispiel #1
0
 def on_calibration_info_press (self, widget, event):
     if self.view_calibration:
       s = self.view_calibration.on_key_press (event.get_coords()[0], event.get_coords()[1])
       if s == 0: # test calibration
           msg = generic_cmd_t ()
           msg.code = CLASS_CHECK_CALIBRATION
           msg.text = ""
           self.send_message ("CLASS_CMD", msg.encode())
       if s == 1: # cancel
           msg = generic_cmd_t ()
           msg.code = CLASS_STOP_CHECK_CALIBRATION
           msg.text = ""
           self.send_message ("CLASS_CMD", msg.encode())
           self.view_calibration.reset ()
       if s == 2: # main button
           msg = generic_cmd_t ()
           msg.code = CLASS_CALIBRATION_STEP
           msg.text = "%d" % self.view_calibration.calibration_step
           self.send_message ("CLASS_CMD", msg.encode())
           self.view_calibration.next_step ()
       if s == 3: # test UI
           self.test_ui () 
       print s
       # render
       self.view_calibration.render ()
Beispiel #2
0
 def on_system_info_press(self, widget, event):
     if self.view_system_info:
         s = self.view_system_info.on_key_press(event.get_coords()[0],
                                                event.get_coords()[1])
         if s == 0:  # sound toggle button
             msg = generic_cmd_t()
             msg.code = MONITOR_SOUND_PARAM_CHANGED
             msg.text = "%d" % (1 -
                                self.view_system_info.data.sound_enabled)
             self.send_message("SYSTEM_CMD", msg.encode())
         if s == 1:  # shutdown
             if self.confirm("Shutdown system?") == gtk.RESPONSE_ACCEPT:
                 msg = generic_cmd_t()
                 msg.code = MONITOR_SHUTDOWN_SYSTEM
                 msg.text = ""
                 self.send_message("SYSTEM_CMD", msg.encode())
         if s == 2:  # reboot
             if self.confirm("Restart system?") == gtk.RESPONSE_ACCEPT:
                 msg = generic_cmd_t()
                 msg.code = MONITOR_RESTART_SYSTEM
                 msg.text = ""
                 self.send_message("SYSTEM_CMD", msg.encode())
         if s == 3:  # logger button
             if self.view_system_info.logger_info and self.view_system_info.logger_info.logging:
                 if self.confirm("Stop logger?") == gtk.RESPONSE_ACCEPT:
                     self.stop_logger()
             else:
                 if self.confirm("Start logger?") == gtk.RESPONSE_ACCEPT:
                     self.start_logger()
Beispiel #3
0
 def on_system_info_press (self, widget, event):
     if self.view_system_info:
         s = self.view_system_info.on_key_press (event.get_coords()[0], event.get_coords()[1])
         if s == 0: # sound toggle button
            msg = generic_cmd_t ()
            msg.code = MONITOR_SOUND_PARAM_CHANGED
            msg.text = "%d" % (1 - self.view_system_info.data.sound_enabled)
            self.send_message ("SYSTEM_CMD", msg.encode())
         if s == 1: # shutdown
               if self.confirm ("Shutdown system?") == gtk.RESPONSE_ACCEPT:
                   msg = generic_cmd_t ()
                   msg.code = MONITOR_SHUTDOWN_SYSTEM
                   msg.text = ""
                   self.send_message ("SYSTEM_CMD", msg.encode())
         if s == 2: # reboot
               if self.confirm ("Restart system?") == gtk.RESPONSE_ACCEPT:
                   msg = generic_cmd_t ()
                   msg.code = MONITOR_RESTART_SYSTEM
                   msg.text = ""
                   self.send_message ("SYSTEM_CMD", msg.encode())
         if s == 3: # logger button
            if self.view_system_info.logger_info and self.view_system_info.logger_info.logging:
               if self.confirm ("Stop logger?") == gtk.RESPONSE_ACCEPT:
                   self.stop_logger ()
            else:
               if self.confirm ("Start logger?") == gtk.RESPONSE_ACCEPT:
                   self.start_logger ()
Beispiel #4
0
 def on_calibration_info_press(self, widget, event):
     if self.view_calibration:
         s = self.view_calibration.on_key_press(event.get_coords()[0],
                                                event.get_coords()[1])
         if s == 0:  # test calibration
             msg = generic_cmd_t()
             msg.code = CLASS_CHECK_CALIBRATION
             msg.text = ""
             self.send_message("CLASS_CMD", msg.encode())
         if s == 1:  # cancel
             msg = generic_cmd_t()
             msg.code = CLASS_STOP_CHECK_CALIBRATION
             msg.text = ""
             self.send_message("CLASS_CMD", msg.encode())
             self.view_calibration.reset()
         if s == 2:  # main button
             msg = generic_cmd_t()
             msg.code = CLASS_CALIBRATION_STEP
             msg.text = "%d" % self.view_calibration.calibration_step
             self.send_message("CLASS_CMD", msg.encode())
             self.view_calibration.next_step()
         if s == 3:  # test UI
             self.test_ui()
         print s
         # render
         self.view_calibration.render()
Beispiel #5
0
 def on_nav_press (self, widget, event):
     if self.view_nav_info:
       s = self.view_nav_info.on_key_press (event.get_coords()[0], event.get_coords()[1])
       if s == 0:
           # unclear guidance
           msg = generic_cmd_t ()
           msg.code = CLASS_USER_UNCLEAR_GUIDANCE
           msg.text = " "
           self.send_message ("CLASS_CMD", msg.encode())
       if s == 1:
           # user is lost
           msg = generic_cmd_t ()
           msg.code = CLASS_USER_LOST
           msg.text = " "
           self.send_message ("CLASS_CMD", msg.encode())
Beispiel #6
0
  def on_calib_check (self, widget):
    if not self._connected:
	self.dialog ("Connect first.", gtk.MESSAGE_ERROR)
        return
    msg = generic_cmd_t ()
    msg.code = CLASS_CHECK_CALIBRATION
    self.send_message ("CLASS_PARAM", msg.encode())
Beispiel #7
0
 def on_calib_check(self, widget):
     if not self._connected:
         self.dialog("Connect first.", gtk.MESSAGE_ERROR)
         return
     msg = generic_cmd_t()
     msg.code = CLASS_CHECK_CALIBRATION
     self.send_message("CLASS_PARAM", msg.encode())
Beispiel #8
0
 def on_nav_press(self, widget, event):
     if self.view_nav_info:
         s = self.view_nav_info.on_key_press(event.get_coords()[0],
                                             event.get_coords()[1])
         if s == 0:
             # unclear guidance
             msg = generic_cmd_t()
             msg.code = CLASS_USER_UNCLEAR_GUIDANCE
             msg.text = " "
             self.send_message("CLASS_CMD", msg.encode())
         if s == 1:
             # user is lost
             msg = generic_cmd_t()
             msg.code = CLASS_USER_LOST
             msg.text = " "
             self.send_message("CLASS_CMD", msg.encode())
Beispiel #9
0
    def on_panel_info_press(self, widget, event):
        if self.view_panel:
            s = self.view_panel.on_key_press(event.get_coords()[0],
                                             event.get_coords()[1])
            if s == 0:
                if self.confirm(
                        "Start new exploration?") == gtk.RESPONSE_ACCEPT:
                    msg = generic_cmd_t()
                    msg.code = CLASS_START_EXPLORATION
                    msg.text = ""
                    self.send_message("CLASS_CMD", msg.encode())
            if s == 1:
                if self.confirm("End exploration?") == gtk.RESPONSE_ACCEPT:
                    msg = generic_cmd_t()
                    msg.code = CLASS_END_EXPLORATION
                    msg.text = ""
                    self.send_message("CLASS_CMD", msg.encode())
            if s == 2:
                if self.view_map.class_param:
                    nodeid = self.node_prompt()
                    if nodeid is not -1:
                        msg = generic_cmd_t()
                        msg.code = CLASS_FORCE_NODE
                        msg.text = "%d" % nodeid
                        self.send_message("CLASS_CMD", msg.encode())

            if s == 3:
                if self.view_map.class_param:
                    nodeid = self.node_prompt()
                    if nodeid is not -1:
                        msg = generic_cmd_t()
                        msg.code = CLASS_GOTO_NODE
                        msg.text = "%d" % nodeid
                        self.send_message("CLASS_CMD", msg.encode())
            if s == 4:
                if self.view_map.class_param and self.view_map.class_param.mode == self.view_map.class_param.EXPLORATION_MODE:
                    label = self.prompt_user("Label current place")
                    if label and self.view_map.class_param.nodeid_now != -1:
                        self.label_node(self.view_map.class_param.nodeid_now,
                                        label)
            if s == 5:
                map_name = self.map_prompt()
                if map_name:
                    msg = generic_cmd_t()
                    msg.code = CLASS_LOAD_MAP
                    msg.text = "%s" % map_name
                    self.send_message("CLASS_CMD", msg.encode())
Beispiel #10
0
  def on_panel_info_press (self, widget, event):
      if self.view_panel:
        s = self.view_panel.on_key_press (event.get_coords()[0], event.get_coords()[1])
        if s == 0:
          if self.confirm ("Start new exploration?") == gtk.RESPONSE_ACCEPT:
              msg = generic_cmd_t ()
              msg.code = CLASS_START_EXPLORATION
              msg.text = ""
              self.send_message ("CLASS_CMD", msg.encode())
        if s == 1:
          if self.confirm ("End exploration?") == gtk.RESPONSE_ACCEPT:
              msg = generic_cmd_t ()
              msg.code = CLASS_END_EXPLORATION
              msg.text = ""
              self.send_message ("CLASS_CMD", msg.encode())
        if s == 2:
              if self.view_map.class_param:
                nodeid = self.node_prompt ()
                if nodeid is not -1:
                    msg = generic_cmd_t ()
                    msg.code = CLASS_FORCE_NODE
                    msg.text = "%d" % nodeid
                    self.send_message ("CLASS_CMD", msg.encode())

        if s == 3:
              if self.view_map.class_param:
                nodeid = self.node_prompt ()
                if nodeid is not -1:
                    msg = generic_cmd_t ()
                    msg.code = CLASS_GOTO_NODE
                    msg.text = "%d" % nodeid
                    self.send_message ("CLASS_CMD", msg.encode())
        if s == 4:
            if self.view_map.class_param and self.view_map.class_param.mode == self.view_map.class_param.EXPLORATION_MODE:
                label = self.prompt_user ("Label current place")
                if label and self.view_map.class_param.nodeid_now != -1:
                    self.label_node (self.view_map.class_param.nodeid_now, label)
        if s == 5:
            map_name = self.map_prompt ()
            if map_name:
                    msg = generic_cmd_t ()
                    msg.code = CLASS_LOAD_MAP
                    msg.text = "%s" % map_name
                    self.send_message ("CLASS_CMD", msg.encode())
Beispiel #11
0
 def on_stop_record(self, widget):
     self.send_tablet_event("TABLET_EVENT", 5)
     # switch classifier to idle
     msg = generic_cmd_t()
     msg.code = CLASS_STANDBY
     self.send_message("CLASS_PARAM", msg.encode())
Beispiel #12
0
 def label_node (self, id, label):
   # send message
   msg = generic_cmd_t ()
   msg.code = CLASS_SET_NODE_LABEL
   msg.text = "%d %s" % (id, label)
   self.send_message ("CLASS_CMD", msg.encode())
Beispiel #13
0
 def stop_logger(self):
     cmd = generic_cmd_t()
     cmd.code = 0
     cmd.text = ""
     self.send_message("STOP_LOGGING", cmd.encode())
Beispiel #14
0
 def on_add_node(self, widget):
     msg = generic_cmd_t()
     msg.code = CLASS_ADD_GATE
     self.send_message("CLASS_PARAM", msg.encode())
Beispiel #15
0
 def on_new_gate(self, widget):
     msg = generic_cmd_t()
     msg.code = CLASS_NEW_GATE
     self.send_message("CLASS_PARAM", msg.encode())
     print "Creating new gate..."
Beispiel #16
0
 def publish_ui_state(self):
     msg = generic_cmd_t()
     msg.code = UI_STATE
     msg.text = "%d" % self.wTree.get_widget("hide_images").get_active()
     self.send_message("UI_STATE", msg.encode())
     return True
Beispiel #17
0
 def on_homing(self, widget):
     if self.confirm("Confirm homing?") == gtk.RESPONSE_ACCEPT:
         msg = generic_cmd_t()
         msg.code = CLASS_HOMING
         self.send_message("CLASS_PARAM", msg.encode())
Beispiel #18
0
 def publish_ui_state (self):
   msg = generic_cmd_t ()
   msg.code = UI_STATE
   msg.text = "%d" % self.wTree.get_widget("hide_images").get_active()
   self.send_message ("UI_STATE", msg.encode())
   return True
Beispiel #19
0
 def on_add_node (self, widget):
     msg = generic_cmd_t ()
     msg.code = CLASS_ADD_GATE
     self.send_message ("CLASS_PARAM", msg.encode())
Beispiel #20
0
 def on_replay (self, widget):
     if self.confirm ("Confirm replay?") == gtk.RESPONSE_ACCEPT:
         msg = generic_cmd_t ()
         msg.code = CLASS_REPLAY
         self.send_message ("CLASS_PARAM", msg.encode())
Beispiel #21
0
 def on_homing (self, widget):
     if self.confirm ("Confirm homing?") == gtk.RESPONSE_ACCEPT:
         msg = generic_cmd_t ()
         msg.code = CLASS_HOMING
         self.send_message ("CLASS_PARAM", msg.encode())
Beispiel #22
0
 def on_start_exploration (self, widget):
     if self.confirm ("Confirm new exploration?") == gtk.RESPONSE_ACCEPT:
         msg = generic_cmd_t ()
         msg.code = CLASS_START_EXPLORATION
         self.send_message ("CLASS_PARAM", msg.encode())
Beispiel #23
0
 def label_node(self, id, label):
     # send message
     msg = generic_cmd_t()
     msg.code = CLASS_SET_NODE_LABEL
     msg.text = "%d %s" % (id, label)
     self.send_message("CLASS_CMD", msg.encode())
Beispiel #24
0
 def on_new_gate (self, widget):
   msg = generic_cmd_t ()
   msg.code = CLASS_NEW_GATE
   self.send_message ("CLASS_PARAM", msg.encode())
   print "Creating new gate..."
Beispiel #25
0
 def on_start_exploration(self, widget):
     if self.confirm("Confirm new exploration?") == gtk.RESPONSE_ACCEPT:
         msg = generic_cmd_t()
         msg.code = CLASS_START_EXPLORATION
         self.send_message("CLASS_PARAM", msg.encode())
Beispiel #26
0
 def on_checkpoint_create (self, widget):
   msg = generic_cmd_t ()
   msg.code = CLASS_CHECKPOINT_CREATE
   self.send_message ("CLASS_PARAM", msg.encode())
   print "Sending create message..."
Beispiel #27
0
 def on_replay(self, widget):
     if self.confirm("Confirm replay?") == gtk.RESPONSE_ACCEPT:
         msg = generic_cmd_t()
         msg.code = CLASS_REPLAY
         self.send_message("CLASS_PARAM", msg.encode())
Beispiel #28
0
 def on_video_refresh (self, widget):
   msg = generic_cmd_t ()
   msg.code = CLASS_BLIT_REQUEST
   self.send_message ("CLASS_PARAM", msg.encode())
Beispiel #29
0
 def start_logger (self):
     cmd = generic_cmd_t ()
     cmd.code = 0
     cmd.text = ""
     self.send_message ("START_LOGGING", cmd.encode())
Beispiel #30
0
 def on_video_refresh(self, widget):
     msg = generic_cmd_t()
     msg.code = CLASS_BLIT_REQUEST
     self.send_message("CLASS_PARAM", msg.encode())
Beispiel #31
0
 def on_checkpoint_create(self, widget):
     msg = generic_cmd_t()
     msg.code = CLASS_CHECKPOINT_CREATE
     self.send_message("CLASS_PARAM", msg.encode())
     print "Sending create message..."
Beispiel #32
0
 def on_stop_record (self, widget):
     self.send_tablet_event ("TABLET_EVENT", 5);
     # switch classifier to idle
     msg = generic_cmd_t ()
     msg.code = CLASS_STANDBY
     self.send_message ("CLASS_PARAM", msg.encode())