Package diffpy :: Package pdfgui :: Package gui :: Package wxExtensions :: Module paneldialog
[hide private]
[frames] | no frames]

Source Code for Module diffpy.pdfgui.gui.wxExtensions.paneldialog

 1  # -*- coding: UTF-8 -*- 
 2  # generated by wxGlade 0.4.1 on Wed Mar 29 15:15:14 2006 
 3  ############################################################################## 
 4  # 
 5  # wxExtensions      by DANSE Diffraction group 
 6  #                   Simon J. L. Billinge 
 7  #                   (c) 2006 trustees of the Michigan State University. 
 8  #                   All rights reserved. 
 9  # 
10  # File coded by:    Dmitriy Bryndin 
11  # 
12  # See AUTHORS.txt for a list of people who contributed. 
13  # See LICENSE.txt for license information. 
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   
25 -class PanelDialog(wx.Dialog):
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 """
30 - def __init__(self, *args, **kwds):
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
51 - def setPanel(self, panel):
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
58 - def __set_properties(self):
59 return
60
61 - def __do_layout(self):
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 # End of class PanelDialog 72