[GRASS-SVN] r64856 - in grass/trunk/gui/wxpython: gui_core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 14 11:01:33 PDT 2015


Author: martinl
Date: 2015-03-14 11:01:33 -0700 (Sat, 14 Mar 2015)
New Revision: 64856

Modified:
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/lmgr/giface.py
Log:
wxGUI: LayerList - add __len__()


Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2015-03-14 17:55:55 UTC (rev 64855)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2015-03-14 18:01:33 UTC (rev 64856)
@@ -1206,7 +1206,7 @@
                                 extraItems = {_('Graphical Modeler') : self._giface.GetLayerList(p.get('prompt'))}
                             else:
                                 layers = self._giface.GetLayerList()
-                                if layers:
+                                if len(layers) > 0:
                                     mapList = []
                                     extraItems = {_('Map Display') : mapList}
                                     for layer in layers:

Modified: grass/trunk/gui/wxpython/lmgr/giface.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/giface.py	2015-03-14 17:55:55 UTC (rev 64855)
+++ grass/trunk/gui/wxpython/lmgr/giface.py	2015-03-14 18:01:33 UTC (rev 64856)
@@ -47,6 +47,9 @@
     def __init__(self, tree):
         self._tree = tree
 
+    def __len__(self):
+        return len([layer for layer in self])
+        
     def __iter__(self):
         """Iterates over the contents of the list."""
         item = self._tree.GetFirstChild(self._tree.root)[0]



More information about the grass-commit mailing list