def on_select_port(self, event): port_cb = self.FindControl(event.GetId()) port = event.GetString() if self.serial_controller.set_current_serial(port): self.update_bauds() else: set_dialog(f'Could not open port "{port}".') self.port_cb.SetSelection(-1)
def on_delete_command(self, event): size = event.GetEventObject().size if size == 'single': index = self.cmd.GetSelection() if index != -1: self.cmd.Delete(index) else: set_dialog('Please select the command to delete.') else: self.cmd.Clear()
def on_connect(self, event): connect_btn = self.FindControl(event.GetId()) if self.serial_controller.selected_serial: if self.serial_controller.selected_serial.is_open: self.serial_controller.selected_serial.close() connect_btn.SetLabel('Connect') else: self.serial_controller.selected_serial.open() connect_btn.SetLabel('Disconnect') else: set_dialog('Please select a port to connect to.')
def on_replace_command(self, event): selected = self.cmd.GetSelection() if selected != -1: replacement = self.cmdWriter.GetValue() if replacement != '': self.cmd.SetString(selected, replacement) self.cmdWriter.SetValue('') else: set_dialog('Please type command to replace.') else: set_dialog('Please select the command to replace.')
def on_tool_selected(self, event): if event.GetId() == ToolIds.SETTINGS.value: settings_frame = SettingsFrame(self) settings_frame.Show() elif event.GetId() == ToolIds.PLAY.value: camid = self.parent.controller_panel.masterCombo.GetSelection() if camid != -1: cam = self.parent.visualizer_panel.get_camera_by_id(camid) if cam: cam.translate(1, 1, 1) else: set_dialog('Please select the camera to control.') elif event.GetID() == ToolIds.PAUSE.value: pass else: pass
def OnMove(self, event): camid = self.masterCombo.GetSelection() if camid != -1: axis = event.GetEventObject().axis direction = event.GetEventObject().direction if axis in [CamAxis.X, CamAxis.Y, CamAxis.Z]: cmdbox = self.timeline_panel.cmd size = self.xyzSc.GetValue() if direction == CamAxis.MINUS: size = -size else: size = self.bcSc.GetValue() if direction == CamAxis.MINUS: size = -size cam = self.visualizer_panel.get_camera_by_id(camid) if cam: cam.on_move(axis, size) self.visualizer_panel.dirty = True else: set_dialog('Please select the camera to control.')
def onStartEvf(self, event): if self.parent.get_selected_camera() is not None: self.parent.get_selected_camera().startEvf() self.parent.add_evf_pane() else: set_dialog('Please select the camera to start live view.')
def OnTakePicture(self, event): camid = self.masterCombo.GetSelection() if self.parent.get_selected_camera() is not None: self.parent.get_selected_camera().shoot() else: set_dialog('Please select the camera to take a picture.')
def OnFocusCenter(self, event): if self.parent.selected_cam is not None: self.visualizer_panel.get_camera_by_id( self.parent.selected_cam.camid).on_focus_center() else: set_dialog('Please select the camera to control.')