]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/FileBrowseButton.py
Added export decl
[wxWidgets.git] / wxPython / demo / FileBrowseButton.py
1
2 """ Demonstrate filebrowsebutton module of the wxPython.lib Library.
3
4 14.1.2001 Bernhard Reiter <bernhard@intevation.de>
5 Added demo for DirBrowseButton and improved overview text.
6 """
7
8 import wx
9 import wx.lib.filebrowsebutton as filebrowse
10
11 #----------------------------------------------------------------------
12
13 class TestPanel(wx.Panel):
14 def __init__(self, parent, ID, log):
15 wx.Panel.__init__(self, parent, ID)
16 self.log = log
17
18 self.fbb = filebrowse.FileBrowseButton(
19 self, -1, (20, 20), (450, -1), changeCallback = self.fbbCallback
20 )
21
22 self.fbbh = filebrowse.FileBrowseButtonWithHistory(
23 self, -1, (20, 50), (450, -1), changeCallback = self.fbbhCallback
24 )
25
26 self.dbb = filebrowse.DirBrowseButton(
27 self, -1, (20, 80), (450, -1), changeCallback = self.dbbCallback
28 )
29
30 self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'file', 'names', 'here'])
31
32
33 def fbbCallback(self, evt):
34 self.log.write('FileBrowseButton: %s\n' % evt.GetString())
35
36
37 def fbbhCallback(self, evt):
38 if hasattr(self, 'fbbh'):
39 value = evt.GetString()
40 self.log.write('FileBrowseButtonWithHistory: %s\n' % value)
41 history = self.fbbh.GetHistory()
42 history.append(value)
43 self.fbbh.SetHistory(history)
44
45
46 def dbbCallback(self, evt):
47 self.log.write('DirBrowseButton: %s\n' % evt.GetString())
48
49
50 #----------------------------------------------------------------------
51
52 def runTest(frame, nb, log):
53 win = TestPanel(nb, -1, log)
54 return win
55
56
57 #----------------------------------------------------------------------
58
59 overview = """<html><body>
60 <h2>class FileBrowseButton:</h2>
61 <small><pre>
62 %s
63 </pre></small>
64
65 <h2>class FileBrowseButtonWithHistory(FileBrowseButton):</h2>
66 <small><pre>
67 %s
68 </pre></small>
69
70 <h2>class DirBrowseButton(FileBrowseButton):</h2>
71 <small><pre>
72 %s
73 </pre></small>
74
75 </body><</html>
76 """ % ( filebrowse.FileBrowseButton.__doc__,
77 filebrowse.FileBrowseButtonWithHistory.__doc__ ,
78 filebrowse.DirBrowseButton.__doc__
79 )
80
81
82 if __name__ == '__main__':
83 import sys,os
84 import run
85 run.main(['', os.path.basename(sys.argv[0])])
86