Author: bugman Date: Thu Mar 8 03:40:29 2007 New Revision: 3094 URL: http://svn.gna.org/viewcvs/relax?rev=3094&view=rev Log: The reset() user function has been modified to handle the new data object. Rather than using the statement 'self.relax.data = Data()', which with the singleton design will alias 'self.relax.data' back to the data object, a new method 'self.__reset__()' of the data object is called. This method first deletes the items of the object's __dict__ dictionary key by key and then reruns the object's __init__() method. Modified: 1.3/data/main.py 1.3/prompt/reset.py Modified: 1.3/data/main.py URL: http://svn.gna.org/viewcvs/relax/1.3/data/main.py?rev=3094&r1=3093&r2=3094&view=diff ============================================================================== --- 1.3/data/main.py (original) +++ 1.3/data/main.py Thu Mar 8 03:40:29 2007 @@ -20,11 +20,12 @@ # # ############################################################################### - +# Python module imports. from math import pi -from re import match +from re import match, search from types import DictType, ListType +# relax module imports. from data_classes import Element, Residue, SpecificData from diff_tensor import DiffTensorData @@ -96,3 +97,18 @@ continue text = text + " " + name + ", " + `type(getattr(self, name))` + "\n" return text + + + def __reset__(self): + """""" + + # Get the keys of self.__dict__. + keys = self.__dict__.keys() + + # Loop over the keys and delete the corresponding object. + for key in keys: + # Delete the object. + del self.__dict__[key] + + # Rerun the __init__() method. + self.__init__() Modified: 1.3/prompt/reset.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/reset.py?rev=3094&r1=3093&r2=3094&view=diff ============================================================================== --- 1.3/prompt/reset.py (original) +++ 1.3/prompt/reset.py Thu Mar 8 03:40:29 2007 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003, 2004, 2006 Edward d'Auvergne # +# Copyright (C) 2003-2004, 2006-2007 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -21,12 +21,9 @@ ############################################################################### -from data.main import Data - - class Reset: def __init__(self, relax): - """Class containing the function for reinitialising self.relax.data""" + """Class containing the function for reinitialising the relax data storage object.""" self.relax = relax @@ -34,8 +31,9 @@ def reset(self): """Reset relax. - All of the data stored in self.relax.data will be erased and hence relax will return to its - initial state. + All of the data of the relax data storage object will be erased and hence relax will return + to its initial state. """ - self.relax.data = Data() + # Run the relax data storage object reset method. + relax_data_store.__reset__()