Author: bugman Date: Fri Dec 10 16:32:07 2010 New Revision: 11759 URL: http://svn.gna.org/viewcvs/relax?rev=11759&view=rev Log: The molecule type can now be selected in the molecule.add window. Modified: branches/bieri_gui/gui_bieri/user_functions/molecule.py Modified: branches/bieri_gui/gui_bieri/user_functions/molecule.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/molecule.py?rev=11759&r1=11758&r2=11759&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/user_functions/molecule.py (original) +++ branches/bieri_gui/gui_bieri/user_functions/molecule.py Fri Dec 10 16:32:07 2010 @@ -77,22 +77,30 @@ @type sizer: wx.Sizer instance """ - # The molecule name. + # The molecule name input. sizer.Add(self.mol_name_element(), 1, wx.EXPAND|wx.SHAPED, 5) + + # The type selection. + sizer.Add(self.mol_type_element(), 1, wx.EXPAND|wx.SHAPED, 5) def execute(self): """Execute the user function.""" - # Get the name. + # Get the name and type. mol_name = str(self.mol_name.GetValue()) + mol_type = str(self.mol_type.GetValue()) # Set the name. - self.interpreter.molecule.create(mol_name=mol_name) + self.interpreter.molecule.create(mol_name=mol_name, mol_type=mol_type) def mol_name_element(self): - """Build the molecule name element.""" + """Build the molecule name element. + + @return: The box sizer. + @rtype: wx.Sizer instance + """ # Init. sizer = wx.BoxSizer(wx.HORIZONTAL) @@ -107,3 +115,25 @@ # Return the sizer. return sizer + + + def mol_type_element(self): + """Build the molecule type element. + + @return: The box sizer. + @rtype: wx.Sizer instance + """ + + # Init. + sizer = wx.BoxSizer(wx.HORIZONTAL) + + # The molecule typ. + text = wx.StaticText(self, -1, "The type of molecule:", style=wx.ALIGN_RIGHT) + sizer.Add(text, 1, wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) + + # The input field. + self.mol_type = wx.Choice(self, -1, style=wx.ALIGN_RIGHT, choices=[''] + ['protein', 'RNA']) + sizer.Add(self.mol_type, 1, wx.LEFT|wx.ALIGN_CENTER_VERTICAL|wx.ADJUST_MINSIZE, 0) + + # Return the sizer. + return sizer