def OnConfigureAxis(self, event): """ Call configure function of selected axis device. Menu action. Parameters: event - event object (wx.Event) """ mId = GetItemIds(event.GetEventObject()).index(event.GetId()) self.StopDeviceTimer() # stop signal refresh hardware.devices["axis"][mId].configure() hardware.store_hardware_info() self.StartDeviceTimer() # restart signal refresh
def OnConfigureInput(self, event): """ Call configure function of selected input device. Menu action. Parameters: event - event object (wx.Event) """ menuItem = self.menuBar.FindItemById(event.GetId()) mId = GetItemIds(menuItem.GetMenu()).index(event.GetId()) self.StopDeviceTimer() # stop signal refresh hardware.devices["input"][mId].configure() hardware.store_hardware_info() self.StartDeviceTimer() # restart signal refresh
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.")