mailr14030 - /branches/gui_testing/status.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on August 01, 2011 - 12:33:
Author: bugman
Date: Mon Aug  1 12:33:00 2011
New Revision: 14030

URL: http://svn.gna.org/viewcvs/relax?rev=14030&view=rev
Log:
Modified how the auto_analysis status object behaves so setting values causes 
an observer to be notified.


Modified:
    branches/gui_testing/status.py

Modified: branches/gui_testing/status.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/status.py?rev=14030&r1=14029&r2=14030&view=diff
==============================================================================
--- branches/gui_testing/status.py (original)
+++ branches/gui_testing/status.py Mon Aug  1 12:33:00 2011
@@ -87,6 +87,9 @@
         # A container for all the observers.
         self.observers = Status_container()
 
+        # The observer object for status changes in the auto-analyses.
+        self.observers.auto_analyses = Observer()
+
         # The observer object for pipe switches.
         self.observers.pipe_alteration = Observer()
 
@@ -110,13 +113,40 @@
         """
 
         # Add a status container.
-        self.auto_analysis[name] = Status_container()
+        self.auto_analysis[name] = Auto_analysis()
 
         # Store the analysis type.
         self.auto_analysis[name].type = type
 
         # The Monte Carlo simulation status, if used.
-        self.mc_number = None
+        self.auto_analysis[name].mc_number = None
+
+
+
+class Auto_analysis:
+    """The auto-analysis status container."""
+
+    def __init__(self):
+        """Initialise the auto-analysis status object."""
+
+        # The status container.
+        self.status = Status()
+
+
+    def __setattr__(self, name, value):
+        """Replacement __setattr__() method.
+
+        @param name:    The name of the attribute.
+        @type name:     str
+        @param value:   The value of the attribute.
+        @type value:    anything
+        """
+
+        # First set the attribute.
+        self.__dict__[name] = value
+
+        # Then notify the observers.
+        self.status.observers.auto_analyses.notify()
 
 
 




Related Messages


Powered by MHonArc, Updated Mon Aug 01 13:00:02 2011