[hdf-compass] 218/295: close the app on wx.ID_EXIT (always) and on wx.EVT_CLOSE (only from InitFrame)

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun May 8 10:35:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository hdf-compass.

commit 2cb03d0eea744fca5371c6a78484fef9791a212b
Author: giumas <giumas at yahoo.it>
Date:   Mon Nov 2 19:47:13 2015 -0500

    close the app on wx.ID_EXIT (always) and on wx.EVT_CLOSE (only from InitFrame)
---
 hdf_compass/compass_viewer/frame.py | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/hdf_compass/compass_viewer/frame.py b/hdf_compass/compass_viewer/frame.py
index e47f3e3..a868d9b 100644
--- a/hdf_compass/compass_viewer/frame.py
+++ b/hdf_compass/compass_viewer/frame.py
@@ -104,7 +104,7 @@ class BaseFrame(wx.Frame):
         fm.Append(wx.ID_CLOSE, "&Close Window\tCtrl-W")
         fm.Append(ID_CLOSE_FILE, "Close &File\tShift-Ctrl-W")
         fm.Enable(ID_CLOSE_FILE, False)
-        fm.Append(wx.ID_EXIT,"E&xit"," Terminate the program")   
+        fm.Append(wx.ID_EXIT, "E&xit", " Terminate the program")
         
         menubar.Append(fm, "&File")
 
@@ -122,16 +122,21 @@ class BaseFrame(wx.Frame):
         self.Bind(wx.EVT_MENU, self.on_manual, id=wx.ID_HELP)
         self.Bind(wx.EVT_MENU, self.on_about, id=wx.ID_ABOUT)
         self.Bind(wx.EVT_MENU, self.on_exit, id=wx.ID_EXIT)
-        self.Bind(wx.EVT_CLOSE, self.on_exit)
+        self.Bind(wx.EVT_CLOSE, self.on_close)
         self.Bind(wx.EVT_MENU_RANGE, self.on_url_history, id=wx.ID_FILE1, id2=wx.ID_FILE9)
 
-    def on_exit(self, evt):
-        """ Called on "exit" event from the menu """
+    def on_close(self, evt):
+        """ Called on frame closing """
         BaseFrame.open_frames -= 1
-        log.debug("exit frame -> open frames: %s" % BaseFrame.open_frames)
+        log.debug("close frame -> open frames: %s" % BaseFrame.open_frames)
         self.Destroy()
-        if (BaseFrame.open_frames == 0) or isinstance(self, InitFrame):
-            wx.GetApp().Exit()
+        if isinstance(self, InitFrame):
+            self.on_exit(evt)
+
+    def on_exit(self, evt):
+        """ Called on "exit" event from the menu """
+        log.debug("exit app -> closing all open frames: %s" % BaseFrame.open_frames)
+        wx.GetApp().Exit()
 
     def on_manual(self, evt):
         """ Open the url with the online documentation """

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/hdf-compass.git



More information about the debian-science-commits mailing list