Author: bugman Date: Thu Mar 8 05:09:31 2007 New Revision: 3102 URL: http://svn.gna.org/viewcvs/relax?rev=3102&view=rev Log: Creation of the RunContainer object. This file was copied from '__init__.py' as the old top level Data() class setup will be similar to the new RunContainer object. The Data class has been renamed to RunContainer and the Singleton setup has been eliminated. The __all__ list object has also been removed. Added: 1.3/data/run_container.py - copied, changed from r3101, 1.3/data/__init__.py Copied: 1.3/data/run_container.py (from r3101, 1.3/data/__init__.py) URL: http://svn.gna.org/viewcvs/relax/1.3/data/run_container.py?p2=1.3/data/run_container.py&p1=1.3/data/__init__.py&r1=3101&r2=3102&rev=3102&view=diff ============================================================================== --- 1.3/data/__init__.py (original) +++ 1.3/data/run_container.py Thu Mar 8 05:09:31 2007 @@ -1,6 +1,6 @@ ############################################################################### # # -# Copyright (C) 2003-2004, 2006-2007 Edward d'Auvergne # +# Copyright (C) 2007 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -30,17 +30,8 @@ from diff_tensor import DiffTensorData -__all__ = [ 'data_classes', - 'diff_tensor', - 'diff_tensor_auto_objects', - 'main' ] -# Global data. -############## - -class Data(object): - __instance = None - +class RunContainer(object): def __init__(self): """Class containing all the program data.""" @@ -77,22 +68,6 @@ self.warning = {} - def __new__(self, *args, **kargs): - """Method for implementing the singleton design pattern. - - If no other class instance currently exists, create a new instance of this class. Otherwise - return the class instance. See http://en.wikipedia.org/wiki/Singleton_pattern for a - description of this design pattern. - """ - - # Create a new instance if none exists. - if self.__instance is None: - self.__instance = object.__new__(self, *args, **kargs) - - # Return the class instance. - return self.__instance - - def __repr__(self): text = "The data class containing all permanent program data.\n" text = text + "The class contains the following objects:\n" @@ -101,18 +76,3 @@ 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__()