当前位置: 首页>>代码示例>>Python>>正文


Python wx.DirDialog方法代码示例

本文整理汇总了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()) 
开发者ID:c3c,项目名称:E-Safenet,代码行数:18,代码来源:esafenet_gui.py

示例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 
开发者ID:collingreen,项目名称:chronolapse,代码行数:20,代码来源:chronolapse.py

示例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


#================================================================= 
开发者ID:ikreymer,项目名称:webarchiveplayer,代码行数:21,代码来源:archiveplayer.py

示例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() 
开发者ID:newville,项目名称:pyshortcuts,代码行数:20,代码来源:wxgui.py

示例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 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:21,代码来源:ProjectController.py

示例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) 
开发者ID:ME-ICA,项目名称:me-ica,代码行数:4,代码来源:widget_pack.py

示例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() 
开发者ID:trelby,项目名称:trelby,代码行数:10,代码来源:watermarkdlg.py

示例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() 
开发者ID:trelby,项目名称:trelby,代码行数:11,代码来源:cfgdlg.py

示例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() 
开发者ID:hschauhan,项目名称:gosync,代码行数:14,代码来源:GoSyncSettingPage.py

示例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() 
开发者ID:theRealTacoTime,项目名称:poclbm,代码行数:14,代码来源:guiminer.py

示例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)) 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:8,代码来源:widget_pack.py

示例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) 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:9,代码来源:choosers.py

示例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())) 
开发者ID:chriskiehl,项目名称:Gooey,代码行数:6,代码来源:chooser.py

示例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() 
开发者ID:MrS0m30n3,项目名称:youtube-dl-gui,代码行数:13,代码来源:mainframe.py

示例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() 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:28,代码来源:networkedit.py


注:本文中的wx.DirDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。