mailr14266 - /branches/gui_testing/gui/pipe_editor.py


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

Header


Content

Posted by edward on August 08, 2011 - 17:27:
Author: bugman
Date: Mon Aug  8 17:27:09 2011
New Revision: 14266

URL: http://svn.gna.org/viewcvs/relax?rev=14266&view=rev
Log:
Modified the pipe editor window design to be closer to that of the spin 
viewer.

The observer methods are now unregistered on closing the window, which should 
speed up relax.


Modified:
    branches/gui_testing/gui/pipe_editor.py

Modified: branches/gui_testing/gui/pipe_editor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/gui/pipe_editor.py?rev=14266&r1=14265&r2=14266&view=diff
==============================================================================
--- branches/gui_testing/gui/pipe_editor.py (original)
+++ branches/gui_testing/gui/pipe_editor.py Mon Aug  8 17:27:09 2011
@@ -63,9 +63,6 @@
         # Create GUI elements
         wx.Frame.__init__(self, None, id=-1, title="Data pipe editor")
 
-        # Freeze the window.
-        self.Freeze()
-
         # Set up the window icon.
         self.SetIcons(relax_icons)
 
@@ -101,17 +98,29 @@
         # Centre the frame.
         self.Centre()
 
+        # Initialise the observer name.
+        self.name = 'pipe editor'
+
+
+    def Show(self, show=True):
+        """Change the behaviour of showing the window to update the content.
+
+        @keyword show:  A flag which is True shows the window.
+        @type show:     bool
+        """
+
         # Update the grid.
         self.update_grid()
         self.activate()
 
         # Register the grid for updating when a user function completes or 
when the GUI analysis tabs change.
-        status.observers.pipe_alteration.register('pipe editor', 
self.update_grid)
-        status.observers.gui_analysis.register('pipe editor', 
self.update_grid)
-        status.observers.exec_lock.register('pipe editor', self.activate)
-
-        # Thaw the window.
-        self.Thaw()
+        status.observers.pipe_alteration.register(self.name, 
self.update_grid)
+        status.observers.gui_analysis.register(self.name, self.update_grid)
+        status.observers.exec_lock.register(self.name, self.activate)
+
+        # Show the window using the base class method.
+        if status.show_gui:
+            super(Pipe_editor, self).Show(show)
 
 
     def activate(self):
@@ -318,6 +327,11 @@
         @type event:    wx event
         """
 
+        # Unregister the methods from the observers to avoid unnecessary 
updating.
+        status.observers.pipe_alteration.unregister(self.name)
+        status.observers.gui_analysis.unregister(self.name)
+        status.observers.exec_lock.unregister(self.name)
+
         # Close the window.
         self.Hide()
 




Related Messages


Powered by MHonArc, Updated Mon Aug 08 18:00:02 2011