Преглед изворни кода

wxGUI: new hotkeys (Alt+R/V) to raster/vector map layer

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39037 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa пре 15 година
родитељ
комит
a065dac9fd
3 измењених фајлова са 21 додато и 6 уклоњено
  1. 1 2
      gui/wxpython/gui_modules/prompt.py
  2. 2 2
      gui/wxpython/icons/icon.py
  3. 18 2
      gui/wxpython/wxgui.py

+ 1 - 2
gui/wxpython/gui_modules/prompt.py

@@ -556,8 +556,7 @@ class TextCtrlAutoComplete(wx.ComboBox, listmix.ColumnSorterMixin):
         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

+ 2 - 2
gui/wxpython/icons/icon.py

@@ -187,9 +187,9 @@ Icons = {
                                 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"],

+ 18 - 2
gui/wxpython/wxgui.py

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