Author: bugman Date: Thu Feb 25 12:36:30 2010 New Revision: 10937 URL: http://svn.gna.org/viewcvs/relax?rev=10937&view=rev Log: Addition of the relax status singleton object. See https://mail.gna.org/public/relax-devel/2010-01/msg00094.html and other related posts in the thread. The idea is that various parts of relax deposit status information into here that other parts of relax can then use. For example the Monte Carlo code can place the current simulation number in there while the relax GUI controller can read these values. Added: 1.3/status.py Added: 1.3/status.py URL: http://svn.gna.org/viewcvs/relax/1.3/status.py?rev=10937&view=auto ============================================================================== --- 1.3/status.py (added) +++ 1.3/status.py Thu Feb 25 12:36:30 2010 @@ -1,0 +1,47 @@ +############################################################################### +# # +# Copyright (C) 2010 Edward d'Auvergne # +# # +# This file is part of the program relax. # +# # +# relax is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# relax is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with relax; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +############################################################################### + +# Module docstring. +"""Module containing the status singleton object.""" + + + +class Status(object): + """The relax status singleton class.""" + + # Class variable for storing the class instance (for the singleton). + _instance = None + + def __new__(self, *args, **kargs): + """Replacement method for implementing the singleton design pattern.""" + + # First instantiation. + if self._instance is None: + # Instantiate. + self._instance = object.__new__(self, *args, **kargs) + + # Already instantiated, so return the instance. + return self._instance + + +class Status_container: + """The generic empty container for the status data."""