Author: bugman Date: Mon Dec 13 11:41:30 2010 New Revision: 11770 URL: http://svn.gna.org/viewcvs/relax?rev=11770&view=rev Log: The molecule.delete user function window now uses the base class combo_box() method. 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=11770&r1=11769&r2=11770&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/user_functions/molecule.py (original) +++ branches/bieri_gui/gui_bieri/user_functions/molecule.py Mon Dec 13 11:41:30 2010 @@ -170,22 +170,34 @@ # Spacer. sizer.AddSpacer(self._spacing) - # The type selection. - names = [] + # The molecule selection. + self.mol_name = self.combo_box(sizer, "The molecule:", []) + + # Spacer. + sizer.AddSpacer(self._spacing) + + + def execute(self): + """Execute the user function.""" + + # Get the name. + mol_name = str(self.mol_name.GetValue()) + + # The molecule ID. + id = '#' + mol_name + + # Delete the molecule. + self.interpreter.molecule.delete(mol_id=id) + + + def update(self, event): + """Update the UI.""" + + # Clear the previous data. + self.mol_name.Clear() + + # The list of molecule names. if pipes.cdp_name(): for mol in molecule_loop(): - names.append(mol.name) - self.chooser(sizer, "The molecule:", self._evt_mol_sel, names) - - # Spacer. - sizer.AddSpacer(self._spacing) - - - def execute(self): - """Execute the user function.""" - - # The molecule ID. - id = '#' + self.mol - - # Delete the molecule. - self.interpreter.molecule.delete(mol_id=id) + self.mol_name.Append(mol.name) +