mailr16663 - /branches/uf_redesign/gui/wizard.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 - 11:12:
Author: bugman
Date: Tue Jun  5 11:12:12 2012
New Revision: 16663

URL: http://svn.gna.org/viewcvs/relax?rev=16663&view=rev
Log:
Better handling of the GUI wizard termination.

The _handler_close() method is now handling the close events and together 
with the _ok() method,
both now execute the current page's on_next() method.  This means that 
on_next() is called for all
avenues for exiting the wizard.  This allows the user function pages to 
unregister themselves with
the observer objects.


Modified:
    branches/uf_redesign/gui/wizard.py

Modified: branches/uf_redesign/gui/wizard.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/uf_redesign/gui/wizard.py?rev=16663&r1=16662&r2=16663&view=diff
==============================================================================
--- branches/uf_redesign/gui/wizard.py (original)
+++ branches/uf_redesign/gui/wizard.py Tue Jun  5 11:12:12 2012
@@ -464,6 +464,9 @@
         # Flag to suppress later button addition.
         self._buttons_built = False
 
+        # Bind some events.
+        self.Bind(wx.EVT_CLOSE, self._handler_close)
+
 
     def _build_buttons(self):
         """Construct the buttons for all pages of the wizard."""
@@ -670,6 +673,20 @@
         self._display_page(self._current_page)
 
 
+    def _handler_close(self, event=None):
+        """Event handler for the close window action.
+
+        @keyword event: The wx event.
+        @type event:    wx event
+        """
+
+        # Execute the page's on_next() method to allow the page to clean 
itself up.
+        self._pages[self._current_page].on_next()
+
+        # Continue with the window closing.
+        event.Skip()
+
+
     def _next_fn(self):
         """Standard function for setting the next page to the one directly 
next in the sequence.
 
@@ -706,6 +723,9 @@
 
                 # Increment the execution counter.
                 self._exec_count[i] += 1
+
+        # Execute the current page's on_next() method to allow the page to 
clean itself up.
+        self._pages[self._current_page].on_next()
 
         # Then close the dialog.
         if self.IsModal():




Related Messages


Powered by MHonArc, Updated Tue Jun 05 12:20:01 2012