]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/filebrowsebutton.py
compilation fix after removing wxImage(wxImage *) ctor
[wxWidgets.git] / wxPython / wx / lib / filebrowsebutton.py
index 2da119cfbc5f006a99c17cac27b83b55ad1b2af7..0620161d112d03ea2c4d20da5c5b0fb1bb24c14e 100644 (file)
@@ -68,12 +68,6 @@ class FileBrowseButton(wx.Panel):
         self.callCallback = True
 
 
-        # get background to match it
-        try:
-            self._bc = parent.GetBackgroundColour()
-        except:
-            pass
-
         # create the dialog
         self.createDialog(parent, id, pos, size, style )
         # Setting a value causes the changeCallback to be called.
@@ -88,12 +82,6 @@ class FileBrowseButton(wx.Panel):
         wx.Panel.__init__ (self, parent, id, pos, size, style)
         self.SetMinSize(size) # play nice with sizers
 
-        # try to set the background colour
-        try:
-            self.SetBackgroundColour(self._bc)
-        except:
-            pass
-
         box = wx.BoxSizer(wx.HORIZONTAL)
 
         self.label = self.createLabel( )
@@ -254,8 +242,8 @@ class FileBrowseButtonWithHistory( FileBrowseButton ):
         textControl.SetToolTipString( self.toolTip )
         textControl.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
         if self.changeCallback:
-            textControl.Bind(wx.EVT_TEXT, self.changeCallback)
-            textControl.Bind(wx.EVT_COMBOBOX, self.changeCallback)
+            textControl.Bind(wx.EVT_TEXT, self.OnChanged)
+            textControl.Bind(wx.EVT_COMBOBOX, self.OnChanged)
         if self.history:
             history=self.history
             self.history=None
@@ -301,8 +289,10 @@ class FileBrowseButtonWithHistory( FileBrowseButton ):
         """Return the current history list"""
         if self.historyCallBack != None:
             return self.historyCallBack()
-        else:
+        elif self.history:
             return list( self.history )
+        else:
+            return []
 
 
     def OnSetFocus(self, event):
@@ -343,18 +333,27 @@ class DirBrowseButton(FileBrowseButton):
                  dialogTitle = '',
                  startDirectory = '.',
                  changeCallback = None,
-                 dialogClass = wx.DirDialog):
+                 dialogClass = wx.DirDialog,
+                 newDirectory = False):
         FileBrowseButton.__init__(self, parent, id, pos, size, style,
                                   labelText, buttonText, toolTip,
                                   dialogTitle, startDirectory,
                                   changeCallback = changeCallback)
         self.dialogClass = dialogClass
+        self.newDirectory = newDirectory
     #
 
     def OnBrowse(self, ev = None):
+        style=0
+
+        if self.newDirectory:
+          style|=wx.DD_NEW_DIR_BUTTON
+
         dialog = self.dialogClass(self,
                                   message = self.dialogTitle,
-                                  defaultPath = self.startDirectory)
+                                  defaultPath = self.startDirectory,
+                                  style = style)
+
         if dialog.ShowModal() == wx.ID_OK:
             self.SetValue(dialog.GetPath())
         dialog.Destroy()