[GRASS-SVN] r66982 - grass/trunk/gui/wxpython/lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 29 06:12:38 PST 2015
Author: martinl
Date: 2015-11-29 06:12:38 -0800 (Sun, 29 Nov 2015)
New Revision: 66982
Modified:
grass/trunk/gui/wxpython/lmgr/frame.py
Log:
wxGUI: ask user if to quit GRASS when closeing GUI from title bar
Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py 2015-11-29 13:50:43 UTC (rev 66981)
+++ grass/trunk/gui/wxpython/lmgr/frame.py 2015-11-29 14:12:38 UTC (rev 66982)
@@ -177,7 +177,7 @@
self._auimgr.GetPane('toolbarNviz').Hide()
# bindings
- self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
+ self.Bind(wx.EVT_CLOSE, self.OnCloseWindowOrExit)
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
self._giface.mapCreated.connect(self.OnMapCreated)
@@ -2204,8 +2204,27 @@
def OnCloseWindow(self, event):
"""Cleanup when wxGUI is quitted"""
self._closeWindow()
+
+ def OnCloseWindowOrExit(self, event):
+ """Cleanup when wxGUI is quitted
+
+ Ask user also to quit GRASS including terminal
+ """
+ dlg = wx.MessageDialog(self,
+ message = _("Do you want to quit GRASS GIS?"),
+ caption = _("Quit GRASS GIS"),
+ style = wx.YES_NO | wx.YES_DEFAULT |
+ wx.CANCEL | wx.ICON_QUESTION | wx.CENTRE)
+ ret = dlg.ShowModal()
+ dlg.Destroy()
+
+ if ret != wx.ID_CANCEL:
+ self._closeWindow()
+ if ret == wx.ID_YES:
+ self._quitGRASS()
def _closeWindow(self):
+ """Close wxGUI"""
# save command protocol if actived
if self.goutput.btnCmdProtocol.GetValue():
self.goutput.CmdProtocolSave()
@@ -2257,8 +2276,12 @@
self.Destroy()
def OnCloseWindowExitGRASS(self, event):
- """Close wxGUI and exit GRASS shell."""
+ """Close wxGUI and quit GRASS terminal"""
self._closeWindow()
+ self._quitGRASS()
+
+ def _quitGRASS(self):
+ """Quit GRASS terminal"""
try:
shellPid = int(grass.gisenv()['PID'])
print >> sys.stderr, grass.gisenv()
More information about the grass-commit
mailing list