From c1e820a40eed983ceb9e17a3d387dea707e31525 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 26 Mar 2001 22:15:33 +0000 Subject: [PATCH] a fix for the last fix git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/wxPython/lib/filebrowsebutton.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/wxPython/wxPython/lib/filebrowsebutton.py b/wxPython/wxPython/lib/filebrowsebutton.py index 1b725287eb..395655700c 100644 --- a/wxPython/wxPython/lib/filebrowsebutton.py +++ b/wxPython/wxPython/lib/filebrowsebutton.py @@ -81,6 +81,7 @@ class FileBrowseButton(wxPanel): # SetValue is used to disable the callback self.SetValue( initialValue, 0) + def createDialog( self, parent, id, pos, size, style ): """Setup the graphic representation of the dialog""" wxPanel.__init__ (self, parent, id, pos, size, style) @@ -134,7 +135,7 @@ class FileBrowseButton(wxPanel): return textControl def OnChanged(self, evt): - if self.callCallback: + if self.callCallback and self.changeCallback: self.changeCallback(evt) def createBrowseButton( self): @@ -161,14 +162,13 @@ class FileBrowseButton(wxPanel): dlg = wxFileDialog(self, self.dialogTitle, directory, current, self.fileMask, self.fileMode) if dlg.ShowModal() == wxID_OK: - self.SetValue (dlg.GetPath()) + self.SetValue(dlg.GetPath()) dlg.Destroy() - def GetValue (self): """ Convenient access to text control value """ - return self.textControl.GetValue () + return self.textControl.GetValue() def SetValue (self, value, callBack=1): """ Convenient setting of text control value """ @@ -196,6 +196,7 @@ class FileBrowseButton(wxPanel): + class FileBrowseButtonWithHistory( FileBrowseButton ): """ with following additions: __init__(..., history=None) @@ -230,6 +231,7 @@ class FileBrowseButtonWithHistory( FileBrowseButton ): self.history=None apply( FileBrowseButton.__init__, ( self,)+arguments, namedarguments) + def createTextControl( self): """Create the text control""" ID = wxNewId() @@ -245,6 +247,7 @@ class FileBrowseButtonWithHistory( FileBrowseButton ): self.SetHistory( history, control=textControl) return textControl + def GetHistoryControl( self ): """Return a pointer to the control which provides (at least) the following methods for manipulating the history list.: @@ -256,6 +259,7 @@ class FileBrowseButtonWithHistory( FileBrowseButton ): """ return self.textControl + def SetHistory( self, value=(), selectionIndex = None, control=None ): """Set the current history list""" if control is None: @@ -274,6 +278,7 @@ class FileBrowseButtonWithHistory( FileBrowseButton ): if selectionIndex is not None: control.SetSelection( selectionIndex ) + def GetHistory( self ): """Return the current history list""" if self.historyCallBack != None: @@ -281,12 +286,14 @@ class FileBrowseButtonWithHistory( FileBrowseButton ): else: return list( self.history ) + def OnSetFocus(self, event): """When the history scroll is selected, update the history""" if self.historyCallBack != None: self.SetHistory( self.historyCallBack(), control=self.textControl) event.Skip() + if wxPlatform == "__WXMSW__": def SetValue (self, value, callBack=1): """ Convenient setting of text control value, works -- 2.45.2