Author: bugman Date: Fri Dec 31 17:43:22 2010 New Revision: 12082 URL: http://svn.gna.org/viewcvs/relax?rev=12082&view=rev Log: The _get_res_id() and _get_res_info() methods can now have suffixes. This allows the self.res_from and self.res_to structures to be accessed. Modified: branches/bieri_gui/gui_bieri/user_functions/mol_res_spin.py Modified: branches/bieri_gui/gui_bieri/user_functions/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/user_functions/mol_res_spin.py?rev=12082&r1=12081&r2=12082&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/user_functions/mol_res_spin.py (original) +++ branches/bieri_gui/gui_bieri/user_functions/mol_res_spin.py Fri Dec 31 17:43:22 2010 @@ -38,11 +38,18 @@ class Mol_res_spin: """The molecule, residue, spin base class.""" - def _get_res_id(self): - """Generate the residue ID from the residue selection.""" + def _get_res_id(self, suffix=''): + """Generate the residue ID from the residue selection. + + @keyword suffix: The suffix to be added to the residue data structure name. + @type suffix: str + @return: The residue ID string. + @rtype: str + """ # The molecule name. - mol_name = str(self.mol.GetValue()) + obj = getattr(self, 'mol'+suffix) + mol_name = str(obj.GetValue()) if mol_name == '': mol_name = None @@ -56,15 +63,18 @@ return generate_spin_id(mol_name=mol_name, res_num=res_num, res_name=res_name) - def _get_res_info(self): + def _get_res_info(self, suffix=''): """Extract the residue info from the residue selection. - @return: The residue number and name from the residue selection self.res. - @rtype: int, str + @keyword suffix: The suffix to be added to the residue data structure name. + @type suffix: str + @return: The residue number and name from the residue selection self.res. + @rtype: int, str """ # The residue info. - res = str(self.res.GetValue()) + obj = getattr(self, 'res'+suffix) + res = str(obj.GetValue()) # Nothing. if res == '':