mailr10666 - /branches/bieri_gui/gui_bieri/relax_gui.py


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

Header


Content

Posted by edward on February 05, 2010 - 17:06:
Author: bugman
Date: Fri Feb  5 17:06:12 2010
New Revision: 10666

URL: http://svn.gna.org/viewcvs/relax?rev=10666&view=rev
Log:
Cleaned up the exit_gui() method (previously called exitGUI()).

A docstring and comments have been added.  The exit dialog text has been 
re-written.  And the call
to sys.exit() has been replaced by a call to self.Destroy() to exit the frame 
(to exit properly,
some other GUI elements need to be destroyed too, though these are not clear 
yet).


Modified:
    branches/bieri_gui/gui_bieri/relax_gui.py

Modified: branches/bieri_gui/gui_bieri/relax_gui.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/relax_gui.py?rev=10666&r1=10665&r2=10666&view=diff
==============================================================================
--- branches/bieri_gui/gui_bieri/relax_gui.py (original)
+++ branches/bieri_gui/gui_bieri/relax_gui.py Fri Feb  5 17:06:12 2010
@@ -28,7 +28,6 @@
 from os import getcwd, mkdir, sep
 from re import search
 from string import lower, lowercase, replace
-import sys
 import time
 import webbrowser
 import wx
@@ -249,7 +248,7 @@
         self.Bind(wx.EVT_BUTTON, self.open_model_results_exe, 
self.open_model_results)
 
         # Close Box event
-        self.Bind(wx.EVT_CLOSE, self.exitGUI)
+        self.Bind(wx.EVT_CLOSE, self.exit_gui)
 
 
         # Pre-build the about dialogs, but do not show them.
@@ -735,7 +734,7 @@
         self.Bind(wx.EVT_MENU, self.state_load, id=1)
         self.Bind(wx.EVT_MENU, self.action_state_save, id=2)
         self.Bind(wx.EVT_MENU, self.action_state_save_as, id=3)
-        self.Bind(wx.EVT_MENU, self.exitGUI,    id=4)
+        self.Bind(wx.EVT_MENU, self.exit_gui,   id=4)
 
         # The 'View' menu entries.
         menu = wx.Menu()
@@ -839,9 +838,19 @@
         event.Skip()
 
 
-    def exitGUI(self, event): # Exit
-        doexit = question('Do you wand to quit relaxGUI?')
+    def exit_gui(self, event):
+        """Catch the main window closure and perform the exit procedure.
+
+        @param event:   The wx event.
+        @type event:    wx event
+        """
+
+        # Ask if the user is sure they would like to exit.
+        doexit = question('Are you sure you would like to quit relax?  All 
unsaved data will be lost.', default=True)
+
+        # Exit.
         if doexit == True:
+            # A print out.
             print"\n==================================================\n\n"
             print "\nThank you for citing:"
             print ""
@@ -851,7 +860,11 @@
             print "d'Auvergne, E.J. and Gooley, P.R. (2008). Optimisation of 
NMR dynamic models I. Minimisation algorithms and their performance within 
the model-free and Brownian rotational diffusion spaces. J. Biomol. NMR, 
40(2), 107-119."
             print "d'Auvergne, E.J. and Gooley, P.R. (2008). Optimisation of 
NMR dynamic models II. A new methodology for the dual optimisation of the 
model-free parameters and the Brownian rotational diffusion tensor. J. 
Biomol. NMR, 40(2), 121-133."
             print "\nExiting relaxGUI......\n"
-            sys.exit(0)
+
+            # Destroy the main window.
+            self.Destroy()
+
+        # Terminate the event.
         event.Skip()
 
 




Related Messages


Powered by MHonArc, Updated Fri Feb 05 17:20:02 2010