From 27b13b5b0c42262ae7744c3d589810822f66b534 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 19 Feb 2007 21:17:27 +0000 Subject: [PATCH] Add wx.DD_DIR_MUST_EXIST style. (Patch #1662736) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/demo/DirDialog.py | 5 ++++- wxPython/src/_cmndlgs.i | 13 ++++++++----- wxPython/wx/lib/filebrowsebutton.py | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/wxPython/demo/DirDialog.py b/wxPython/demo/DirDialog.py index c1b1c2a433..eed1be3beb 100644 --- a/wxPython/demo/DirDialog.py +++ b/wxPython/demo/DirDialog.py @@ -15,7 +15,10 @@ class TestPanel(wx.Panel): def OnButton(self, evt): # In this case we include a "New directory" button. dlg = wx.DirDialog(self, "Choose a directory:", - style=wx.DD_DEFAULT_STYLE|wx.DD_NEW_DIR_BUTTON) + style=wx.DD_DEFAULT_STYLE + #| wx.DD_DIR_MUST_EXIST + #| wx.DD_CHANGE_DIR + ) # If the user selects OK, then we process the dialog's data. # This is done by getting the path data from the dialog - BEFORE diff --git a/wxPython/src/_cmndlgs.i b/wxPython/src/_cmndlgs.i index f488af7ecb..3204c12b7a 100644 --- a/wxPython/src/_cmndlgs.i +++ b/wxPython/src/_cmndlgs.i @@ -113,9 +113,10 @@ wxColour wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL, //-------------------------------------------------------------------------------- enum { + wxDD_CHANGE_DIR, + wxDD_DIR_MUST_EXIST, wxDD_NEW_DIR_BUTTON, wxDD_DEFAULT_STYLE, - wxDD_CHANGE_DIR, }; DocStr(wxDirDialog, @@ -129,10 +130,12 @@ Window Styles wx.DEFAULT_DIALOG_STYLE, wx.DD_NEW_DIR_BUTTON and wx.RESIZE_BORDER. - wx.DD_NEW_DIR_BUTTON Add 'Create new directory' button and allow - directory names to be editable. On Windows - the new directory button is only available - with recent versions of the common dialogs. + wx.DD_DIR_MUST_EXIST The dialog will allow the user to choose only an + existing folder. When this style is not given, a + 'Create new directory' button is added to the dialog + (on Windows) or some other way is provided to the + user to type the name of a new folder. + Use this instead of deprecated wx.DD_NEW_DIR_BUTTON. wx.DD_CHANGE_DIR Change the current working directory to the directory chosen by the user. diff --git a/wxPython/wx/lib/filebrowsebutton.py b/wxPython/wx/lib/filebrowsebutton.py index e2e829da02..8031732077 100644 --- a/wxPython/wx/lib/filebrowsebutton.py +++ b/wxPython/wx/lib/filebrowsebutton.py @@ -351,8 +351,8 @@ class DirBrowseButton(FileBrowseButton): def OnBrowse(self, ev = None): style=0 - if self.newDirectory: - style|=wx.DD_NEW_DIR_BUTTON + if not self.newDirectory: + style |= wx.DD_DIR_MUST_EXIST dialog = self.dialogClass(self, message = self.dialogTitle,