def _action(self, evt: wx.Event): if evt.GetId() == 1: print("Edit") ew = NomenclatureEditWindow(self) ew.Show() elif evt.GetId() == 2: print("Delete") elif evt.GetId() == 3: from gui.base.clipboard import to_clipboard to_clipboard(self.GetItem(self.GetFocusedItem(), 9).GetText()) logger.debug('copied to clipboard')
def on_trigger_out(self, event: wx.Event): ident = event.GetId() obj = event.GetEventObject() assert isinstance(obj, wx.CheckBox) for ch, x in enumerate(self.channels_ui): if ident == x.trigger_out_check.GetId(): assert isinstance(self.device, osc1lite.OSC1Lite) self.device.set_trigger_out(ch, x.trigger_out_check.GetValue()) break
def OnTimer(self, event: wx.Event): """Timer fire: normally move one line down (like D key event), otherwise produce new shape """ if event.GetId() != self.ID_TIMER: event.Skip() # we don"t process this event elif self.board.neednewpiece: # first timer after full row is removed, generate new piece instead of moving down if self.board.make_new_piece(): logging.debug("This: %s; next: %s", self.board.this_piece.shape, self.board.next_piece.shape) else: # cannot even place the shape at top middle of the board, finish the game self.timer.Stop() self.dashboard.message.SetLabel("Game over") self.dashboard.SetBackgroundColour((225, 225, 225)) logging.debug("game over") else: # normal: move the current piece down for one row logging.debug("moving piece down, curr_y = %d", self.board.cur_y) self.move_down() self.Refresh() self.dashboard.Refresh()
def on_delete(self, event: wx.Event): ident = event.GetId() obj = event.GetEventObject() assert isinstance(obj, wx.Button) for idx, x in enumerate(self.waveform_panels): if ident == x.delete_button.GetId(): ch = self.mf.is_wf_using(x.label) if ch != -1: wx.MessageBox( 'Cannot delete waveform.\n' 'Waveform is being used by channel %d.' % ch, 'Error', wx.ICON_ERROR | wx.OK | wx.CENTRE, self.mf) return self.parent.Freeze() del self.waveform_panels[idx] self.box.Detach(x) x.GetStaticBox().DestroyChildren() x.Destroy() break self.mf.update_wf_list() self.parent.Layout() self.parent.Thaw()
def on_file_history(self, event: wx.Event): fileNum = event.GetId() - wx.ID_FILE1 path = self.filehistory.GetHistoryFile(fileNum) self.open_file(path, True)