Python wx.DD_NEW_DIR_BUTTON Examples

The following are 8 code examples of wx.DD_NEW_DIR_BUTTON(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: ProjectController.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #2
Source File: watermarkdlg.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
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() 
Example #3
Source File: cfgdlg.py    From trelby with GNU General Public License v2.0 5 votes vote down vote up
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() 
Example #4
Source File: networkedit.py    From CANFestivino with GNU Lesser General Public License v2.1 5 votes vote down vote up
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() 
Example #5
Source File: preferencesdialog.py    From wxGlade with MIT License 5 votes vote down vote up
def on_widget_path(self, event):
        "Create a file choice dialog"
        pth = wx.DirSelector(_("Choose a directory:"), os.getcwd(), style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON)
        if pth:
            self.local_widget_path.SetValue(pth)

# end of class wxGladePreferences 
Example #6
Source File: application.py    From wxGlade with MIT License 5 votes vote down vote up
def __init__(self, parent, wildcard=_("All files|*"), file_message=_("Choose a file"),dir_message=None,file_style=0):
        self.prev_dir = config.preferences.codegen_path or ""
        self.wildcard = wildcard
        self.file_message = file_message
        self.dir_message = dir_message
        self.file_style = file_style
        self.dir_style = wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON
        self.parent = parent
        self.value = None
        self.default_extension = None 
Example #7
Source File: GUI_utils.py    From topoflow with MIT License 5 votes vote down vote up
def Get_Directory():

    dialog = wx.DirDialog(None, "Choose a directory:", \
                          style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON)
    if (dialog.ShowModal() == wx.ID_OK):
        directory = dialog.GetPath()
    else:
        directory = None
    dialog.Destroy()
    
    return directory
    
#   Get_Directory()
#---------------------------------------------------------------- 
Example #8
Source File: Beremiz_service.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def OnTaskBarChangeWorkingDir(self, evt):
                dlg = wx.DirDialog(None, _("Choose a working directory "), self.pyroserver.workdir, wx.DD_NEW_DIR_BUTTON)
                if dlg.ShowModal() == wx.ID_OK:
                    self.pyroserver.workdir = dlg.GetPath()
                    self.pyroserver.Restart()