|
@@ -16,6 +16,7 @@ List of classes:
|
|
|
- :class:`ImageSizeDialog`
|
|
|
- :class:`SqlQueryFrame`
|
|
|
- :class:`SymbolDialog`
|
|
|
+ - :class:`QuitDialog`
|
|
|
|
|
|
(C) 2008-2015 by the GRASS Development Team
|
|
|
|
|
@@ -2096,3 +2097,57 @@ class HyperlinkDialog(wx.Dialog):
|
|
|
|
|
|
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()
|