Author: bugman Date: Fri Jul 1 17:56:56 2011 New Revision: 13384 URL: http://svn.gna.org/viewcvs/relax?rev=13384&view=rev Log: Created the Wizard page spin_id_element() method for handling the input of spin IDs. Modified: branches/gui_testing/gui/wizard.py Modified: branches/gui_testing/gui/wizard.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/wizard.py?rev=13384&r1=13383&r2=13384&view=diff ============================================================================== --- branches/gui_testing/gui/wizard.py (original) +++ branches/gui_testing/gui/wizard.py Fri Jul 1 17:56:56 2011 @@ -29,6 +29,7 @@ # relax module imports. from data import Relax_data_store; ds = Relax_data_store() +from generic_fns.mol_res_spin import id_string_doc from relax_errors import AllRelaxErrors, RelaxImplementError # relax GUI module imports. @@ -673,6 +674,64 @@ """ + def spin_id_element(self, sizer, divider=None, padding=0, spacer=None): + """Build a special the input field widget. + + @param sizer: The sizer to put the input field widget into. + @type sizer: wx.Sizer instance + @keyword divider: The optional position of the divider. If None, the class variable _div_left will be used. + @type divider: None or int + @keyword padding: Spacing to the left and right of the widgets. + @type padding: int + @keyword spacer: The amount of spacing to add below the field in pixels. If None, a stretchable spacer will be used. + @type spacer: None or int + @return: The input field object. + @rtype: wx.TextCtrl instance + """ + + # Init. + sub_sizer = wx.BoxSizer(wx.HORIZONTAL) + + # Left padding. + sub_sizer.AddSpacer(padding) + + # The description. + text = wx.StaticText(self, -1, "The spin identification string:", style=wx.ALIGN_LEFT) + sub_sizer.Add(text, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 0) + + # The divider. + if not divider: + divider = self._div_left + + # Spacing. + x, y = text.GetSize() + sub_sizer.AddSpacer((divider - x, 0)) + + # The input field. + field = wx.TextCtrl(self, -1, '') + field.SetMinSize((50, 27)) + sub_sizer.Add(field, 1, wx.ALIGN_CENTER_VERTICAL, 0) + + # Right padding. + sub_sizer.AddSpacer(padding) + + # Add to the main sizer. + sizer.Add(sub_sizer, 1, wx.EXPAND|wx.ALL, 0) + + # Spacing below the widget. + if spacer == None: + sizer.AddStretchSpacer() + else: + sizer.AddSpacer(spacer) + + # Tooltip (the ID string documentation). + text.SetToolTipString(id_string_doc) + field.SetToolTipString(id_string_doc) + + # Return the object. + return field + + def text(self, sizer, desc, default=''): """Build the input field.