Python wx.FD_FILE_MUST_EXIST Examples
The following are 30
code examples of wx.FD_FILE_MUST_EXIST().
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: bomsaway.py From Boms-Away with GNU General Public License v3.0 | 6 votes |
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())
Example #2
Source File: gui.py From RF-Monitor with GNU General Public License v2.0 | 6 votes |
def __on_open(self, _event): if not self.__save_warning(): return defDir, defFile = '', '' if self._filename is not None: defDir, defFile = os.path.split(self._filename) dlg = wx.FileDialog(self, 'Open File', defDir, defFile, 'rfmon files (*.rfmon)|*.rfmon', wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if dlg.ShowModal() == wx.ID_CANCEL: return self.open(dlg.GetPath()) self._isSaved = True self.__set_title()
Example #3
Source File: ImagePicker.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def OnButton(self, event): dialog = wx.FileDialog( self.GetParent(), message=self.mesg, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST, wildcard=( "BMP and GIF files (*.bmp;*.gif)|*.bmp;*.gif|" "PNG files (*.png)|*.png" ) ) if dialog.ShowModal() == wx.ID_OK: filePath = dialog.GetPath() infile = open(filePath, "rb") stream = infile.read() infile.close() self.SetValue(b64encode(stream)) event.Skip()
Example #4
Source File: archiveplayer.py From webarchiveplayer with GNU General Public License v3.0 | 6 votes |
def select_file(self): style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE #dialog = wx.DirDialog(top, 'Please select a directory containing archive files (WARC or ARC)', style=style) dialog = wx.FileDialog(parent=self, message='Please select a web archive (WARC or ARC) file', wildcard='WARC or ARC (*.gz; *.warc; *.arc)|*.gz;*.warc;*.arc', #wildcard='WARC or ARC (*.gz; *.warc; *.arc)|*.gz; *.warc; *.arc', style=style) if dialog.ShowModal() == wx.ID_OK: paths = dialog.GetPaths() else: paths = None dialog.Destroy() return paths #=================================================================
Example #5
Source File: MainUI.py From Model-Playgrounds with MIT License | 6 votes |
def launchFileDialog(self, evt): # defining wildcard for suppported picture formats wildcard = "JPEG (*.jpg)|*.jpg|" \ "PNG (*.png)|*.png|" \ "GIF (*.gif)|*.gif" # defining the dialog object dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW) # Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog) if dialog.ShowModal() == wx.ID_OK: self.magic_collection[1].SetValue( "You have selected a Picture. It will now be processed!, Please wait! \nLoading.....") paths = dialog.GetPaths() # This adds the selected picture to the Right region. Right region object is retrieved from UI object array modification_bitmap1 = wx.Bitmap(paths[0]) modification_image1 = modification_bitmap1.ConvertToImage() modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH) modification_bitmap2 = modification_image1.ConvertToBitmap() report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20)) self.processPicture(paths[0], "PROGRAM_INSTALL_FULLPATH\\resnet50_weights_tf_dim_ordering_tf_kernels.h5", "PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
Example #6
Source File: MainUI.py From Model-Playgrounds with MIT License | 6 votes |
def launchFileDialog(self, evt): # defining wildcard for suppported picture formats wildcard = "JPEG (*.jpg)|*.jpg|" \ "PNG (*.png)|*.png|" \ "GIF (*.gif)|*.gif" # defining the dialog object dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW) # Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog) if dialog.ShowModal() == wx.ID_OK: self.magic_collection[1].SetValue( "You have selected a Picture. It will now be processed!, Please wait! \nLoading.....") paths = dialog.GetPaths() # This adds the selected picture to the Right region. Right region object is retrieved from UI object array modification_bitmap1 = wx.Bitmap(paths[0]) modification_image1 = modification_bitmap1.ConvertToImage() modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH) modification_bitmap2 = modification_image1.ConvertToBitmap() report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20)) self.processPicture(paths[0], "PROGRAM_INSTALL_FULLPATH\\squeezenet_weights_tf_dim_ordering_tf_kernels.h5", "PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
Example #7
Source File: MainUI.py From Model-Playgrounds with MIT License | 6 votes |
def launchFileDialog(self, evt): # defining wildcard for suppported picture formats wildcard = "JPEG (*.jpg)|*.jpg|" \ "PNG (*.png)|*.png|" \ "GIF (*.gif)|*.gif" # defining the dialog object dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW) # Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog) if dialog.ShowModal() == wx.ID_OK: self.magic_collection[1].SetValue( "You have selected a Picture. It will now be processed!, Please wait! \nLoading.....") paths = dialog.GetPaths() # This adds the selected picture to the Right region. Right region object is retrieved from UI object array modification_bitmap1 = wx.Bitmap(paths[0]) modification_image1 = modification_bitmap1.ConvertToImage() modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH) modification_bitmap2 = modification_image1.ConvertToBitmap() report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20)) self.processPicture(paths[0], "PROGRAM_INSTALL_FULLPATH\\DenseNet-BC-121-32.h5", "PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
Example #8
Source File: MainUI.py From Model-Playgrounds with MIT License | 6 votes |
def launchFileDialog(self, evt): # defining wildcard for suppported picture formats wildcard = "JPEG (*.jpg)|*.jpg|" \ "PNG (*.png)|*.png|" \ "GIF (*.gif)|*.gif" # defining the dialog object dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW) # Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog) if dialog.ShowModal() == wx.ID_OK: self.magic_collection[1].SetValue( "You have selected a Picture. It will now be processed!, Please wait! \nLoading.....") paths = dialog.GetPaths() # This adds the selected picture to the Right region. Right region object is retrieved from UI object array modification_bitmap1 = wx.Bitmap(paths[0]) modification_image1 = modification_bitmap1.ConvertToImage() modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH) modification_bitmap2 = modification_image1.ConvertToBitmap() report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20)) self.processPicture(paths[0], "PROGRAM_INSTALL_FULLPATH\\inception_v3_weights_tf_dim_ordering_tf_kernels.h5", "PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
Example #9
Source File: main.py From wxGlade with MIT License | 6 votes |
def import_xrc(self, infilename=None, ask_save=True): import xrc2wxg if ask_save and not self.ask_save(): return if not infilename: infilename = wx.FileSelector( _("Import file"), wildcard="XRC files (*.xrc)" "|*.xrc|All files|*", flags=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST, default_path=self.cur_dir) if infilename: ibuffer = [] try: xrc2wxg.convert(infilename, ibuffer) # Convert UTF-8 returned by xrc2wxg.convert() to Unicode tmp = b"".join(ibuffer).decode('UTF-8') ibuffer = ['%s\n'%line for line in tmp.split('\n')] self._open_app(ibuffer) common.root.saved = False except Exception as inst: fn = os.path.basename(infilename).encode('ascii', 'replace') bugdialog.Show(_('Import File "%s"') % fn, inst)
Example #10
Source File: configuration_dialogs.py From superpaper with MIT License | 6 votes |
def onChooseTestImage(self, event): """Open a file dialog to choose a test image.""" with wx.FileDialog(self, "Choose a test image", wildcard=("Image files (*.jpg;*.jpeg;*.png;*.bmp;*.gif;*.tiff;*.webp)" "|*.jpg;*.jpeg;*.png;*.bmp;*.gif;*.tiff;*.webp"), defaultDir=self.frame.defdir, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as file_dialog: if file_dialog.ShowModal() == wx.ID_CANCEL: return # the user changed their mind # Proceed loading the file chosen by the user self.test_image = file_dialog.GetPath() self.tc_testimage.SetValue( os.path.basename(self.test_image) ) return
Example #11
Source File: toolbox.py From goreviewpartner with GNU General Public License v3.0 | 5 votes |
def open_all_file(parent,config,filetype): initialdir = grp_config.get(config[0],config[1]) dialog = wx.FileDialog(None,_('Select a file'), defaultDir=initialdir, wildcard=filetype, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) filename = None if dialog.ShowModal() == wx.ID_OK: filename = dialog.GetPath() dialog.Destroy() if filename: initialdir=os.path.dirname(filename) grp_config.set(config[0],config[1],initialdir) return filename
Example #12
Source File: choosers.py From pyFileFixity with MIT License | 5 votes |
def on_button(self, evt): dlg = wx.FileDialog(self.panel, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) result = (dlg.GetPath() if dlg.ShowModal() == wx.ID_OK else None) if result: self.text_box.SetLabelText(result)
Example #13
Source File: DialogUtils.py From kicad_mmccoo with Apache License 2.0 | 5 votes |
def OnButton(self, event): fileDialog = wx.FileDialog(self, "open xyz", defaultDir=ntpath.dirname(self.value), defaultFile=ntpath.basename(self.value), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if (self.wildcard != None): fileDialog.SetWildcard(self.wildcard) if fileDialog.ShowModal() == wx.ID_CANCEL: return self.value = fileDialog.GetPath() self.selectedfile.SetValue(self.value)
Example #14
Source File: main.py From wxGlade with MIT License | 5 votes |
def open_app(self, event=None): """loads a wxGlade project from an xml file NOTE: this is very slow and needs optimisation efforts NOTE2: the note above should not be True anymore :) """ if not self.ask_save(): return default_path = os.path.dirname(common.root.filename or "") or self.cur_dir infile = wx.FileSelector(_("Open file"), wildcard="wxGlade files (*.wxg)|*.wxg|wxGlade Template files (*.wgt)|*.wgt|" "XML files (*.xml)|*.xml|All files|*", flags=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST, default_path=default_path) if not infile: return self._open(infile)
Example #15
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def __init__(self, value="", name=None, min_version=None): self._size = self._warning = self._error = None style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST FileNameProperty.__init__(self, value, style, "", name) self.min_version = min_version
Example #16
Source File: new_properties.py From wxGlade with MIT License | 5 votes |
def __init__(self, value="", name=None, min_version=None): self._size = self._warning = self._error = None style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST self.min_version = min_version FileNameProperty.__init__(self, value, style, '', name)
Example #17
Source File: explorer.py From ImageAnalysis with MIT License | 5 votes |
def get_path(wildcard): app = wx.App(None) style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST dialog = wx.FileDialog(None, 'Open', wildcard=wildcard, style=style) if dialog.ShowModal() == wx.ID_OK: path = dialog.GetPath() else: path = None dialog.Destroy() return path
Example #18
Source File: IDBrowser.py From OpenPLC_Editor with GNU General Public License v3.0 | 5 votes |
def OnImportButton(self, evt): dialog = wx.FileDialog(self, _("Choose a file"), wildcard=_("PSK ZIP files (*.zip)|*.zip"), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if dialog.ShowModal() == wx.ID_OK: self.model.Import(dialog.GetPath(), self.ShouldIReplaceCallback)
Example #19
Source File: make_timelapse.py From Pigrow with GNU General Public License v3.0 | 5 votes |
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))
Example #20
Source File: make_timelapse.py From Pigrow with GNU General Public License v3.0 | 5 votes |
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
Example #21
Source File: chooser.py From Gooey with MIT License | 5 votes |
def getDialog(self): options = self.Parent._options return wx.FileDialog(self, message=options.get('message', _('open_files')), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE, defaultFile=options.get('default_file', _("enter_filename")), defaultDir=options.get('default_dir', _('')), wildcard=options.get('wildcard', wx.FileSelectorDefaultWildcardStr))
Example #22
Source File: chooser.py From Gooey with MIT License | 5 votes |
def getDialog(self): options = self.Parent._options return wx.FileDialog(self, message=options.get('message', _('open_file')), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST, defaultFile=options.get('default_file', _("enter_filename")), defaultDir=options.get('default_dir', _('')), wildcard=options.get('wildcard', wx.FileSelectorDefaultWildcardStr))
Example #23
Source File: chronolapse.py From chronolapse with MIT License | 5 votes |
def fileBrowser(self, message, defaultFile=''): dlg = wx.FileDialog(self, message, defaultFile=defaultFile, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if dlg.ShowModal() == wx.ID_OK: path = dlg.GetPath() else: path = '' dlg.Destroy() return path
Example #24
Source File: widget_pack.py From pyFileFixity with MIT License | 5 votes |
def build_dialog(style, exist_constraint=True, **kwargs): if exist_constraint: return lambda panel: wx.FileDialog(panel, style=style | wx.FD_FILE_MUST_EXIST, **kwargs) else: return lambda panel: wx.FileDialog(panel, style=style, **kwargs)
Example #25
Source File: chooser_runner.py From pyFileFixity with MIT License | 5 votes |
def __init__(self, parent): wx.Frame.__init__(self, parent, title="test", size=(320, 240)) self.SetBackgroundColour('#ffffff') sizer = wx.BoxSizer(wx.VERTICAL) f = wx.FileDialog(self, style=wx.FD_MULTIPLE | wx.FD_FILE_MUST_EXIST) sizer.Add(f, 0, wx.EXPAND) self.SetSizer(sizer)
Example #26
Source File: GoSyncModel.py From gosync with GNU General Public License v2.0 | 5 votes |
def getCredentialFile(self): # ask for the Credential file and save it in Config directory then return True defDir, defFile = '', '' dlg = wx.FileDialog(None, 'Load Credential File', '~', 'Credentials.json', 'json files (*.json)|*.json', wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if dlg.ShowModal() == wx.ID_CANCEL: return False try: shutil.copy(dlg.GetPath(), self.credential_file) return True except: return False
Example #27
Source File: yamled.py From report-ng with GNU General Public License v2.0 | 5 votes |
def File_Open(self, e): openFileDialog = wx.FileDialog(self, 'Open Yaml', '', '', 'Yaml files (*.yaml)|*.yaml|All files (*.*)|*.*', wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if openFileDialog.ShowModal() == wx.ID_CANCEL: return self.File_Close(e) self.Load(openFileDialog.GetPath()) self._stack_adjust()
Example #28
Source File: gui.py From report-ng with GNU General Public License v2.0 | 5 votes |
def Open_Knowledge_Base(self, e): openFileDialog = wx.FileDialog(self, 'Open Knowledge Base', '', '', 'Knowledge Base files (*.yaml; *.json; *.csv)|*.yaml;*.json;*.csv|All files (*.*)|*.*', wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if openFileDialog.ShowModal() == wx.ID_CANCEL: return self._open_kb(openFileDialog.GetPath())
Example #29
Source File: gui.py From report-ng with GNU General Public License v2.0 | 5 votes |
def Open_Scan(self, e): openFileDialog = wx.FileDialog(self, 'Open Scan', '', '', 'Scan files (*.xml; *.yaml; *.json)|*.xml;*.yaml;*.json|All files (*.*)|*.*', wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if openFileDialog.ShowModal() == wx.ID_CANCEL: return self._open_scan(openFileDialog.GetPath())
Example #30
Source File: gui.py From report-ng with GNU General Public License v2.0 | 5 votes |
def Open_Content(self, e): openFileDialog = wx.FileDialog(self, 'Open Content', '', '', 'Content files (*.yaml; *.json)|*.yaml;*.json|All files (*.*)|*.*', wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if openFileDialog.ShowModal() == wx.ID_CANCEL: return self._open_content(openFileDialog.GetPath())