1 """ Demonstrate filebrowsebutton module of the wxPython.lib Library. 
   3 14.1.2001 Bernhard Reiter <bernhard@intevation.de> 
   4     Added demo for DirBrowseButton and improved overview text. 
   6 from wxPython
.wx 
import * 
   7 from wxPython
.lib
.filebrowsebutton 
import FileBrowseButton
, FileBrowseButtonWithHistory
,DirBrowseButton
 
  10 #---------------------------------------------------------------------- 
  12 class TestPanel(wxPanel
): 
  13     def __init__(self
, parent
, ID
, log
): 
  14         wxPanel
.__init
__(self
, parent
, ID
) 
  16         self
.fbb 
= FileBrowseButton(self
, -1, wxPoint(20,20), wxSize(450, -1), 
  17                                     changeCallback 
= self
.fbbCallback
) 
  18         self
.fbbh 
= FileBrowseButtonWithHistory(self
, -1, wxPoint(20, 50), 
  20                                                 #changeCallback = self.fbbhCallback 
  22         self
.dbb 
= DirBrowseButton(self
, -1, wxPoint(20,80), wxSize(450,-1), 
  23                                     changeCallback 
= self
.dbbCallback
) 
  26         self
.fbbh
.SetHistory(['You', 'can', 'put', 'some', 'file', 'names', 'here']) 
  29     def fbbCallback(self
, evt
): 
  30         self
.log
.write('FileBrowseButton: %s\n' % evt
.GetString()) 
  34     def fbbhCallback(self
, evt
): 
  35         if hasattr(self
, 'fbbh'): 
  36             value 
= evt
.GetString() 
  37             self
.log
.write('FileBrowseButtonWithHistory: %s\n' % value
) 
  38             history 
= self
.fbbh
.GetHistory() 
  40             self
.fbbh
.SetHistory(history
) 
  42     def dbbCallback(self
, evt
): 
  43         self
.log
.write('DirBrowseButton: %s\n' % evt
.GetString()) 
  47 #---------------------------------------------------------------------- 
  49 def runTest(frame
, nb
, log
): 
  50     win 
= TestPanel(nb
, -1, log
) 
  55 #---------------------------------------------------------------------- 
  57 overview 
= """<html><body> 
  58 <h2>class FileBrowseButton:</h2> 
  63 <h2>class FileBrowseButtonWithHistory(FileBrowseButton):</h2> 
  68 <h2>class DirBrowseButton(FileBrowseButton):</h2> 
  74 """ % ( FileBrowseButton
.__doc
__, 
  75         FileBrowseButtonWithHistory
.__doc
__ , 
  76         str(DirBrowseButton
.__doc
__) )