|
@@ -177,7 +177,7 @@ class GMFrame(wx.Frame):
|
|
|
|
|
|
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 @@ class GMFrame(wx.Frame):
|
|
|
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 @@ class GMFrame(wx.Frame):
|
|
|
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()
|