[GRASS-SVN] r48443 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 24 07:35:16 EDT 2011


Author: martinl
Date: 2011-09-24 04:35:16 -0700 (Sat, 24 Sep 2011)
New Revision: 48443

Modified:
   grass/trunk/gui/wxpython/gui_modules/layertree.py
Log:
wxGUI: force rename when adding group to the Layer Tree


Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-09-24 11:34:29 UTC (rev 48442)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-09-24 11:35:16 UTC (rev 48443)
@@ -700,9 +700,13 @@
         
     def OnRenamed(self, event):
         """!Layer renamed"""
+        if not event.GetLabel():
+            event.Skip()
+            return
+        
         item = self.layer_selected
         self.GetPyData(item)[0]['label'] = event.GetLabel()
-        self.SetItemText(item, self._getLayerName(item)) # not working, why?
+        self.SetItemText(item, self._getLayerName(item))
         
         event.Skip()
 
@@ -924,9 +928,12 @@
                 ctrl.SetValue(lname)
             else:
                 self.SetItemText(layer, self._getLayerName(layer, lname))
+        else:
+            if ltype == 'group':
+                self.OnRenameLayer(None)
         
         # updated progress bar range (mapwindow statusbar)
-        if checked is True:
+        if checked:
             self.mapdisplay.statusbarWin['progress'].SetRange(len(self.Map.GetListOfLayers(l_active = True)))
             
         return layer
@@ -1413,6 +1420,9 @@
         @param lname optional layer name
         """
         mapLayer = self.GetPyData(item)[0]['maplayer']
+        if not mapLayer:
+            return lname
+        
         if not lname:
             lname  = self.GetPyData(item)[0]['label']
         opacity  = int(mapLayer.GetOpacity(float = True) * 100)



More information about the grass-commit mailing list