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

Source Code for Module diffpy.pdfgui.gui.supercelldialog

  1  #!/usr/bin/env python 
  2  # -*- coding: ISO-8859-1 -*- 
  3  ############################################################################## 
  4  # 
  5  # PDFgui            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:    Chris Farrow 
 11  # 
 12  # See AUTHORS.txt for a list of people who contributed. 
 13  # See LICENSE.txt for license information. 
 14  # 
 15  ############################################################################## 
 16   
 17  # generated by wxGlade 0.4 on Mon Oct 30 11:18:45 2006 
 18   
 19  import wx 
 20   
21 -class SupercellDialog(wx.Dialog):
22 - def __init__(self, *args, **kwds):
23 # begin wxGlade: SupercellDialog.__init__ 24 kwds["style"] = wx.DEFAULT_DIALOG_STYLE 25 wx.Dialog.__init__(self, *args, **kwds) 26 self.sizer_1_staticbox = wx.StaticBox(self, -1, "Supercell Expansion") 27 self.aLabel = wx.StaticText(self, -1, "a multiplier") 28 self.aSpinCtrl = wx.SpinCtrl(self, -1, "1", min=1, max=10) 29 self.bLabel = wx.StaticText(self, -1, "b multiplier") 30 self.bSpinCtrl = wx.SpinCtrl(self, -1, "1", min=1, max=10) 31 self.cLabel = wx.StaticText(self, -1, "c multiplier") 32 self.cSpinCtrl = wx.SpinCtrl(self, -1, "1", min=1, max=10) 33 self.static_line_1 = wx.StaticLine(self, -1) 34 self.cancelButton = wx.Button(self, wx.ID_CANCEL, "Cancel") 35 self.okButton = wx.Button(self, wx.ID_OK, "OK") 36 37 self.__set_properties() 38 self.__do_layout() 39 40 self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL) 41 self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK) 42 # end wxGlade 43 self.__customProperties()
44
45 - def __set_properties(self):
46 # begin wxGlade: SupercellDialog.__set_properties 47 self.SetTitle("Supercell Expansion")
48 # end wxGlade 49
50 - def __do_layout(self):
51 # begin wxGlade: SupercellDialog.__do_layout 52 sizer_1 = wx.StaticBoxSizer(self.sizer_1_staticbox, wx.VERTICAL) 53 sizer_4 = wx.BoxSizer(wx.HORIZONTAL) 54 sizer_3 = wx.BoxSizer(wx.HORIZONTAL) 55 sizer_2_copy_1 = wx.BoxSizer(wx.HORIZONTAL) 56 sizer_2_copy = wx.BoxSizer(wx.HORIZONTAL) 57 sizer_2 = wx.BoxSizer(wx.HORIZONTAL) 58 sizer_2.Add(self.aLabel, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5) 59 sizer_2.Add(self.aSpinCtrl, 0, wx.ALL|wx.ADJUST_MINSIZE, 5) 60 sizer_1.Add(sizer_2, 0, wx.EXPAND, 0) 61 sizer_2_copy.Add(self.bLabel, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5) 62 sizer_2_copy.Add(self.bSpinCtrl, 0, wx.ALL|wx.ADJUST_MINSIZE, 5) 63 sizer_1.Add(sizer_2_copy, 0, wx.EXPAND, 0) 64 sizer_2_copy_1.Add(self.cLabel, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 5) 65 sizer_2_copy_1.Add(self.cSpinCtrl, 0, wx.ALL|wx.ADJUST_MINSIZE, 5) 66 sizer_1.Add(sizer_2_copy_1, 0, wx.EXPAND, 0) 67 sizer_3.Add(self.static_line_1, 1, wx.TOP|wx.BOTTOM|wx.EXPAND, 5) 68 sizer_1.Add(sizer_3, 0, wx.EXPAND, 0) 69 sizer_4.Add(self.cancelButton, 0, wx.ALL|wx.ADJUST_MINSIZE, 5) 70 sizer_4.Add(self.okButton, 0, wx.ALL|wx.ADJUST_MINSIZE, 5) 71 sizer_1.Add(sizer_4, 1, wx.EXPAND, 0) 72 self.SetAutoLayout(True) 73 self.SetSizer(sizer_1) 74 sizer_1.Fit(self) 75 sizer_1.SetSizeHints(self) 76 self.Layout()
77 # end wxGlade 78 79 ############################################################################ 80
81 - def __customProperties(self):
82 """Set custom properties.""" 83 # Set the text validators 84 self.m = 1 85 self.n = 1 86 self.o = 1 87 return
88
89 - def getMNO(self):
90 """Get the [m, n, o] expansion parameters from the dialog.""" 91 return [self.m, self.n, self.o]
92
93 - def onOk(self, event): # wxGlade: SupercellDialog.<event_handler>
94 """Accept the expansion.""" 95 self.m = self.aSpinCtrl.GetValue() 96 self.n = self.bSpinCtrl.GetValue() 97 self.o = self.cSpinCtrl.GetValue() 98 event.Skip() 99 return
100
101 - def onCancel(self, event): # wxGlade: SupercellDialog.<event_handler>
102 """Get out of here.""" 103 event.Skip() 104 return 105 106 # end of class SupercellDialog 107 __id__ = "$Id: supercelldialog.py 2980 2009-04-02 00:14:33Z juhas $" 108