]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/FileBrowseButton.py
Applied TRUE/FALSE fix here too.
[wxWidgets.git] / wxPython / demo / FileBrowseButton.py
... / ...
CommitLineData
1""" Demonstrate filebrowsebutton module of the wxPython.lib Library.
2
314.1.2001 Bernhard Reiter <bernhard@intevation.de>
4 Added demo for DirBrowseButton and improved overview text.
5"""
6from wxPython.wx import *
7from wxPython.lib.filebrowsebutton import FileBrowseButton, FileBrowseButtonWithHistory,DirBrowseButton
8
9
10#----------------------------------------------------------------------
11
12class TestPanel(wxPanel):
13 def __init__(self, parent, ID, log):
14 wxPanel.__init__(self, parent, ID)
15 self.log = log
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),
19 wxSize(450, -1),
20 #changeCallback = self.fbbhCallback
21 )
22 self.dbb = DirBrowseButton(self, -1, wxPoint(20,80), wxSize(450,-1),
23 changeCallback = self.dbbCallback)
24
25
26 self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'file', 'names', 'here'])
27
28
29 def fbbCallback(self, evt):
30 self.log.write('FileBrowseButton: %s\n' % evt.GetString())
31
32
33
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()
39 history.append(value)
40 self.fbbh.SetHistory(history)
41
42 def dbbCallback(self, evt):
43 self.log.write('DirBrowseButton: %s\n' % evt.GetString())
44
45
46
47#----------------------------------------------------------------------
48
49def runTest(frame, nb, log):
50 win = TestPanel(nb, -1, log)
51 return win
52
53
54
55#----------------------------------------------------------------------
56
57overview = """<html><body>
58<h2>class FileBrowseButton:</h2>
59<small><pre>
60%s
61</pre></small>
62
63<h2>class FileBrowseButtonWithHistory(FileBrowseButton):</h2>
64<small><pre>
65%s
66</pre></small>
67
68<h2>class DirBrowseButton(FileBrowseButton):</h2>
69<small><pre>
70%s
71</pre></small>
72
73</body><</html>
74""" % ( FileBrowseButton.__doc__,
75 FileBrowseButtonWithHistory.__doc__ ,
76 str(DirBrowseButton.__doc__) )