[GRASS-SVN] r63739 - grass/trunk/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 24 11:10:29 PST 2014


Author: martinl
Date: 2014-12-24 11:10:29 -0800 (Wed, 24 Dec 2014)
New Revision: 63739

Modified:
   grass/trunk/gui/wxpython/gui_core/mapdisp.py
Log:
wxGUI: close also standalone monitor on Ctrl+W

Modified: grass/trunk/gui/wxpython/gui_core/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/mapdisp.py	2014-12-24 17:39:59 UTC (rev 63738)
+++ grass/trunk/gui/wxpython/gui_core/mapdisp.py	2014-12-24 19:10:29 UTC (rev 63739)
@@ -23,7 +23,6 @@
 import sys
 
 import wx
-import wx.aui
 
 from core        import globalvar
 from core.debug  import Debug
@@ -93,7 +92,8 @@
         # Fancy gui
         #
         if auimgr == None:
-            self._mgr = wx.aui.AuiManager(self)
+            from wx.aui import AuiManager
+            self._mgr = AuiManager(self)
         else:
             self._mgr = auimgr
         
@@ -101,11 +101,14 @@
         self._toolSwitcher = ToolSwitcher()
         self._toolSwitcher.toggleToolChanged.connect(self._onToggleTool)
 
-        # set accelerator table for fullscreen
-        fullScreenId = wx.NewId()
-        self.Bind(wx.EVT_MENU, self.OnFullScreen, id=fullScreenId)
-        accelTable = wx.AcceleratorTable([(wx.ACCEL_NORMAL, wx.WXK_F11, fullScreenId)])
-        self.SetAcceleratorTable(accelTable)
+        # set accelerator table (fullscreen, close window)
+        accelTable = []
+        for wxId, handler, entry, kdb in ((wx.NewId(), self.OnFullScreen, wx.ACCEL_NORMAL, wx.WXK_F11),
+                                          (wx.NewId(), self.OnCloseWindow, wx.ACCEL_CTRL, ord('W'))):
+            self.Bind(wx.EVT_MENU, handler, id=wxId)
+            accelTable.append((entry, kdb, wxId))
+        
+        self.SetAcceleratorTable(wx.AcceleratorTable(accelTable))
 
     def _initMap(self, Map):
         """Initialize map display, set dimensions and map region
@@ -146,6 +149,9 @@
         self.ShowFullScreen(not self.IsFullScreen())
         event.Skip()
 
+    def OnCloseWindow(self, event):
+        self.Destroy()
+        
     def GetToolSwitcher(self):
         return self._toolSwitcher
 



More information about the grass-commit mailing list