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