Example #1
0
 def OnReloadHardware(self, event):
     """
     
         Trigger hardware reload.
         This function is meant to be called from main menu.
         
         Parameters:
             event    -    event object (wx.Event)
     
     """
     if(wx.MessageBox("Are you sure? Connected devices will be re-initialized!", "Reload hardware", style=wx.YES | wx.NO) != wx.YES):
         return
     self.StopDeviceTimer(destroy=True)
     hardware.restore_hardware_info()
     hardware.initiate_hardware()
     self.UpdateHardware()
     self.CreateDeviceWidgets()
     self.StartDeviceTimer()
     pub.sendMessage("set_status_text",inst="Hardware reload finished.")
Example #2
0
 def OnScanHardware(self, event):
     """
     
         Trigger scan for connected devices.
         This function is meant to be called from main menu.
         
         Parameters:
             event    -    event object (wx.Event)
     
     """
     if(wx.MessageBox("Are you sure? This will reset all hardware settings!", "Scan for hardware", style=wx.YES | wx.NO) != wx.YES):
         return
 
     # stop input signal timer
     self.StopDeviceTimer()
     
     # scan hardware
     hardware.scan_hardware()
     hardware.store_hardware_info()
     hardware.initiate_hardware()    # boot devices
     
     # create overview
     devlist = ""
     for dev in hardware.devices['input']:
         devlist = devlist + dev.ID + ": " + dev.name + "\n"
     for dev in hardware.devices['axis']:
         devlist = devlist + dev.ID + "_" + str(dev.axis) + ": " + dev.name + "\n"
         
     # display overview
     dlg = wx.MessageDialog(self, devlist,caption="Found hardware",style=wx.OK,pos=wx.DefaultPosition)
     dlg.ShowModal()
     dlg.Destroy()
     
     # update select boxes
     self.UpdateHardware()
     self.CreateDeviceWidgets()
     
     # restart device timer
     self.StartDeviceTimer()
     
     pub.sendMessage("set_status_text",inst="Hardware scan finished.")