]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/GenericDirCtrl.py
To use "#pragma warning" a #ifdef __VISUALC__ guard should be used, not a #ifdef...
[wxWidgets.git] / wxPython / demo / GenericDirCtrl.py
1 # 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 #
5
6 import wx
7
8 #----------------------------------------------------------------------
9
10 class TestPanel(wx.Panel):
11 def __init__(self, parent, log):
12 wx.Panel.__init__(self, parent, -1)
13 self.log = log
14
15 txt1 = wx.StaticText(self, -1, "style=0")
16 dir1 = wx.GenericDirCtrl(self, -1, size=(200,225), style=0)
17
18 txt2 = wx.StaticText(self, -1, "wx.DIRCTRL_DIR_ONLY")
19 dir2 = wx.GenericDirCtrl(self, -1, size=(200,225), style=wx.DIRCTRL_DIR_ONLY)
20
21 txt3 = wx.StaticText(self, -1, "wx.DIRCTRL_SHOW_FILTERS")
22 dir3 = wx.GenericDirCtrl(self, -1, size=(200,225), style=wx.DIRCTRL_SHOW_FILTERS,
23 filter="All files (*.*)|*.*|Python files (*.py)|*.py")
24
25 sz = wx.FlexGridSizer(cols=3, hgap=5, vgap=5)
26 sz.Add((35, 35)) # some space above
27 sz.Add((35, 35))
28 sz.Add((35, 35))
29
30 sz.Add(txt1)
31 sz.Add(txt2)
32 sz.Add(txt3)
33
34 sz.Add(dir1, 0, wx.EXPAND)
35 sz.Add(dir2, 0, wx.EXPAND)
36 sz.Add(dir3, 0, wx.EXPAND)
37
38 sz.Add((35,35)) # some space below
39
40 sz.AddGrowableRow(2)
41 sz.AddGrowableCol(0)
42 sz.AddGrowableCol(1)
43 sz.AddGrowableCol(2)
44
45 self.SetSizer(sz)
46 self.SetAutoLayout(True)
47
48
49 #----------------------------------------------------------------------
50
51 def runTest(frame, nb, log):
52 win = TestPanel(nb, log)
53 return win
54
55 #----------------------------------------------------------------------
56
57
58 overview = """\
59 This control can be used to place a directory listing (with optional files)
60 on an arbitrary window. The control contains a TreeCtrl window representing
61 the directory hierarchy, and optionally, a Choice window containing a list
62 of filters.
63
64 The filters work in the same manner as in FileDialog.
65
66 """
67
68
69 if __name__ == '__main__':
70 import sys,os
71 import run
72 run.main(['', os.path.basename(sys.argv[0])])
73