本文整理汇总了Python中wx.FD_FILE_MUST_EXIST属性的典型用法代码示例。如果您正苦于以下问题:Python wx.FD_FILE_MUST_EXIST属性的具体用法?Python wx.FD_FILE_MUST_EXIST怎么用?Python wx.FD_FILE_MUST_EXIST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.FD_FILE_MUST_EXIST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __on_open
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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()
示例2: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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")
示例3: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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")
示例4: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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")
示例5: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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")
示例6: onChooseTestImage
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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
示例7: on_open
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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())
示例8: select_file
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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
#=================================================================
示例9: import_xrc
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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)
示例10: OnButton
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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()
示例11: _wx_get_path
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
def _wx_get_path(self):
app = wx.App(None)
style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST
dialog = wx.FileDialog(None, self.title, defaultDir=self.start_dir, wildcard='GCode files|*.g;*.gcode;*.nc;*.gc;*.ngc|All Files|*', style=style)
if dialog.ShowModal() == wx.ID_OK:
path = dialog.GetPath()
else:
path = None
dialog.Destroy()
return path
示例12: build_dialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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)
示例13: Open_Template
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
def Open_Template(self, e):
openFileDialog = wx.FileDialog(self, 'Open Template', '', '', 'XML files (*.xml)|*.xml|All files (*.*)|*.*',
wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
if openFileDialog.ShowModal() == wx.ID_CANCEL:
return
self._open_template(openFileDialog.GetPath())
示例14: Open_Content
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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())
示例15: Open_Scan
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_FILE_MUST_EXIST [as 别名]
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())