]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/FileBrowseButton.py
reSWIGged
[wxWidgets.git] / wxPython / demo / FileBrowseButton.py
CommitLineData
8fa876ca
RD
1# 11/7/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2#
3# o Updated for wx namespace
4# o Uncommented fbbhCallback in TestPanel.fbbh init. Appears to work fine.
5# Wonder why it was commented.
6# o Unrelated: TestPanel.dbb appears to cause a program error in the demo. If
7# it is commented out, everything works fine. Investigating.
8# o Bernhard has responded to query, does not plan on updating demo.
9#
10# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
11#
12# o All issues, including the program error, have gone away in V2.5.
13#
14
1b62f00d 15""" Demonstrate filebrowsebutton module of the wxPython.lib Library.
f6bcfd97 16
1b62f00d
RD
1714.1.2001 Bernhard Reiter <bernhard@intevation.de>
18 Added demo for DirBrowseButton and improved overview text.
19"""
f6bcfd97 20
8fa876ca
RD
21import wx
22import wx.lib.filebrowsebutton as filebrowse
f6bcfd97
BP
23
24#----------------------------------------------------------------------
25
8fa876ca 26class TestPanel(wx.Panel):
f6bcfd97 27 def __init__(self, parent, ID, log):
8fa876ca 28 wx.Panel.__init__(self, parent, ID)
f6bcfd97 29 self.log = log
1b62f00d 30
8fa876ca
RD
31 self.fbb = filebrowse.FileBrowseButton(
32 self, -1, (20, 20), (450, -1), changeCallback = self.fbbCallback
33 )
34
35 self.fbbh = filebrowse.FileBrowseButtonWithHistory(
36 self, -1, (20, 50), (450, -1), changeCallback = self.fbbhCallback
37 )
38
39 self.dbb = filebrowse.DirBrowseButton(
40 self, -1, (20, 80), (450, -1), changeCallback = self.dbbCallback
41 )
f6bcfd97
BP
42
43 self.fbbh.SetHistory(['You', 'can', 'put', 'some', 'file', 'names', 'here'])
44
45
46 def fbbCallback(self, evt):
47 self.log.write('FileBrowseButton: %s\n' % evt.GetString())
48
49
50 def fbbhCallback(self, evt):
51 if hasattr(self, 'fbbh'):
52 value = evt.GetString()
53 self.log.write('FileBrowseButtonWithHistory: %s\n' % value)
54 history = self.fbbh.GetHistory()
55 history.append(value)
56 self.fbbh.SetHistory(history)
57
8fa876ca 58
1b62f00d
RD
59 def dbbCallback(self, evt):
60 self.log.write('DirBrowseButton: %s\n' % evt.GetString())
61
62
f6bcfd97
BP
63#----------------------------------------------------------------------
64
65def runTest(frame, nb, log):
66 win = TestPanel(nb, -1, log)
67 return win
68
69
f6bcfd97
BP
70#----------------------------------------------------------------------
71
1b62f00d
RD
72overview = """<html><body>
73<h2>class FileBrowseButton:</h2>
74<small><pre>
75%s
76</pre></small>
77
78<h2>class FileBrowseButtonWithHistory(FileBrowseButton):</h2>
79<small><pre>
80%s
81</pre></small>
82
83<h2>class DirBrowseButton(FileBrowseButton):</h2>
84<small><pre>
85%s
86</pre></small>
87
88</body><</html>
8fa876ca
RD
89""" % ( filebrowse.FileBrowseButton.__doc__,
90 filebrowse.FileBrowseButtonWithHistory.__doc__ ,
91 filebrowse.DirBrowseButton.__doc__
92 )
1fded56b
RD
93
94
95if __name__ == '__main__':
96 import sys,os
97 import run
98 run.main(['', os.path.basename(sys.argv[0])])
99