[GRASS-SVN] r59209 - grass/trunk/gui/wxpython/lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 7 05:37:44 PST 2014


Author: annakrat
Date: 2014-03-07 05:37:44 -0800 (Fri, 07 Mar 2014)
New Revision: 59209

Modified:
   grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI: fix error which happens when layertree is empty and you press a key

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2014-03-07 09:11:00 UTC (rev 59208)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2014-03-07 13:37:44 UTC (rev 59209)
@@ -209,6 +209,7 @@
         self.Bind(wx.EVT_TREE_END_DRAG,         self.OnEndDrag)
         self.Bind(wx.EVT_TREE_END_LABEL_EDIT,   self.OnRenamed)
         self.Bind(wx.EVT_KEY_UP,                self.OnKeyUp)
+        self.Bind(wx.EVT_KEY_DOWN,                self.OnKeyDown)
         self.Bind(wx.EVT_IDLE,                  self.OnIdle)
         self.Bind(wx.EVT_MOTION,                self.OnMotion)
 
@@ -362,7 +363,11 @@
             self.lmgr.OnDeleteLayer(None)
         
         event.Skip()
-        
+
+    def OnKeyDown(self, event):
+        """!Skip event, otherwise causing error when layertree is empty"""
+        event.Skip()
+
     def OnLayerContextMenu (self, event):
         """!Contextual menu for item/layer"""
         if not self.layer_selected:



More information about the grass-commit mailing list