當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。