我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.ID_CANCEL。
def __init__(self, *args, **kwds): # begin wxGlade: Dialogo_acceso_vcenter.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX wx.Dialog.__init__(self, *args, **kwds) self.label_7 = wx.StaticText(self, wx.ID_ANY, "Vcenter / esxi:") self.nombre_vcenter = wx.TextCtrl(self, wx.ID_ANY, "") self.label_9 = wx.StaticText(self, wx.ID_ANY, "Login:") self.login_vcenter = wx.TextCtrl(self, wx.ID_ANY, "") self.label_10 = wx.StaticText(self, wx.ID_ANY, "Password:") self.passwor_vcenter = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD) self.label_8 = wx.StaticText(self, wx.ID_ANY, "Puerto:") self.puert_vcenter = wx.TextCtrl(self, wx.ID_ANY, "") self.button_Exit = wx.Button(self, wx.ID_CANCEL, "Exit") self.button_Connect = wx.Button(self, wx.ID_OK, "Conectar") self.__set_properties() self.__do_layout() # end wxGlade
def buildDialog(filePath, resourceName, mayCancel, **defaults): """Return a configured wx.Dialog. Assumes that the OK and Cancel buttons are named ID_OK & ID_CANCEL. """ res = loadXrc(filePath) insureWxApp() dlg = res.LoadDialog(None, resourceName) assert isinstance(dlg, wx.Dialog) dlg.Fit() fetchWidget = dlg.FindWindowByName bOk = dlg.FindWindowByName('ID_OK') bCancel = dlg.FindWindowByName('ID_CANCEL') bOk.SetId(wx.ID_OK) bCancel.SetId(wx.ID_CANCEL) if not mayCancel: bCancel.Disable() bCancel.Hide() for name, value in defaults.items(): dlg.FindWindowByName(name).SetValue(value) if not mayCancel: dlg.Bind(wx.EVT_CHAR_HOOK, escapeSuppressor) return dlg
def OnQuit(self,event,dbfile): if _plat.startswith('linux'): dlg = wx.MessageDialog(self, 'Really quit?','', wx.OK | wx.CANCEL | wx.ICON_ERROR) val = dlg.ShowModal() dlg.Show() if val == wx.ID_CANCEL: dlg.Destroy() elif val == wx.ID_OK: OKQuit = self.DBQuit(dbfile) if OKQuit == 42: self.Close() elif _plat.startswith('darwin'): pass elif _plat.startswith('win'): OKQuit = self.DBQuit(dbfile) if OKQuit == 42: self.Close() sys.exit()#windows self.Refresh()
def saveCap(self): cap = self.src.getEEGSecs(self.getSessionTime(), filter=False) saveDialog = wx.FileDialog(self, message='Save EEG data.', wildcard='Pickle (*.pkl)|*.pkl|All Files|*', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) try: if saveDialog.ShowModal() == wx.ID_CANCEL: return cap.saveFile(saveDialog.GetPath()) except Exception: wx.LogError('Save failed!') raise finally: saveDialog.Destroy()
def mediaBrowse(self, event): dialog = wx.DirDialog(self, 'Choose media directory', '', style=wx.DD_DEFAULT_STYLE) try: if dialog.ShowModal() == wx.ID_CANCEL: return path = dialog.GetPath() except Exception: wx.LogError('Failed to open directory!') raise finally: dialog.Destroy() if len(path) > 0: self.mediaPathTextCtrl.SetValue(path) self.pg.mplayer.setCWD(path)
def beforeStop(self): if not 'practice' in self.protocol: cap = self.src.getEEGSecs(time.time() - self.startTime, filter=False) fileName = self.subjectTextCtrl.GetValue() + '-' +\ self.protocol.replace(' ', '-') + '.pkl' saveDialog = wx.FileDialog(self, message='Save EEG data.', wildcard='Pickle (*.pkl)|*.pkl|All Files|*', defaultFile=fileName, style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) try: if saveDialog.ShowModal() == wx.ID_CANCEL: return cap.saveFile(saveDialog.GetPath()) except Exception: wx.LogError('Save failed!') raise finally: saveDialog.Destroy()
def saveMessages(self, event=None): """Save the message log to file. """ saveDialog = wx.FileDialog(self.scrolledPanel, message='Save Message Log', wildcard='Text Files (*.txt)|*.txt|All Files|*', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) try: if saveDialog.ShowModal() == wx.ID_CANCEL: return with open(saveDialog.GetPath(), 'w') as fileHandle: fileHandle.write(self.messageArea.GetValue()) except Exception as e: wx.LogError('Save failed!') raise finally: saveDialog.Destroy()
def loadFile(self, event=None): openFileDialog = wx.FileDialog(None, message='Load EEG data.', wildcard='JSON (*.json)|*.json|All Files|*', style=wx.FD_OPEN) try: if openFileDialog.ShowModal() == wx.ID_CANCEL: return wx.ID_CANCEL except Exception: wx.LogError('Save failed!') raise finally: openFileDialog.Destroy() cap = eeg.EEGFromJSON(openFileDialog.GetPath(), protocol='3minutes') self.replayData = cap.data self.setSampRate(cap.getSampRate()) self.setChans(cap.getChanNames())
def __init__(self, *args, **kwds): # begin wxGlade: Dialog_snapshot.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER wx.Dialog.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, wx.ID_ANY, "Nombre:") self.nombre_snap = wx.TextCtrl(self, wx.ID_ANY, "") self.label_2 = wx.StaticText(self, wx.ID_ANY, u"Descripci\u00f3n:") self.descripcion_snap = wx.TextCtrl(self, wx.ID_ANY, "") self.checkbox_memory = wx.CheckBox(self, wx.ID_ANY, "memory") self.checkbox_quiesce = wx.CheckBox(self, wx.ID_ANY, "quiesce") self.snap_ok = wx.Button(self, wx.ID_OK, "OK") self.snap_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel") self.__set_properties() self.__do_layout() # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: LogicalVolumeDialog.__init__ wx.Dialog.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, wx.ID_ANY) self.panel_4 = wx.Panel(self, wx.ID_ANY) self.label_1 = wx.StaticText(self, wx.ID_ANY, _("Select Logical Volume: "), style=wx.ALIGN_CENTER_HORIZONTAL) self.panel_7 = wx.Panel(self, wx.ID_ANY) self.combo_logical_volumes = wx.ComboBox(self, wx.ID_ANY, choices=[], style=wx.CB_DROPDOWN) self.panel_8 = wx.Panel(self, wx.ID_ANY) self.panel_3 = wx.Panel(self, wx.ID_ANY) self.panel_5 = wx.Panel(self, wx.ID_ANY) self.button_select = wx.Button(self, wx.ID_OK, _("Select")) self.panel_9 = wx.Panel(self, wx.ID_ANY) self.button_cancel = wx.Button(self, wx.ID_CANCEL, _("Cancel")) self.panel_6 = wx.Panel(self, wx.ID_ANY) self.panel_2 = wx.Panel(self, wx.ID_ANY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.button_select_click, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.button_cancel_click, id=wx.ID_CANCEL) # end wxGlade self.PopulateVolumes()
def CheckSaveBeforeClosing(self, title=_("Close Project")): """Function displaying an question dialog if project is not saved" :returns: False if closing cancelled. """ if not self.Controler.ProjectIsSaved(): dialog = wx.MessageDialog(self, _("There are changes, do you want to save?"), title, wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION) answer = dialog.ShowModal() dialog.Destroy() if answer == wx.ID_YES: self.SaveProject() elif answer == wx.ID_CANCEL: return False for idx in xrange(self.TabsOpened.GetPageCount()): window = self.TabsOpened.GetPage(idx) if not window.CheckSaveBeforeClosing(): return False return True # ------------------------------------------------------------------------------- # File Menu Functions # -------------------------------------------------------------------------------
def __init__( self, parent, id, titlemsg ): wx.Dialog.__init__( self, parent, id, title=titlemsg ) MechList = [] for m in parent.ScoreServer.MechList.List: MechList.append( str(m.ID) + ": " + str(m.Name) ) self.MechText = wx.StaticText( self, -1, "Mech Selection:" ) self.MechChoice = wx.ListBox( self, -1, style=wx.LB_EXTENDED, choices=MechList ) self.CancelButton = wx.Button( self, wx.ID_CANCEL, "Cancel" ) self.OKButton = wx.Button( self, wx.ID_OK, "OK" ) TopSizer = wx.BoxSizer( wx.VERTICAL ) BtnSizer = wx.BoxSizer( wx.HORIZONTAL ) BtnSizer.Add( self.CancelButton, 0, wx.ALL, 5 ) BtnSizer.Add( self.OKButton, 0, wx.ALL, 5 ) TopSizer.Add( self.MechText, 0, wx.ALL, 5 ) TopSizer.Add( self.MechChoice, 0, wx.ALL, 5 ) TopSizer.Add( BtnSizer, 0, wx.ALL|wx.CENTER, 5 ) self.SetSizer( TopSizer ) TopSizer.Fit( self )
def __init__(self, *args, **kwds): self.settings = kwds['settings'] del kwds['settings'] # begin wxGlade: TerminalSettingsDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.checkbox_echo = wx.CheckBox(self, -1, "Local Echo") self.checkbox_unprintable = wx.CheckBox(self, -1, "Show unprintable characters") self.radio_box_newline = wx.RadioBox(self, -1, "Newline Handling", choices=["CR only", "LF only", "CR+LF"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.sizer_4_staticbox = wx.StaticBox(self, -1, "Input/Output") self.button_ok = wx.Button(self, wx.ID_OK, "") self.button_cancel = wx.Button(self, wx.ID_CANCEL, "") self.__set_properties() self.__do_layout() # end wxGlade self.__attach_events() self.checkbox_echo.SetValue(self.settings.echo) self.checkbox_unprintable.SetValue(self.settings.unprintable) self.radio_box_newline.SetSelection(self.settings.newline)
def on_open(self, event): """ Recursively loads a KiCad schematic and all subsheets """ #self.save_component_type_changes() open_dialog = wx.FileDialog(self, "Open KiCad Schematic", "", "", "Kicad Schematics (*.sch)|*.sch", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if open_dialog.ShowModal() == wx.ID_CANCEL: return # Load Chosen Schematic print("opening File:", open_dialog.GetPath()) # Store the path to the file history self.filehistory.AddFileToHistory(open_dialog.GetPath()) self.filehistory.Save(self.config) self.config.Flush() self.load(open_dialog.GetPath())
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, title=u"Logon", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) vsizer = wx.BoxSizer(orient=wx.VERTICAL) gb = wx.GridBagSizer() gb.Add(wx.StaticText(self, -1, u"Username"), flag=wx.ALL|wx.EXPAND, border=10, pos=(0,0)) self._name = wx.TextCtrl(self, -1) gb.Add(self._name, flag=wx.ALL|wx.EXPAND, border=10, pos=(0,1)) gb.Add(wx.StaticText(self, -1, u"Password"), flag=wx.ALL|wx.EXPAND, pos=(1,0), border=10) self._pass = wx.TextCtrl(self, -1, style=wx.TE_PASSWORD) gb.Add(self._pass, border=10, flag=wx.EXPAND|wx.ALL, pos=(1,1)) gb.AddGrowableCol(1) butsz = wx.StdDialogButtonSizer() okbut = wx.Button(self, wx.ID_OK, u"OK") butsz.AddButton(okbut) cbut = wx.Button(self, wx.ID_CANCEL, u"Cancel") butsz.AddButton(cbut) insp = wx.Button(self, wx.ID_HELP, u"Help") butsz.AddButton(insp) insp.Bind(wx.EVT_BUTTON, InspectionTool().Show) butsz.Realize() okbut.SetDefault() vsizer.Add(gb, 0, wx.EXPAND) vsizer.Add(butsz, 0, wx.EXPAND) self.SetSizer(vsizer) self.Fit()
def __init__(self, parent): with iz.Dialog(init=self, title=u"Logon", orient=wx.VERTICAL, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER): with iz.GridBagSizer(orient=wx.HORIZONTAL, proportion=1) as gb: # Defaults for StaticText and TextCtrl are normally border=0,proportion=0,flag=0. Change them temporarily # to avoid repeating the same options for each and every control: with iz.StaticText.Default(border=10), iz.TextCtrl.Default(border=10, proportion=1, flag=wx.EXPAND): # Now the sizer parameters can be omitted in the control definitions, since the defaults are # now appropriate. iz.StaticText(u"Username") self._name = iz.TextCtrl().wx iz.StaticText(u"Password", x=0) self._pass = iz.TextCtrl(style=wx.TE_PASSWORD).wx gb.AddGrowableCol(1) with iz.StdDialogButtonSizer(): okbut = iz.Button(u"OK", id=wx.ID_OK).wx iz.Button(u"Cancel", id=wx.ID_CANCEL) insp = iz.Button(u"Help", id=wx.ID_HELP,border=10, EVT_BUTTON=InspectionTool().Show).wx okbut.SetDefault() self.Fit()
def OnOpen(self, event): openFileDialog = wx.FileDialog(self, "Open i3 Config file", os.path.expanduser("~/.i3/"), "","i3 Config file |*", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if openFileDialog.ShowModal() == wx.ID_CANCEL: return cfg = Config(self.messager,openFileDialog.GetPath()) self.LoadConfig(cfg)
def OnCreateVariable(self,event): openColourDialog = wx.ColourDialog(self) if openColourDialog.ShowModal() == wx.ID_CANCEL: return openNameChooser = wx.TextEntryDialog(self,"What would you like your new colour variable to be called?") if openNameChooser.ShowModal() == wx.ID_CANCEL: return proposed = openNameChooser.GetValue() name = "" seenChar = False for character in proposed: if not seenChar: if character in string.ascii_letters: name+=character seenChar=True elif character in string.ascii_letters+string.digits: name+=character if name=="": i = 0 for name in self.config.setColours: if name[:14]=="colourVariable": i+=1 name = "colourVariable"+str(i) name = "$"+name self.config.setColourChanged(openColourDialog.GetColourData(),name) self.LoadConfig(self.config)
def WorkSpace(self,e ): ''' Load in a project. ''' logging.exception(self.clargs) dbfile = self.clargs['project'] if not os.path.isfile(dbfile): dlg = wx.MessageDialog(self, 'Project not found. Browse for the file?', '',wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_QUESTION) val = dlg.ShowModal() if val == wx.ID_YES: self.OpenFile(e,False) elif val == wx.ID_CANCEL: dlg.Destroy() else: self.OpenFile(False,dbfile) self.bplay.SetBitmapLabel(self.bplayicon) self.panel2.Refresh() #update timeline view self.Layout() self.panel3.SetFocus()
def TakeSnapshot(self,e,args): logging.exception('CAPTURE') if self.camset == 1: self.framlog += 1 #print(self.camhero)#DEBUG vidcap = vlc.libvlc_video_take_snapshot(self.player,0,os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'),0,0) self.cur.execute('INSERT INTO Timeline VALUES(Null,?,?)', (str(self.framlog).zfill(3)+'.png',0)) # add graphically to timeline img = self.MakeThumbnail(os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'), self.thumbsize) self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY, wx.BitmapFromImage(img),name=str(self.framlog).zfill(3)+'.png') self.imageCtrl.SetBitmap(wx.BitmapFromImage(img)) self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick ) self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease ) logging.exception(self.imageCtrl.GetId() ) self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 ) # scroll right 100% to get close to new frame self.panel3.Scroll(self.thumbsize,0) self.Layout() # draw new frame self.hbox2.Layout() self.panel3.Refresh() # scroll WAY right again to show frame self.panel3.Scroll(200,0) # send the shot to onion skin img = os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png') self.OnionSkin(img) logging.exception(self.framlog) else: dlg = wx.MessageDialog(self, 'Please select your camera first.','',wx.OK | wx.ICON_ERROR) val = dlg.ShowModal() if val == wx.ID_OK: dlg.Destroy() if val == wx.ID_CANCEL: dlg.Destroy() self.player.play() self.brec.SetBitmapLabel(self.brecicon)
def __init__(self, parent, name, number, minnamelen, maxnamelen): wxskinDialog.__init__(self, parent, -1, "Phonebook edit entry") self.SetAutoLayout(True) self.name = None self.number = None nameTextId = wx.NewId() # Main window resizer object border = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText(self, -1, "Enter the phonebook entry name, number and press OK.") border.Add(label, 1, wx.ALL, 10) #fgs = wx.FlexGridSizer(2,3,5,20) fgs = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Name (max %d): " % maxnamelen) fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10) self.nameCtrl = wx.TextCtrl(self, nameTextId, name, validator = pySIMvalidator(None, minnamelen, maxnamelen)) fgs.Add(self.nameCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10) border.Add(fgs, 1, wx.ALL) fgs = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Number (max 20): ") fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10) self.numberCtrl = wx.TextCtrl(self, -1, number, validator = pySIMvalidator("+*#pw0123456789", None, 20)) fgs.Add(self.numberCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10) border.Add(fgs, 1, wx.ALL) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(wx.Button(self, ID_BUTTON_OK, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20) buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20) border.Add(buttons, 1, wx.ALL) wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK) wx.EVT_TEXT_ENTER(self, nameTextId, self.onOK) self.SetAutoLayout(1); self.SetSizer(border) border.Fit(self) self.Layout()
def __init__(self, parent, name): wxskinDialog.__init__(self, parent, -1, "Phonebook import") self.SetAutoLayout(True) self.function = 0 # Main window resizer object border = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText(self, -1, "Name '%s' already exists in SIM phonebook.\n\nDo you want to overwrite exisiting, duplicate or skip!?" % (name)) border.Add(label, 1, wx.ALL, 10) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add(wx.Button(self, ID_BUTTON_OVERWRITE, "Overwrite"), 1, wx.ALIGN_LEFT | wx.ALL, 20) buttons.Add(wx.Button(self, ID_BUTTON_COPY, "Duplicate"), 1, wx.ALIGN_RIGHT | wx.ALL, 20) buttons.Add(wx.Button(self, ID_BUTTON_SKIP, "Skip"), 1, wx.ALIGN_RIGHT | wx.ALL, 20) buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20) border.Add(buttons, 1, wx.ALL) self.applyAll = wx.CheckBox(self, ID_CHECKBOX_APPLY_ALL, " Apply to all", wx.Point(65, 40), wx.Size(150, 20), wx.NO_BORDER) border.Add(self.applyAll, 1, wx.ALIGN_CENTER | wx.ALL) wx.EVT_BUTTON(self, ID_BUTTON_OVERWRITE, self.onOverwrite) wx.EVT_BUTTON(self, ID_BUTTON_COPY, self.onDuplicate) wx.EVT_BUTTON(self, ID_BUTTON_SKIP, self.onSkip) self.SetAutoLayout(1); self.SetSizer(border) border.Fit(self) self.Layout()
def OnResult(self, event): if self.progressDialog: self.progressDialog.EndModal(wx.ID_CANCEL) self.progressDialog.Destroy() data = event.data if data: self.statusbar.SetStatusText("Read %d logs" % len(data)) self.data = data self.data_view = self.data self.SetupGrid()
def saveResultText(self, resultText): saveDialog = wx.FileDialog(self, message='Save Result Text.', wildcard='Text (*.txt)|*.txt|All Files|*', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) try: if saveDialog.ShowModal() == wx.ID_CANCEL: return with open(saveDialog.GetPath(), 'w') as fd: fd.write(resultText) except Exception: wx.LogError('Save failed!') raise finally: saveDialog.Destroy()
def saveCap(self): cap = self.src.getEEGSecs(self.getSessionTime(), filter=False) saveDialog = wx.FileDialog(self, message='Save EEG data.', wildcard='Pickle (*.pkl)|*.pkl|All Files|*', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) try: if saveDialog.ShowModal() == wx.ID_CANCEL: return cap.saveFile(saveDialog.GetPath()) except Exception: wx.LogError('Save failed!') raise finally: saveDialog.Destroy() ##def decimate(self, cap): ## #cap = cap.demean().bandpass(0.5, 10.0, order=3) ## cap = cap.copy().demean().bandpass(0.5, 12.0, order=3) ## # kind of a hack XXX - idfah ## if cap.getSampRate() > 32.0: ## decimationFactor = int(np.round(cap.getSampRate()/32.0)) ## cap = cap.downsample(decimationFactor) ## return cap
def beforeStart(self): """Set things up for starting the source. """ if self.replayData is None: try: if self.loadFile() == wx.ID_CANCEL: wx.LogError('Failed to load data!') # maybe play some default data instead of bombing? XXX - idfah raise Exception('Critical file load canceled.') except Exception: raise self.shift = self.pollSize / float(self.sampRate) self.pollDelay = -1.0 self.lastPollTime = -1.0
def saveFile(self): self.refresh() saveDialog = wx.FileDialog(self, message='Save Image', wildcard='Portable Network Graphics (*.png)|*.png|All Files|*', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) try: if saveDialog.ShowModal() != wx.ID_CANCEL: img = self.drawingBuffer.ConvertToImage() img.SaveFile(saveDialog.GetPath(), wx.BITMAP_TYPE_PNG) except Exception as e: wx.LogError('Save failed!') raise finally: saveDialog.Destroy()
def __init__(self, *args, **kwds): # begin wxGlade: Dialogo_user_pass.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER wx.Dialog.__init__(self, *args, **kwds) self.label_3 = wx.StaticText(self, wx.ID_ANY, "Usuario:") self.usuario = wx.TextCtrl(self, wx.ID_ANY, "") self.label_4 = wx.StaticText(self, wx.ID_ANY, "Password:") self.password = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PASSWORD) self.button_OK = wx.Button(self, wx.ID_OK, "OK") self.button_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel") self.__set_properties() self.__do_layout() # end wxGlade
def button_cancel_click(self, event): # wxGlade: ExtractionDialog.<event_handler> print "Event handler 'button_cancel_click' not implemented!" self.EndModal(wx.ID_CANCEL )
def audio_btn_click(self, e): openFileDialog = wx.FileDialog(self, "Select caps folder", "", "", "MP3 files (*.mp3)|*.mp3", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) openFileDialog.SetMessage("Select an audio file from to use") if openFileDialog.ShowModal() == wx.ID_CANCEL: return 'none' audio_track = openFileDialog.GetPath() self.audio_box.SetValue(str(audio_track))
def select_caps_folder(self): openFileDialog = wx.FileDialog(self, "Select caps folder", "", "", "JPG files (*.jpg)|*.jpg", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) openFileDialog.SetMessage("Select an image from the caps folder you want to import") if openFileDialog.ShowModal() == wx.ID_CANCEL: return 'none' new_cap_path = openFileDialog.GetPath() capsdir = os.path.split(new_cap_path) capset = capsdir[1].split(".")[0][0:-10] # Used to select set if more than one are present cap_type = capsdir[1].split('.')[1] capsdir = capsdir[0] + '/' print(" Selected " + capsdir + " with capset; " + capset + " filetype; " + cap_type) return capsdir, capset, cap_type
def __init__(self, parent): super(WaveformPanel, self).__init__(parent=parent) self.parent = parent start_text = wx.StaticText(self, label="Start position (seconds)") self.start_position = wx.SpinCtrlDouble(self) stop_text = wx.StaticText(self, label="Stop position (seconds)") self.stop_position = wx.SpinCtrlDouble(self) volume_text = wx.StaticText(self, label="Playback volume") volume_slider = wx.Slider(parent=self, value=25, style=wx.SL_HORIZONTAL | wx.SL_VALUE_LABEL) ok_button = wx.Button(parent=self, id=wx.ID_OK, label="Trim") cancel_button = wx.Button(parent=self, id=wx.ID_CANCEL) top_sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = wx.BoxSizer(wx.HORIZONTAL) top_sizer.Add(start_text, 0, wx.ALL ^ wx.BOTTOM, 5) top_sizer.Add(self.start_position, 0, wx.ALL, 5) top_sizer.Add(stop_text, 0, wx.ALL ^ wx.BOTTOM, 5) top_sizer.Add(self.stop_position, 0, wx.ALL, 5) top_sizer.Add(volume_text, 0, wx.ALL ^ wx.BOTTOM, 5) top_sizer.Add(volume_slider, 0, wx.ALL | wx.EXPAND, 5) top_sizer.Add(button_sizer, 0, wx.ALL | wx.EXPAND, 5) button_sizer.Add(ok_button, 0, wx.ALL, 5) button_sizer.Add(cancel_button, 0, wx.ALL, 5) self.Bind(wx.EVT_SPINCTRLDOUBLE, source=self.start_position, handler=self.on_change) self.Bind(wx.EVT_SPINCTRLDOUBLE, source=self.stop_position, handler=self.on_change) self.Bind(wx.EVT_SLIDER, source=volume_slider, handler=self.on_volume) self.SetSizerAndFit(top_sizer)
def __init__(self, parent): # Translators: The title of a dialog to configure advanced WinTenApps add-on options such as update checking. super(WinTenAppsConfigDialog, self).__init__(parent, title=_("Windows 10 App Essentials settings")) mainSizer = wx.BoxSizer(wx.VERTICAL) w10Helper = gui.guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL) # Translators: A checkbox to toggle automatic add-on updates. self.autoUpdateCheckbox=w10Helper.addItem(wx.CheckBox(self,label=_("Automatically check for add-on &updates"))) self.autoUpdateCheckbox.SetValue(config.conf["wintenApps"]["autoUpdateCheck"]) # Translators: The label for a setting in WinTenApps add-on settings to select automatic update interval in days. self.updateInterval=w10Helper.addLabeledControl(_("Update &interval in days"), gui.nvdaControls.SelectOnFocusSpinCtrl, min=0, max=30, initial=config.conf["wintenApps"]["updateCheckTimeInterval"]) # Translators: The label for a combo box to select update channel. labelText = _("&Add-on update channel:") self.channels=w10Helper.addLabeledControl(labelText, wx.Choice, choices=["development", "stable"]) self.updateChannels = ("dev", "stable") self.channels.SetSelection(self.updateChannels.index(config.conf["wintenApps"]["updateChannel"])) if canUpdate: # Translators: The label of a button to check for add-on updates. updateCheckButton = w10Helper.addItem(wx.Button(self, label=_("Check for add-on &update"))) updateCheckButton.Bind(wx.EVT_BUTTON, self.onUpdateCheck) w10Helper.addDialogDismissButtons(self.CreateButtonSizer(wx.OK | wx.CANCEL)) self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL) mainSizer.Add(w10Helper.sizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) mainSizer.Fit(self) self.Sizer = mainSizer self.autoUpdateCheckbox.SetFocus() self.Center(wx.BOTH | (wx.CENTER_ON_SCREEN if hasattr(wx, "CENTER_ON_SCREEN") else 2))
def OnCloseButton(self, event): self.EndModal(wx.ID_CANCEL)
def yes_no(info, title="ImagePy Yes-No ?!"): dlg = wx.MessageDialog(curapp, info, title, wx.YES_NO | wx.CANCEL) rst = dlg.ShowModal() dlg.Destroy() dic = {wx.ID_YES:'yes', wx.ID_NO:'no', wx.ID_CANCEL:'cancel'} return dic[rst]
def add_confirm(self, modal=True): self.lst.AddStretchSpacer(1) sizer = wx.BoxSizer( wx.HORIZONTAL ) self.btn_OK = wx.Button( self, wx.ID_OK, 'OK') sizer.Add( self.btn_OK, 0, wx.ALIGN_RIGHT|wx.ALL, 5 ) self.btn_cancel = wx.Button( self, wx.ID_CANCEL, 'Cancel') sizer.Add( self.btn_cancel, 0, wx.ALIGN_RIGHT|wx.ALL, 5 ) self.lst.Add(sizer, 0, wx.ALIGN_RIGHT, 5 ) if not modal: self.btn_OK.Bind( wx.EVT_BUTTON, lambda e:self.commit('ok')) self.btn_cancel.Bind( wx.EVT_BUTTON, lambda e:self.commit('cancel'))
def __init__(self, *args, **kwds): # begin wxGlade: ui_choice2Dialog.__init__ kwds["style"] = wx.DIALOG_NO_PARENT wx.Dialog.__init__(self, *args, **kwds) self.numListBox = wx.ListBox(self, -1, choices=[], style=wx.LB_MULTIPLE) self.button_ok = wx.Button(self, wx.ID_OK, "") self.denListBox = wx.ListBox(self, -1, choices=[], style=wx.LB_MULTIPLE) self.button_cancel = wx.Button(self, wx.ID_CANCEL, "") self.__set_properties() self.__do_layout() # end wxGlade
def __init__( self, parent, id ): wx.Dialog.__init__( self, parent, id, title="SocketServer Setup" ) self.HostText = wx.StaticText( self, -1, "Host:" ) self.HostChoice = wx.TextCtrl( self, -1, str( parent.ScoreServer.SocketServer.Host ) ) self.PortText = wx.StaticText( self, -1, "Port:" ) self.PortChoice = wx.TextCtrl( self, -1, str( parent.ScoreServer.SocketServer.Port ) ) self.CancelButton = wx.Button( self, wx.ID_CANCEL, "Cancel" ) self.OKButton = wx.Button( self, wx.ID_OK, "OK" ) TopSizer = wx.BoxSizer( wx.VERTICAL ) HostSizer = wx.BoxSizer( wx.HORIZONTAL ) PortSizer = wx.BoxSizer( wx.HORIZONTAL ) BtnSizer = wx.BoxSizer( wx.HORIZONTAL ) HostSizer.Add( self.HostText, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) HostSizer.Add( self.HostChoice, 2, wx.ALL, 5 ) PortSizer.Add( self.PortText, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) PortSizer.Add( self.PortChoice, 2, wx.ALL, 5 ) BtnSizer.Add( self.CancelButton, 0, wx.ALL, 5 ) BtnSizer.Add( self.OKButton, 0, wx.ALL, 5 ) TopSizer.Add( HostSizer, 0, wx.ALL|wx.CENTER, 5 ) TopSizer.Add( PortSizer, 0, wx.ALL|wx.CENTER, 5 ) TopSizer.Add( BtnSizer, 0, wx.ALL|wx.CENTER, 5 ) self.SetSizer( TopSizer ) TopSizer.Fit( self )
def __init__( self, parent, id ): wx.Dialog.__init__( self, parent, id, title="TransponderListener Setup" ) self.PortText = wx.StaticText( self, -1, "Port:" ) self.PortChoice = wx.TextCtrl( self, -1, str( parent.ScoreServer.TransponderListener.Port ) ) self.BaudText = wx.StaticText( self, -1, "Host:" ) self.BaudChoice = wx.TextCtrl( self, -1, str( parent.ScoreServer.TransponderListener.Baudrate ) ) self.CancelButton = wx.Button( self, wx.ID_CANCEL, "Cancel" ) self.OKButton = wx.Button( self, wx.ID_OK, "OK" ) TopSizer = wx.BoxSizer( wx.VERTICAL ) BaudSizer = wx.BoxSizer( wx.HORIZONTAL ) PortSizer = wx.BoxSizer( wx.HORIZONTAL ) BtnSizer = wx.BoxSizer( wx.HORIZONTAL ) PortSizer.Add( self.PortText, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) PortSizer.Add( self.PortChoice, 2, wx.ALL, 5 ) BaudSizer.Add( self.BaudText, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) BaudSizer.Add( self.BaudChoice, 2, wx.ALL, 5 ) BtnSizer.Add( self.CancelButton, 0, wx.ALL, 5 ) BtnSizer.Add( self.OKButton, 0, wx.ALL, 5 ) TopSizer.Add( PortSizer, 0, wx.ALL|wx.CENTER, 5 ) TopSizer.Add( BaudSizer, 0, wx.ALL|wx.CENTER, 5 ) TopSizer.Add( BtnSizer, 0, wx.ALL|wx.CENTER, 5 ) self.SetSizer( TopSizer ) TopSizer.Fit( self )
def load_event(self, e): dia = wx.FileDialog(self, "Load Bracket", "", "", "bp5000 bracket|*.bp5", wx.FD_OPEN) if dia.ShowModal() == wx.ID_CANCEL: return brs = bracketio.read_bracket(dia.GetPath()) if isinstance(brs, str): w = wx.MessageDialog(self, brs, "Error", wx.ICON_ERROR) w.ShowModal() w.Destroy() return name = dia.GetFilename().replace(".bp5", "") pg = ManagementPage(self.nb, name, len(brs), brs) self.nb.InsertPage(0, pg, name)
def save(self, e): if not hasattr(self, "brackets"): errortext = "Make bracket before doing that" w = wx.MessageDialog(self.parent, errortext, "Error", wx.ICON_ERROR) w.ShowModal() w.Destroy() return dia = wx.FileDialog(self, "Save Bracket", "", self.sname, "bp5000 bracket|*.bp5", wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) if dia.ShowModal() == wx.ID_CANCEL: return bracketio.write_bracket(dia.GetPath(), self.brackets)
def OnCancel(self, events): """Do not update data but close dialog.""" self.EndModal(wx.ID_CANCEL) # end of class TerminalSettingsDialog
def __init__(self, *args, **kwds): # grab the serial keyword and remove it from the dict self.serial = kwds['serial'] del kwds['serial'] self.show = SHOW_ALL if 'show' in kwds: self.show = kwds.pop('show') # begin wxGlade: SerialConfigDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.label_2 = wx.StaticText(self, -1, "Port") self.choice_port = wx.Choice(self, -1, choices=[]) self.label_1 = wx.StaticText(self, -1, "Baudrate") self.combo_box_baudrate = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.sizer_1_staticbox = wx.StaticBox(self, -1, "Basics") self.panel_format = wx.Panel(self, -1) self.label_3 = wx.StaticText(self.panel_format, -1, "Data Bits") self.choice_databits = wx.Choice(self.panel_format, -1, choices=["choice 1"]) self.label_4 = wx.StaticText(self.panel_format, -1, "Stop Bits") self.choice_stopbits = wx.Choice(self.panel_format, -1, choices=["choice 1"]) self.label_5 = wx.StaticText(self.panel_format, -1, "Parity") self.choice_parity = wx.Choice(self.panel_format, -1, choices=["choice 1"]) self.sizer_format_staticbox = wx.StaticBox(self.panel_format, -1, "Data Format") self.panel_timeout = wx.Panel(self, -1) self.checkbox_timeout = wx.CheckBox(self.panel_timeout, -1, "Use Timeout") self.text_ctrl_timeout = wx.TextCtrl(self.panel_timeout, -1, "") self.label_6 = wx.StaticText(self.panel_timeout, -1, "seconds") self.sizer_timeout_staticbox = wx.StaticBox(self.panel_timeout, -1, "Timeout") self.panel_flow = wx.Panel(self, -1) self.checkbox_rtscts = wx.CheckBox(self.panel_flow, -1, "RTS/CTS") self.checkbox_xonxoff = wx.CheckBox(self.panel_flow, -1, "Xon/Xoff") self.sizer_flow_staticbox = wx.StaticBox(self.panel_flow, -1, "Flow Control") self.button_ok = wx.Button(self, wx.ID_OK, "") self.button_cancel = wx.Button(self, wx.ID_CANCEL, "") self.__set_properties() self.__do_layout() # end wxGlade # attach the event handlers self.__attach_events()
def OnCancel(self, events): self.EndModal(wx.ID_CANCEL)