Author: bugman
Date: Thu Oct 16 10:49:18 2014
New Revision: 26296

URL: http://svn.gna.org/viewcvs/relax?rev=26296&view=rev
Log:
The ESC character now closes all wizards and user functions in the relax GUI.

By using an accelerator table set to the entire wizard window to catch the ESC 
keyboard event, the
ESC key will cause the _handler_escape() method to be called which then calls 
the windows Close()
method to close the window.


Modified:
    trunk/gui/wizards/wiz_objects.py

Modified: trunk/gui/wizards/wiz_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/gui/wizards/wiz_objects.py?rev=26296&r1=26295&r2=26296&view=diff
==============================================================================
--- trunk/gui/wizards/wiz_objects.py    (original)
+++ trunk/gui/wizards/wiz_objects.py    Thu Oct 16 10:49:18 2014
@@ -481,6 +481,13 @@
         # Bind some events.
         self.Bind(wx.EVT_CLOSE, self._handler_close)
 
+        # ESC to exit, via an accelerator table which creates menu events.
+        id = wx.NewId()
+        self.acc_list = [(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, id)]
+        self.acc_table = wx.AcceleratorTable(self.acc_list)
+        self.SetAcceleratorTable(self.acc_table)
+        self.Bind(wx.EVT_MENU, self._handler_escape, id=self.acc_list[0][2])
+
 
     def _apply(self, event=None):
         """Execute the current page's 'Apply' method.
@@ -716,6 +723,17 @@
 
         # Continue with the window closing.
         event.Skip()
+
+
+    def _handler_escape(self, event=None):
+        """Event handler for key strokes.
+
+        @keyword event: The wx event.
+        @type event:    wx event
+        """
+
+        # Close the window.
+        self.Close()
 
 
     def _next_fn(self):


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to