本文整理汇总了Python中wx.FD_OPEN属性的典型用法代码示例。如果您正苦于以下问题:Python wx.FD_OPEN属性的具体用法?Python wx.FD_OPEN怎么用?Python wx.FD_OPEN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.FD_OPEN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __on_open
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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: OnLoadMesh
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [as 别名]
def OnLoadMesh(self, evt):
dlg = wx.FileDialog(self, "Choose a file", ".", "", "OFF files (*.off)|*.off|TOFF files (*.toff)|*.toff|OBJ files (*.obj)|*.obj", wx.FD_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.clearAllSelections()
self.glcanvas.Refresh()
dlg.Destroy()
return
示例3: _buttonLoadCardDataOnButtonClick
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [as 别名]
def _buttonLoadCardDataOnButtonClick(self, event):
# Open file dialog;
saveFileDialog = wx.FileDialog(self, "Load data from file ...", "", "", "All files (*.*)|*.*", wx.FD_OPEN)
if saveFileDialog.ShowModal() == wx.ID_CANCEL:
return
file_path_name = saveFileDialog.GetPath()
# Read card data from file;
with open(file_path_name, 'rb') as f:
card_data = f.read()
if len(card_data) != 1024:
self._Log('Invalid card data.', wx.LOG_Error)
return
# Set card data to Grid;
for row_index in range(self._gridCardData.GetNumberRows()):
for col_index in range(self._gridCardData.GetNumberCols()):
self._gridCardData.SetCellValue(row_index, col_index, '%02X' % (ord(card_data[row_index * 0x10 + col_index])))
self._Log('Card data has been loaded from file: %s.' % (file_path_name), wx.LOG_Info)
return
示例4: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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")
示例5: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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")
示例6: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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")
示例7: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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")
示例8: onChooseTestImage
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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
示例9: on_open
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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())
示例10: select_file
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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
#=================================================================
示例11: import_xrc
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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)
示例12: _select_bitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [as 别名]
def _select_bitmap(self, event, colname, title):
control = getattr(self, colname)
current = control.GetValue()
directory = os.path.split(current)
if os.path.isdir(current):
directory = current
current = ''
elif directory and os.path.isdir(directory[0]):
current = directory[1]
directory = directory [0]
elif common.root.filename:
#directory = self.startDirectory
directory = common.root.filename
current = ""
else:
directory = ""
value = misc.RelativeFileSelector(title, directory, current, wildcard="*.*", flags=wx.FD_OPEN)
if value:
control.SetValue(value)
示例13: onBrowseScript
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [as 别名]
def onBrowseScript(self, event=None):
wildcards = "%s|%s" % (PY_FILES, ALL_FILES)
dlg = wx.FileDialog(self, message='Select Python Script file',
wildcard=wildcards,
style=wx.FD_OPEN)
if dlg.ShowModal() == wx.ID_OK:
path = os.path.abspath(dlg.GetPath())
self.txt_script.SetValue(path)
_, name = os.path.split(path)
name = fix_filename(name)
if name.endswith('.py'):
name = name[:-3]
txt_name = self.txt_name.GetValue().strip()
if len(txt_name) < 1:
self.txt_name.SetValue(name)
txt_desc = self.txt_desc.GetValue().strip()
if len(txt_desc) < 1:
self.txt_desc.SetValue(name)
dlg.Destroy()
示例14: OnButton
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [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()
示例15: method_load_file
# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OPEN [as 别名]
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.FD_OPEN|wx.FD_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 %s'
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 %s'
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()