[GRASS-SVN] r67245 - in grass/branches/releasebranch_7_0/gui/wxpython: gui_core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 19 02:45:15 PST 2015


Author: martinl
Date: 2015-12-19 02:45:15 -0800 (Sat, 19 Dec 2015)
New Revision: 67245

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py
   grass/branches/releasebranch_7_0/gui/wxpython/gui_core/ghelp.py
   grass/branches/releasebranch_7_0/gui/wxpython/lmgr/frame.py
Log:
wxGUI: replace message dialog with customized QuitDialog
       (merge r67244 from trunk)


Modified: grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py	2015-12-19 10:35:57 UTC (rev 67244)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gui_core/dialogs.py	2015-12-19 10:45:15 UTC (rev 67245)
@@ -21,6 +21,7 @@
  - :class:`ImageSizeDialog`
  - :class:`SqlQueryFrame`
  - :class:`SymbolDialog`
+ - :class:`QuitDialog`
 
 (C) 2008-2015 by the GRASS Development Team
 
@@ -2786,3 +2787,57 @@
     
         self.SetSizer(sizer)
         sizer.Fit(self)
+
+class QuitDialog(wx.Dialog):
+    def __init__(self, parent, title=_("Quit GRASS GIS"), id=wx.ID_ANY,
+                 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
+                 size=(350, 150), **kwargs):
+        """Dialog to quit GRASS
+        
+        :param parent: window
+        """
+        wx.Dialog.__init__(self, parent, id, title, style=style, size=size, **kwargs)
+        self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
+
+        self.informLabel = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
+                                         label=_("Do you want to quit GRASS including shell "
+                                                 "prompt or just close the GUI?"))
+        self.btnCancel = wx.Button(parent = self.panel, id = wx.ID_CANCEL)
+        self.btnClose = wx.Button(parent = self.panel, id = wx.ID_NO,
+                                   label=_("Close GUI"))
+        self.btnQuit = wx.Button(parent = self.panel, id = wx.ID_YES,
+                                   label=_("Quit GRASS"))
+        self.btnQuit.SetDefault()
+        
+        self.btnClose.Bind(wx.EVT_BUTTON, self.OnClose)
+        self.btnQuit.Bind(wx.EVT_BUTTON, self.OnQuit)
+        
+        self.__layout()
+        
+    def __layout(self):
+        """Do layout"""
+        sizer = wx.BoxSizer(wx.VERTICAL)
+        
+        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
+        btnSizer.Add(item=self.btnCancel, flag=wx.RIGHT, border=5)
+        btnSizer.Add(item=self.btnClose, flag=wx.RIGHT, border=5)
+        btnSizer.Add(item=self.btnQuit, flag=wx.RIGHT, border=5)
+        
+        sizer.Add(item = self.informLabel, proportion = 1,
+                  flag = wx.EXPAND | wx.ALL, border = 25)
+        sizer.Add(item = btnSizer, proportion = 0,
+                  flag = wx.ALL | wx.ALIGN_RIGHT, border = 5)
+
+        self.panel.SetSizer(sizer)
+        sizer.Fit(self.panel)
+        self.Layout()
+        
+    def OnClose(self, event):
+        self.Close()
+        self.EndModal(wx.ID_NO)
+        event.Skip()
+
+    def OnQuit(self, event):
+        self.Close()
+        self.EndModal(wx.ID_YES)
+        event.Skip()

Modified: grass/branches/releasebranch_7_0/gui/wxpython/gui_core/ghelp.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gui_core/ghelp.py	2015-12-19 10:35:57 UTC (rev 67244)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gui_core/ghelp.py	2015-12-19 10:45:15 UTC (rev 67245)
@@ -9,7 +9,7 @@
  - ghelp::HelpWindow
  - ghelp::HelpPanel
 
-(C) 2008-2014 by the GRASS Development Team
+(C) 2008-2015 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.

Modified: grass/branches/releasebranch_7_0/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/lmgr/frame.py	2015-12-19 10:35:57 UTC (rev 67244)
+++ grass/branches/releasebranch_7_0/gui/wxpython/lmgr/frame.py	2015-12-19 10:45:15 UTC (rev 67245)
@@ -8,7 +8,7 @@
 Classes:
  - frame::GMFrame
 
-(C) 2006-2014 by the GRASS Development Team
+(C) 2006-2015 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -57,7 +57,7 @@
 from core.giface           import Notification
 from gui_core.goutput      import GConsoleWindow, GC_SEARCH, GC_PROMPT
 from gui_core.dialogs      import GdalOutputDialog, DxfImportDialog, GdalImportDialog, MapLayersDialog
-from gui_core.dialogs      import LocationDialog, MapsetDialog, CreateNewVector, GroupDialog
+from gui_core.dialogs      import LocationDialog, MapsetDialog, CreateNewVector, GroupDialog, QuitDialog
 from modules.colorrules    import RasterColorTable, VectorColorTable
 from gui_core.menu         import Menu, SearchModuleWindow
 from gmodeler.model        import Model
@@ -2197,17 +2197,9 @@
 
         Ask user also to quit GRASS including terminal
         """
-        dlg = wx.MessageDialog(self,
-                               message = _("Do you want to quit GRASS GIS?\n\n"
-                                           "Press 'Yes' to quit GRASS GUI and shell.\n"
-                                           "Press 'No' to close only GRASS GUI.\n"
-                                           "Press 'Cancel' to cancel this operation."),
-                               caption = _("Quit GRASS GIS?"),
-                               style = wx.YES_NO | wx.YES_DEFAULT |
-                               wx.CANCEL | wx.ICON_QUESTION | wx.CENTRE)
+        dlg = QuitDialog(self)
         ret = dlg.ShowModal()
         dlg.Destroy()
-
         if ret != wx.ID_CANCEL:
             self._closeWindow()
             if ret == wx.ID_YES:



More information about the grass-commit mailing list