mailr16658 - /branches/uf_redesign/gui/uf_objects.py


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

Header


Content

Posted by edward on June 05, 2012 - 10:17:
Author: bugman
Date: Tue Jun  5 10:17:12 2012
New Revision: 16658

URL: http://svn.gna.org/viewcvs/relax?rev=16658&view=rev
Log:
The user function pages are now registered and unregistered with the 'gui_uf' 
observer object.

This allows the ComboBox args to be properly updated with asynchronous user 
function calls.  The old
update method suffered from racing and hence often updated before the user 
function had executed.
Now the on_display() method registers the GUI user function page 
update_args() method, and the
on_next() method unregisters it, allowing the observer to update the page 
only when it is visible to
the user.


Modified:
    branches/uf_redesign/gui/uf_objects.py

Modified: branches/uf_redesign/gui/uf_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/uf_objects.py?rev=16658&r1=16657&r2=16658&view=diff
==============================================================================
--- branches/uf_redesign/gui/uf_objects.py (original)
+++ branches/uf_redesign/gui/uf_objects.py Tue Jun  5 10:17:12 2012
@@ -931,15 +931,11 @@
             interpreter.queue(uf, *args, **kwds)
 
 
-    def on_completion(self):
-        """Update the argument GUI elements if needed."""
-
-        # Update the args.
-        return self.update_args()
-
-
     def on_display(self):
         """Clear and update the data if needed."""
+
+        # Register this page with the 'gui_uf' observer so that 
update_args() is called once the any user function completes.
+        status.observers.gui_uf.register(self.name, self.update_args)
 
         # Update the args.
         return self.update_args()
@@ -994,6 +990,13 @@
         # Bring the controller to the front.
         if status.show_gui and self.uf_data.display:
             wx.CallAfter(app.gui.controller.Raise)
+
+
+    def on_next(self):
+        """Remove this page from the observers."""
+
+        # Unregister this page with the 'gui_uf' observer.
+        status.observers.gui_uf.unregister(self.name)
 
 
     def update_args(self):




Related Messages


Powered by MHonArc, Updated Tue Jun 05 10:40:01 2012