mailr27449 - /trunk/gui/spin_viewer/frame.py


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

Header


Content

Posted by edward on February 03, 2015 - 10:07:
Author: bugman
Date: Tue Feb  3 10:07:09 2015
New Revision: 27449

URL: http://svn.gna.org/viewcvs/relax?rev=27449&view=rev
Log:
Created a special Destroy() method for the spin viewer window.

This is for greater control of the spin viewer window destruction.  First the 
methods registered
with the observer objects are unregistered, then the children of the spin 
viewer window are
destroyed, and finally the main spin viewer window is destroyed.  This change 
saves a lot of GUI
resources in the GUI tests (there is a large reduction in 'User Objects' and 
'GDI Objects' used on
MS Windows systems, hence an equivalent resource reduction on other operating 
systems).


Modified:
    trunk/gui/spin_viewer/frame.py

Modified: trunk/gui/spin_viewer/frame.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/spin_viewer/frame.py?rev=27449&r1=27448&r2=27449&view=diff
==============================================================================
--- trunk/gui/spin_viewer/frame.py      (original)
+++ trunk/gui/spin_viewer/frame.py      Tue Feb  3 10:07:09 2015
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2010-2014 Edward d'Auvergne                                  
 #
+# Copyright (C) 2010-2015 Edward d'Auvergne                                  
 #
 # Copyright (C) 2013-2014 Troels E. Linnet                                   
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
@@ -121,6 +121,25 @@
         self.menu_uf_ids = build_uf_menus(parent=self, menubar=self.menubar)
 
 
+    def Destroy(self, event=None):
+        """Cleanly destroy the spin viewer window.
+
+        @keyword event: The wx event.
+        @type event:    wx event
+        """
+
+        # First unregister the methods from the observers.
+        status.observers.gui_uf.unregister(self.name)
+        status.observers.pipe_alteration.unregister(self.name)
+        status.observers.exec_lock.unregister(self.name)
+
+        # Destroy all children of the window.
+        super(Spin_view_window, self).DestroyChildren()
+
+        # Destroy the spin viewer window.
+        super(Spin_view_window, self).Destroy()
+
+
     def Show(self, show=True):
         """Change the behaviour of showing the window to update the content.
 




Related Messages


Powered by MHonArc, Updated Tue Feb 03 10:20:03 2015