Python wx.OPEN Examples
The following are 30
code examples of wx.OPEN().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: commondialogs.py From CANFestivino with GNU Lesser General Public License v2.1 | 6 votes |
def OnImportEDSButton(self, event): dialog = wx.FileDialog(self, _("Choose an EDS file"), os.path.expanduser("~"), "", _("EDS files (*.eds)|*.eds|All files|*.*"), wx.OPEN) if dialog.ShowModal() == wx.ID_OK: filepath = dialog.GetPath() else: filepath = "" dialog.Destroy() if os.path.isfile(filepath): result, question = self.NodeList.ImportEDSFile(filepath) if result is not None and question: dialog = wx.MessageDialog(self, _("%s\nWould you like to replace it ?")%result, _("Question"), wx.YES_NO|wx.ICON_QUESTION) if dialog.ShowModal() == wx.ID_YES: result, question = self.NodeList.ImportEDSFile(filepath, True) dialog.Destroy() if result is not None and not question: dialog = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR) dialog.ShowModal() dialog.Destroy() self.RefreshEDSFile() event.Skip()
Example #2
Source File: commondialogs.py From CANFestivino with GNU Lesser General Public License v2.1 | 6 votes |
def OnProfileChoice(self, event): if self.Profile.GetStringSelection() == _("Other"): dialog = wx.FileDialog(self, _("Choose a file"), self.Directory, "", _("OD Profile files (*.prf)|*.prf|All files|*.*"), wx.OPEN|wx.CHANGE_DIR) dialog.ShowModal() filepath = dialog.GetPath() dialog.Destroy() if os.path.isfile(filepath): name = os.path.splitext(os.path.basename(filepath))[0] self.ListProfile[name] = filepath length = self.Profile.GetCount() self.Profile.Insert(name, length - 2) self.Profile.SetStringSelection(name) else: self.Profile.SetStringSelection(_("None")) event.Skip() #------------------------------------------------------------------------------- # ADD Slave to NodeList Dialog #-------------------------------------------------------------------------------
Example #3
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 6 votes |
def OnBrowse(self, event): if self.pf.filename: dDir = os.path.dirname(self.pf.filename) dFile = os.path.basename(self.pf.filename) else: dDir = self.lastDir dFile = u"" dlg = wx.FileDialog(cfgFrame, "Choose font file", defaultDir = dDir, defaultFile = dFile, wildcard = "TrueType fonts (*.ttf;*.TTF)|*.ttf;*.TTF|All files|*", style = wx.OPEN) if dlg.ShowModal() == wx.ID_OK: self.fileEntry.SetValue(dlg.GetPath()) self.fileEntry.SetInsertionPointEnd() fname = dlg.GetPath() self.nameEntry.SetValue(self.getFontPostscriptName(fname)) self.lastDir = os.path.dirname(fname) dlg.Destroy()
Example #4
Source File: ConfigEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def OnImportButton(self, event): dialog = wx.FileDialog(self.ParentWindow, _("Choose an XML file"), os.getcwd(), "", _("XML files (*.xml)|*.xml|All files|*.*"), wx.OPEN) if dialog.ShowModal() == wx.ID_OK: filepath = dialog.GetPath() if self.ModuleLibrary.ImportModuleLibrary(filepath): wx.CallAfter(self.RefreshView) else: message = wx.MessageDialog(self, _("No such XML file: %s\n") % filepath, _("Error"), wx.OK | wx.ICON_ERROR) message.ShowModal() message.Destroy() dialog.Destroy() event.Skip()
Example #5
Source File: trelby.py From trelby with GNU General Public License v2.0 | 6 votes |
def OnImportScript(self, event = None): dlg = wx.FileDialog(self, "File to import", misc.scriptDir, wildcard = "Importable files (*.txt;*.fdx;*.celtx;*.astx;*.fountain;*.fadein)|" + "*.fdx;*.txt;*.celtx;*.astx;*.fountain;*.fadein|" + "Formatted text files (*.txt)|*.txt|" + "Final Draft XML(*.fdx)|*.fdx|" + "Celtx files (*.celtx)|*.celtx|" + "Adobe Story XML files (*.astx)|*.astx|" + "Fountain files (*.fountain)|*.fountain|" + "Fadein files (*.fadein)|*.fadein|" + "All files|*", style = wx.OPEN) if dlg.ShowModal() == wx.ID_OK: misc.scriptDir = dlg.GetDirectory() if not self.tabCtrl.getPage(self.findPage(self.panel))\ .ctrl.isUntouched(): self.panel = self.createNewPanel() self.panel.ctrl.importFile(dlg.GetPath()) self.panel.ctrl.updateScreen() dlg.Destroy()
Example #6
Source File: trelby.py From trelby with GNU General Public License v2.0 | 6 votes |
def OnLoadSettings(self, event = None): dlg = wx.FileDialog(self, "File to open", defaultDir = os.path.dirname(gd.confFilename), defaultFile = os.path.basename(gd.confFilename), wildcard = "Setting files (*.conf)|*.conf|All files|*", style = wx.OPEN) if dlg.ShowModal() == wx.ID_OK: s = util.loadFile(dlg.GetPath(), self) if s: c = config.ConfigGlobal() c.load(s) gd.confFilename = dlg.GetPath() self.panel.ctrl.applyGlobalCfg(c, False) dlg.Destroy()
Example #7
Source File: meshView.py From laplacian-meshes with GNU General Public License v3.0 | 6 votes |
def OnLoadMesh(self, evt): dlg = wx.FileDialog(self, "Choose a file", ".", "", "OFF files (*.off)|*.off|TOFF files (*.toff)|*.toff|OBJ files (*.obj)|*.obj", wx.OPEN) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetFilename() dirname = dlg.GetDirectory() filepath = os.path.join(dirname, filename) print dirname self.glcanvas.mesh = PolyMesh() print "Loading mesh %s..."%filename self.glcanvas.mesh.loadFile(filepath) self.glcanvas.meshCentroid = self.glcanvas.mesh.getCentroid() self.glcanvas.meshPrincipalAxes = self.glcanvas.mesh.getPrincipalAxes() print "Finished loading mesh" print self.glcanvas.mesh self.glcanvas.initMeshBBox() self.glcanvas.Refresh() dlg.Destroy() return
Example #8
Source File: EtherCATManagementEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def OnButtonReadFromBinFile(self, event): """ Load binary file through FileDialog Binded to 'Read from File' button. @param event : wx.EVT_BUTTON object """ dialog = wx.FileDialog(self, _("Choose a binary file"), os.getcwd(), "", _("bin files (*.bin)|*.bin"), wx.OPEN) if dialog.ShowModal() == wx.ID_OK: filepath = dialog.GetPath() try: binfile = open(filepath, "rb") self.SiiBinary = binfile.read() self.HexCode, self.HexRow, self.HexCol = self.Controler.CommonMethod.HexRead(self.SiiBinary) self.UpdateSiiGridTable(self.HexRow, self.HexCol) self.SiiGrid.SetValue(self.HexCode) self.SiiGrid.Update() except Exception: self.Controler.CommonMethod.CreateErrorDialog(_('The file does not exist!')) dialog.Destroy()
Example #9
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 6 votes |
def new_external_profile(self, event): """Prompt for an external miner path, then create a miner. On Windows we validate against legal miners; on Linux they can pick whatever they want. """ wildcard = _('External miner (*.exe)|*.exe|(*.py)|*.py') if sys.platform == 'win32' else '*.*' dialog = wx.FileDialog(self, _("Select external miner:"), defaultDir=os.path.join(get_module_path(), 'miners'), defaultFile="", wildcard=wildcard, style=wx.OPEN) if dialog.ShowModal() != wx.ID_OK: return if sys.platform == 'win32' and dialog.GetFilename() not in SUPPORTED_BACKENDS: self.message( _("Unsupported external miner %(filename)s. Supported are: %(supported)s") % \ dict(filename=dialog.GetFilename(), supported='\n'.join(SUPPORTED_BACKENDS)), _("Miner not supported"), wx.OK | wx.ICON_ERROR) return path = os.path.join(dialog.GetDirectory(), dialog.GetFilename()) dialog.Destroy() self.name_new_profile(extra_profile_data=dict(external_path="CGMINER"))
Example #10
Source File: xrced.py From admin4 with Apache License 2.0 | 6 votes |
def OnOpen(self, evt): if not self.AskSave(): return dlg = wx.FileDialog(self, 'Open', os.path.dirname(self.dataFile), '', '*.xrc', wx.OPEN | wx.CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: path = dlg.GetPath() self.SetStatusText('Loading...') wx.BeginBusyCursor() try: if self.Open(path): self.SetStatusText('Data loaded') else: self.SetStatusText('Failed') self.SaveRecent(path) finally: wx.EndBusyCursor() dlg.Destroy()
Example #11
Source File: Document.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def Open(self, filePath=None): self.ShowFrame() if filePath is not None: res = wx.MessageBox( "Do you really want to load the tree file:\n%s" % filePath, eg.APP_NAME, wx.YES_NO | wx.CENTRE | wx.ICON_QUESTION, parent = self.frame, ) if res == wx.ID_NO: return wx.ID_CANCEL if self.CheckFileNeedsSave() == wx.ID_CANCEL: return wx.ID_CANCEL if filePath is None: filePath = self.AskFile(wx.OPEN) if filePath is None: return wx.ID_CANCEL self.StartSession(filePath)
Example #12
Source File: EtherCATManagementEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def WriteToEEPROM(self, event): """ Open binary file (user select) and write the selected binary data to EEPROM @param event : wx.EVT_BUTTON object """ # Check whether beremiz connected or not, and whether status is "Started" or not. check_connect_flag = self.Controler.CommonMethod.CheckConnect(False) if check_connect_flag: status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() if status is not PlcStatus.Started: dialog = wx.FileDialog(self, _("Choose a binary file"), os.getcwd(), "", _("bin files (*.bin)|*.bin"), wx.OPEN) if dialog.ShowModal() == wx.ID_OK: filepath = dialog.GetPath() try: binfile = open(filepath, "rb") self.SiiBinary = binfile.read() dialog.Destroy() self.Controler.CommonMethod.SiiWrite(self.SiiBinary) # refresh data structure kept by master self.Controler.CommonMethod.Rescan() # save binary data as inner global data of beremiz # for fast loading when slave plugin node is reopened. self.Controler.CommonMethod.SiiData = self.SiiBinary self.SetEEPROMData() except Exception: self.Controler.CommonMethod.CreateErrorDialog(_('The file does not exist!')) dialog.Destroy()
Example #13
Source File: __init__.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, path='', setfunc=None, editable=True, file_dialog_title=_("Choose a file..."), directory_dialog_title=_("Choose a folder..."), file_button_label=_("Choose &file..."), directory_button_label=_("Choose f&older..."), wildcard=_("All files (*.*)|*.*"), file_dialog_style=wx.OPEN): wx.BoxSizer.__init__(self, wx.VERTICAL) self.parent = parent self.setfunc = setfunc self.file_dialog_title = file_dialog_title self.directory_dialog_title = directory_dialog_title self.file_button_label = file_button_label self.directory_button_label = directory_button_label self.wildcard = wildcard self.file_dialog_style = file_dialog_style self.pathbox = wx.TextCtrl(self.parent, size=(250, -1)) self.pathbox.SetEditable(editable) self.Add(self.pathbox, flag=wx.EXPAND|wx.BOTTOM, border=SPACING) self.pathbox.SetValue(path) self.subsizer = wx.BoxSizer(wx.HORIZONTAL) self.Add(self.subsizer, flag=wx.ALIGN_RIGHT, border=0) self.fbutton = PathDialogButton(parent, gen_dialog=self.file_dialog, setfunc=self.set_choice, label=self.file_button_label) self.subsizer.Add(self.fbutton, flag=wx.LEFT, border=SPACING) self.dbutton = PathDialogButton(parent, gen_dialog=self.directory_dialog, setfunc=self.set_choice, label=self.directory_button_label) self.subsizer.Add(self.dbutton, flag=wx.LEFT, border=SPACING)
Example #14
Source File: DownloadManager.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def select_torrent_file(self, widget=None): open_location = self.config['open_from'] if not open_location: open_location = self.config['save_in'] path = smart_dir(open_location) dialog = wx.FileDialog(self.main_window, message=_("Open torrent file:"), defaultDir=path, wildcard=WILDCARD, style=wx.OPEN|wx.MULTIPLE) if dialog.ShowModal() == wx.ID_OK: paths = dialog.GetPaths() for path in paths: df = self.open_torrent_arg_with_callbacks(path) open_from, filename = os.path.split(path) self.send_config('open_from', open_from)
Example #15
Source File: main_frame.py From Rule-based_Expert_System with GNU General Public License v2.0 | 5 votes |
def open_picture(self, event): file_wildcard = 'picture file(*.png)|*.png|All files(*.*)|*.*' dlg = wx.FileDialog(self, 'Open Picture File', (os.getcwd() + '/../test'), style=wx.OPEN, wildcard=file_wildcard) if dlg.ShowModal() == wx.ID_OK: self.pic_path = dlg.GetPath() self.SetTitle(self.title + ' -- Shape from: ' + re.findall(r'test/(.*)$', dlg.GetPath())[0]) else: dlg.Destroy() return dlg.Destroy() self.show_picture(self.pic_path, (10, 30)) self.show_picture('init_detection.png', (420, 30)) self.engine = setup_engine(self.pic_path) self.contour_num = len(self.engine.fact_library)
Example #16
Source File: svgui.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def _ImportSVG(self): dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a SVG file"), os.getcwd(), "", _("SVG files (*.svg)|*.svg|All files|*.*"), wx.OPEN) if dialog.ShowModal() == wx.ID_OK: svgpath = dialog.GetPath() if os.path.isfile(svgpath): shutil.copy(svgpath, self._getSVGpath()) else: self.GetCTRoot().logger.write_error(_("No such SVG file: %s\n") % svgpath) dialog.Destroy()
Example #17
Source File: objdictedit.py From CANFestivino with GNU Lesser General Public License v2.1 | 5 votes |
def OnImportEDSMenu(self, event): dialog = wx.FileDialog(self, _("Choose a file"), os.getcwd(), "", _("EDS files (*.eds)|*.eds|All files|*.*"), wx.OPEN|wx.CHANGE_DIR) if dialog.ShowModal() == wx.ID_OK: filepath = dialog.GetPath() if os.path.isfile(filepath): result = self.Manager.ImportCurrentFromEDSFile(filepath) if isinstance(result, (IntType, LongType)): new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager) new_editingpanel.SetIndex(result) self.FileOpened.AddPage(new_editingpanel, "") self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1) self.RefreshBufferState() self.RefreshCurrentIndexList() self.RefreshProfileMenu() self.RefreshMainMenu() message = wx.MessageDialog(self, _("Import successful"), _("Information"), wx.OK|wx.ICON_INFORMATION) message.ShowModal() message.Destroy() else: message = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() else: message = wx.MessageDialog(self, _("\"%s\" is not a valid file!")%filepath, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() dialog.Destroy()
Example #18
Source File: PLCOpenEditor.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def OnOpenProjectMenu(self, event): if self.Controler is not None and not self.CheckSaveBeforeClosing(): return filepath = "" if self.Controler is not None: filepath = self.Controler.GetFilePath() if filepath != "": directory = os.path.dirname(filepath) else: directory = os.getcwd() result = None dialog = wx.FileDialog(self, _("Choose a file"), directory, "", _("PLCOpen files (*.xml)|*.xml|All files|*.*"), wx.OPEN) if dialog.ShowModal() == wx.ID_OK: filepath = dialog.GetPath() if os.path.isfile(filepath): self.ResetView() controler = PLCControler() result = controler.OpenXMLFile(filepath) self.Controler = controler self.LibraryPanel.SetController(controler) self.ProjectTree.Enable(True) self.PouInstanceVariablesPanel.SetController(controler) self._Refresh(PROJECTTREE, LIBRARYTREE) self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU) dialog.Destroy() if result is not None: (num, line) = result self.ShowErrorMessage(_("PLC syntax error at line {a1}:\n{a2}").format(a1=num, a2=line))
Example #19
Source File: rstbx_frame.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def OnLoadFile(self, event): wildcard_str = "" if wx.PlatformInfo[4] != "wxOSX-cocoa": from iotbx import file_reader wildcard_str = file_reader.get_wildcard_string("img") file_name = wx.FileSelector( "Image file", wildcard=wildcard_str, default_path="", flags=(wx.OPEN if WX3 else wx.FD_OPEN), ) if file_name != "": self.load_image(file_name)
Example #20
Source File: rstbx_frame.py From dials with BSD 3-Clause "New" or "Revised" License | 5 votes |
def OnLoadLabelitResult(self, event): file_name = wx.FileSelector( "Labelit result", default_path="", flags=(wx.OPEN if WX3 else wx.FD_OPEN) ) if file_name != "": self.load_image(file_name)
Example #21
Source File: __init__.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, path='', setfunc=None, editable=True, dialog_title=_("Choose a file..."), button_label=_("&Browse..."), wildcard=_("All files (*.*)|*.*"), dialog_style=wx.OPEN): ChooseDirectorySizer.__init__(self, parent, path=path, setfunc=setfunc, editable=editable, dialog_title=dialog_title, button_label=button_label) self.wildcard = wildcard self.dialog_style = dialog_style
Example #22
Source File: wx_bass_control.py From pybass with Apache License 2.0 | 5 votes |
def method_load_file(self): import os wildcard = 'music sounds (MO3, IT, XM, S3M, MTM, MOD, UMX)|*.mo3;*.it;*.xm;*.s3m;*.mtm;*.mod;*.umx' wildcard += '|stream sounds (MP3, MP2, MP1, OGG, WAV, AIFF)|*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aiff' for plugin in self.plugins.itervalues(): if plugin[0] > 0: wildcard += plugin[1] wildcard += '|All files (*.*)|*.*' dlg = wx.FileDialog(self, message = _('Choose a file'), defaultDir = os.getcwd(), defaultFile = '', wildcard = wildcard, style = wx.OPEN|wx.CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: self.name_stream = file_name = dlg.GetPath() if os.path.isfile(file_name): flags = 0 if isinstance(file_name, unicode): flags |= pybass.BASS_UNICODE try: pybass.BASS_CHANNELINFO._fields_.remove(('filename', pybass.ctypes.c_char_p)) except: pass else: pybass.BASS_CHANNELINFO._fields_.append(('filename', pybass.ctypes.c_wchar_p)) error_msg = 'BASS_StreamCreateFile error' new_bass_handle = 0 if dlg.GetFilterIndex() == 0:#BASS_CTYPE_MUSIC_MOD flags |= pybass.BASS_MUSIC_PRESCAN new_bass_handle = pybass.BASS_MusicLoad(False, file_name, 0, 0, flags, 0) error_msg = 'BASS_MusicLoad error' else:#other sound types new_bass_handle = pybass.BASS_StreamCreateFile(False, file_name, 0, 0, flags) if new_bass_handle == 0: print error_msg, pybass.get_error_description(pybass.BASS_ErrorGetCode()) else: self.method_stop_audio() self.bass_handle = new_bass_handle self.stream = None self.method_slider_set_range() self.method_check_controls()
Example #23
Source File: objdictedit.py From CANFestivino with GNU Lesser General Public License v2.1 | 5 votes |
def OnOpenMenu(self, event): filepath = self.Manager.GetCurrentFilePath() if filepath != "": directory = os.path.dirname(filepath) else: directory = os.getcwd() dialog = wx.FileDialog(self, _("Choose a file"), directory, "", _("OD files (*.od)|*.od|All files|*.*"), wx.OPEN|wx.CHANGE_DIR) if dialog.ShowModal() == wx.ID_OK: filepath = dialog.GetPath() if os.path.isfile(filepath): result = self.Manager.OpenFileInCurrent(filepath) if isinstance(result, (IntType, LongType)): new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager) new_editingpanel.SetIndex(result) self.FileOpened.AddPage(new_editingpanel, "") self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1) if self.Manager.CurrentDS302Defined(): self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, True) else: self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, False) self.RefreshEditMenu() self.RefreshBufferState() self.RefreshProfileMenu() self.RefreshMainMenu() else: message = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR) message.ShowModal() message.Destroy() dialog.Destroy()
Example #24
Source File: runsnake.py From pyFileFixity with MIT License | 5 votes |
def OnOpenMemory(self, event): """Request to open a new profile file""" dialog = wx.FileDialog(self, style=wx.OPEN) if dialog.ShowModal() == wx.ID_OK: path = dialog.GetPath() if self.loader: # we've already got a displayed data-set, open new window... frame = MainFrame() frame.Show(True) frame.load_memory(path) else: self.load_memory(path)
Example #25
Source File: runsnake.py From pyFileFixity with MIT License | 5 votes |
def OnOpenFile(self, event): """Request to open a new profile file""" dialog = wx.FileDialog(self, style=wx.OPEN|wx.FD_MULTIPLE) if dialog.ShowModal() == wx.ID_OK: paths = dialog.GetPaths() if self.loader: # we've already got a displayed data-set, open new window... frame = MainFrame() frame.Show(True) frame.load(*paths) else: self.load(*paths)
Example #26
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 5 votes |
def set_official_client_path(self, event): """Set the path to the official Bitcoin client.""" wildcard = "*.exe" if sys.platform == 'win32' else '*.*' dialog = wx.FileDialog(self, _("Select path to Bitcoin.exe"), defaultFile="bitcoin-qt.exe", wildcard=wildcard, style=wx.OPEN) if dialog.ShowModal() == wx.ID_OK: path = os.path.join(dialog.GetDirectory(), dialog.GetFilename()) if os.path.exists(path): self.bitcoin_executable = path dialog.Destroy()
Example #27
Source File: ugrid_wx.py From gridded with The Unlicense | 5 votes |
def OnOpen(self, event): dlg = wx.FileDialog(self, 'Choose a ugrid file to open', '.', '', '*.nc', wx.OPEN) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() filename = os.path.abspath(filename) self.load_ugrid_file(filename) dlg.Destroy()
Example #28
Source File: add_action.py From openplotter with GNU General Public License v2.0 | 5 votes |
def onSelect(self, e): option = self.actions_options[self.action_select.GetCurrentSelection()][0] msg = self.actions_options[self.action_select.GetCurrentSelection()][1] field = self.actions_options[self.action_select.GetCurrentSelection()][2] if field == 0: self.data.Disable() self.data.SetValue('') self.edit_skkey.Disable() if field == 1: self.data.Enable() self.data.SetFocus() self.edit_skkey.Enable() if msg: if msg == 'OpenFileDialog': dlg = wx.FileDialog(self, message=_('Choose a file'), defaultDir=self.currentpath + '/sounds', defaultFile='', wildcard=_('Audio files').decode('utf8') + ' (*.mp3)|*.mp3|' + _('All files').decode('utf8') + ' (*.*)|*.*', style=wx.OPEN | wx.CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: file_path = dlg.GetPath() self.data.SetValue(file_path) print self.currentpath os.chdir(self.currentpath) dlg.Destroy() else: if msg == 0: pass else: if field == 1 and option != _('wait'): msg = msg+ _('\n\nYou can add the current value of any Signal K key typing its name between angle brackets, e.g: <navigation.position.latitude>') wx.MessageBox(msg, 'Info', wx.OK | wx.ICON_INFORMATION)
Example #29
Source File: trelby.py From trelby with GNU General Public License v2.0 | 5 votes |
def OnOpen(self, event = None): dlg = wx.FileDialog(self, "File to open", misc.scriptDir, wildcard = "Trelby files (*.trelby)|*.trelby|All files|*", style = wx.OPEN) if dlg.ShowModal() == wx.ID_OK: misc.scriptDir = dlg.GetDirectory() self.openScript(dlg.GetPath()) dlg.Destroy()
Example #30
Source File: cfgdlg.py From trelby with GNU General Public License v2.0 | 5 votes |
def OnBrowsePDF(self, event): dlg = wx.FileDialog( cfgFrame, "Choose program", os.path.dirname(self.cfg.pdfViewerPath), self.cfg.pdfViewerPath, style = wx.OPEN) if dlg.ShowModal() == wx.ID_OK: self.progEntry.SetValue(dlg.GetPath()) dlg.Destroy()