1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """This module contains the PanelDialog class, a simple class that turns any
18 panel into a dialog.
19 """
20
21 __id__ = "$Id: paneldialog.py 2980 2009-04-02 00:14:33Z juhas $"
22
23 import wx
24
26 """This class will turn any panel into a dialog. Using this makes for
27 quicker development and encourages the developer to design a gui as a
28 collection of panels, instead of a monolithic mega-panel.
29 """
31 """Initialize the PanelDialog.
32
33 This takes the same args and kwds as wxDialog. See the wxDialog
34 documentation for more information.
35
36 Unless specified, style is automatically set as
37 wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER
38
39 Creating a PanelDialog requires three steps.
40 1) Create the PanelDialog.
41 2) Create the Panel, with the new PanelDialog as the parent.
42 3) Call the setPanel method of the PanelDialog with the new Panel as the
43 the argument.
44 """
45 if not hasattr(kwds, "style"):
46 kwds["style"] = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER
47 wx.Dialog.__init__(self, *args, **kwds)
48 return
49
50
52 """Call this method to add the panel to the dialog."""
53 self.panel = panel
54 self.__set_properties()
55 self.__do_layout()
56 return
57
60
62 sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
63 sizer_1.Add(self.panel, 1, wx.EXPAND, 0)
64 self.SetAutoLayout(True)
65 self.SetSizer(sizer_1)
66 sizer_1.Fit(self)
67 sizer_1.SetSizeHints(self)
68 self.Layout()
69 return
70
71
72