[GRASS-SVN] r39037 - in grass/trunk/gui/wxpython: . gui_modules icons

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 6 02:44:19 EDT 2009


Author: martinl
Date: 2009-09-06 02:44:19 -0400 (Sun, 06 Sep 2009)
New Revision: 39037

Modified:
   grass/trunk/gui/wxpython/gui_modules/prompt.py
   grass/trunk/gui/wxpython/icons/icon.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: new hotkeys (Alt+R/V) to raster/vector map layer


Modified: grass/trunk/gui/wxpython/gui_modules/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-09-06 01:01:39 UTC (rev 39036)
+++ grass/trunk/gui/wxpython/gui_modules/prompt.py	2009-09-06 06:44:19 UTC (rev 39037)
@@ -556,8 +556,7 @@
         event.Skip()
         
     def OnKeyDown (self, event):
-        """
-        Do some work when the user press on the keys: up and down:
+        """!Do some work when the user press on the keys: up and down:
         move the cursor left and right: move the search
         """
         skip = True

Modified: grass/trunk/gui/wxpython/icons/icon.py
===================================================================
--- grass/trunk/gui/wxpython/icons/icon.py	2009-09-06 01:01:39 UTC (rev 39036)
+++ grass/trunk/gui/wxpython/icons/icon.py	2009-09-06 06:44:19 UTC (rev 39037)
@@ -187,9 +187,9 @@
                                 label=_("Save current workspace to file")),
     # TODO: "layer" is not conformant with GRASS vocabulary (vector layer: 1..x) ! 
     "addrast"    : MetaIcon (img=Icons["addrast"],
-                             label=_("Add raster map layer")),
+                             label=_("Add raster map layer (Alt+R)")),
     "addvect"    : MetaIcon (img=Icons["addvect"],
-                             label=_("Add vector map layer")),
+                             label=_("Add vector map layer (Alt+V)")),
     "addcmd"     : MetaIcon (img=Icons["addcmd"],
                              label=_("Add command layer")),
     "addgrp"     : MetaIcon (img=Icons["addgrp"],

Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2009-09-06 01:01:39 UTC (rev 39036)
+++ grass/trunk/gui/wxpython/wxgui.py	2009-09-06 06:44:19 UTC (rev 39037)
@@ -137,8 +137,8 @@
         self.toolbar   = self.__createToolBar()
         
         # bindings
-        self.Bind(wx.EVT_CLOSE,     self.OnCloseWindow)
-        self.Bind(wx.EVT_LEFT_DOWN, self.AddRaster, self.notebook)
+        self.Bind(wx.EVT_CLOSE,    self.OnCloseWindow)
+        self.Bind(wx.EVT_KEY_UP,   self.OnKey)
 
         # minimal frame size
         self.SetMinSize((500, 400))
@@ -1428,6 +1428,22 @@
                 self.curr_page.maptree.DeleteChildren(layer)
             self.curr_page.maptree.Delete(layer)
         
+    def OnKey(self, event):
+        """!Check hotkey"""
+        try:
+            kc = chr(event.GetKeyCode())
+        except ValueError:
+            event.Skip()
+            return
+        
+        if event.AltDown():
+            if kc == 'R':
+                self.OnAddRaster(None)
+            elif kc == 'V':
+                self.OnAddVector(None)
+        
+        event.Skip()
+        
     def OnCloseWindow(self, event):
         """!Cleanup when wxGUI is quit"""
         if not self.curr_page:



More information about the grass-commit mailing list