本文整理汇总了Python中wx.DirDialog方法的典型用法代码示例。如果您正苦于以下问题:Python wx.DirDialog方法的具体用法?Python wx.DirDialog怎么用?Python wx.DirDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.DirDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: of
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def of(self, event): # wxGlade: MainFrame.<event_handler>
filename = "" # Use filename as a flag
dlg = wx.DirDialog(self, message="Choose a folder")
if dlg.ShowModal() == wx.ID_OK:
dirname = dlg.GetPath()
dlg.Destroy()
self.texts.append("")
if dirname:
for(root, dirs, files) in os.walk(dirname):
for f in files:
with open(root + "/" + f, "rb") as fh:
fi = fh.read()[512:]
l_off = len(fi) % 512
self.texts[0] += fi + "\x00"*(512-l_off)
#self.texts.append(fh.read())
示例2: dirBrowser
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def dirBrowser(self, message, defaultpath):
# show dir dialog
dlg = wx.DirDialog(
self, message=message,
defaultPath= defaultpath,
style=wx.DD_DEFAULT_STYLE)
# Show the dialog and retrieve the user response.
if dlg.ShowModal() == wx.ID_OK:
# load directory
path = dlg.GetPath()
else:
path = ''
# Destroy the dialog.
dlg.Destroy()
return path
示例3: select_file
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [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
#=================================================================
示例4: onBrowseFolder
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def onBrowseFolder(self, event=None):
defdir = self.txt_folder.GetValue()
if defdir in ('', 'Desktop'):
defdir = DESKTOP
dlg = wx.DirDialog(self,
message='Select Folder for Shortcut',
defaultPath=defdir,
style = wx.DD_DEFAULT_STYLE)
if dlg.ShowModal() == wx.ID_OK:
folder = os.path.abspath(dlg.GetPath())
desktop = DESKTOP
if folder.startswith(desktop):
folder.replace(desktop, '')
if folder.startswith('/'):
folder = folder[1:]
self.txt_folder.SetValue(folder)
dlg.Destroy()
示例5: SaveProjectAs
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def SaveProjectAs(self):
# Ask user to choose a path with write permissions
if wx.Platform == '__WXMSW__':
path = os.getenv("USERPROFILE")
else:
path = os.getenv("HOME")
dirdialog = wx.DirDialog(
self.AppFrame, _("Choose a directory to save project"), path, wx.DD_NEW_DIR_BUTTON)
answer = dirdialog.ShowModal()
dirdialog.Destroy()
if answer == wx.ID_OK:
newprojectpath = dirdialog.GetPath()
if os.path.isdir(newprojectpath):
if self.CheckNewProjectPath(self.ProjectPath, newprojectpath):
self.ProjectPath, old_project_path = newprojectpath, self.ProjectPath
self.SaveProject(old_project_path)
self._setBuildPath(self.BuildPath)
return True
return False
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def __init__(self, parent, *args, **kwargs):
wx.DirDialog.__init__(self, parent, 'Select Directory', style=wx.DD_DEFAULT_STYLE)
示例7: OnBrowse
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def OnBrowse(self, event):
dlg = wx.DirDialog(
self.frame, style = wx.DD_NEW_DIR_BUTTON)
if dlg.ShowModal() == wx.ID_OK:
self.dirEntry.SetValue(dlg.GetPath())
dlg.Destroy()
示例8: OnBrowse
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def OnBrowse(self, event):
dlg = wx.DirDialog(
cfgFrame, defaultPath = self.cfg.scriptDir,
style = wx.DD_NEW_DIR_BUTTON)
if dlg.ShowModal() == wx.ID_OK:
self.scriptDirEntry.SetValue(dlg.GetPath())
dlg.Destroy()
示例9: OnChangeMirror
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def OnChangeMirror(self, event):
new_dir_help = "Your new local mirror directory is set. This will take effect after GoSync restart.\n\nPlease note that GoSync hasn't moved your files from old location. You would need to copy or move your current directory to new location before restarting GoSync."
dlg = wx.DirDialog(None, "Choose target directory", "",
wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST)
if dlg.ShowModal() == wx.ID_OK:
self.sync_model.SetLocalMirrorDirectory(dlg.GetPath())
resp = wx.MessageBox(new_dir_help, "IMPORTANT INFORMATION", (wx.OK | wx.ICON_WARNING))
self.md.SetLabel(self.sync_model.GetLocalMirrorDirectory())
dlg.Destroy()
示例10: set_blockchain_directory
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def set_blockchain_directory(self, event):
"""Set the path to the blockchain data directory."""
defaultPath = os.path.join(os.getenv("APPDATA"), "Bitcoin")
dialog = wx.DirDialog(self,
_("Select path to blockchain"),
defaultPath=defaultPath,
style=wx.DD_DIR_MUST_EXIST)
if dialog.ShowModal() == wx.ID_OK:
path = dialog.GetPath()
if os.path.exists(path):
self.blockchain_directory = path
dialog.Destroy()
示例11: get_path
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def get_path(self, dlg):
if isinstance(dlg, wx.DirDialog):
return maybe_quote(dlg.GetPath())
else:
paths = dlg.GetPaths()
return maybe_quote(paths[0]) if len(paths) < 2 else ' '.join(map(maybe_quote, paths))
示例12: on_button
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def on_button(self, evt):
dlg = wx.DirDialog(self.panel, 'Select directory', style=wx.DD_DEFAULT_STYLE)
result = (dlg.GetPath()
if dlg.ShowModal() == wx.ID_OK
else None)
if result:
self.text_box.SetLabelText(result)
示例13: getDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def getDialog(self):
options = self.Parent._options
return wx.DirDialog(self, message=options.get('message', _('choose_folder')),
defaultPath=options.get('default_path', os.getcwd()))
示例14: _on_savepath
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def _on_savepath(self, event):
dlg = wx.DirDialog(self, self.CHOOSE_DIRECTORY, self._path_combobox.GetStringSelection())
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
self._path_combobox.Append(path)
self._path_combobox.SetValue(path)
self._update_savepath(None)
dlg.Destroy()
示例15: OnNewProjectMenu
# 需要导入模块: import wx [as 别名]
# 或者: from wx import DirDialog [as 别名]
def OnNewProjectMenu(self, event):
if self.NodeList:
defaultpath = os.path.dirname(self.NodeList.GetRoot())
else:
defaultpath = os.getcwd()
dialog = wx.DirDialog(self , _("Choose a project"), defaultpath, wx.DD_NEW_DIR_BUTTON)
if dialog.ShowModal() == wx.ID_OK:
projectpath = dialog.GetPath()
if os.path.isdir(projectpath) and len(os.listdir(projectpath)) == 0:
manager = NodeManager()
nodelist = NodeList(manager)
result = nodelist.LoadProject(projectpath)
if not result:
self.Manager = manager
self.NodeList = nodelist
self.NodeList.SetCurrentSelected(0)
self.RefreshNetworkNodes()
self.RefreshBufferState()
self.RefreshTitle()
self.RefreshProfileMenu()
self.RefreshMainMenu()
else:
message = wx.MessageDialog(self, result, _("ERROR"), wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()