Author: bugman Date: Thu Jan 19 09:25:04 2012 New Revision: 15182 URL: http://svn.gna.org/viewcvs/relax?rev=15182&view=rev Log: Created the Param_list.get_desc() method for returning the parameter description. Modified: branches/spec_api/specific_fns/api_objects.py Modified: branches/spec_api/specific_fns/api_objects.py URL: http://svn.gna.org/viewcvs/relax/branches/spec_api/specific_fns/api_objects.py?rev=15182&r1=15181&r2=15182&view=diff ============================================================================== --- branches/spec_api/specific_fns/api_objects.py (original) +++ branches/spec_api/specific_fns/api_objects.py Thu Jan 19 09:25:04 2012 @@ -38,10 +38,11 @@ self._string = {} self._defaults = {} self._units = {} + self._desc = {} self._grace_string = {} - def add(self, name, string=None, default=None, units=None, grace_string=None): + def add(self, name, string=None, default=None, units=None, desc=None, grace_string=None): """Add a parameter to the list. @param name: The name of the parameter. This will be used as the variable name. @@ -52,6 +53,8 @@ @type default: anything @keyword units: A string representing the parameters units. @type units: None or str + @keyword desc: The text description of the parameter. + @type desc: None or str @keyword grace_string: The string used for the axes in Grace plots of the data. @type grace_string: None or str """ @@ -60,6 +63,7 @@ self._names.append(name) self._defaults[name] = default self._units[name] = units + self._desc[name] = desc # The parameter string. if string: @@ -89,6 +93,23 @@ # No match. return False + + + def get_desc(self, name): + """Return the description of the parameter. + + @param name: The name of the parameter. + @type name: str + @return: The description. + @rtype: str + """ + + # Check. + if name not in self._names: + raise RelaxError("The parameter '%s' does not exist." % name) + + # Return the description. + return self._desc[name] def get_grace_string(self, name):