[GRASS-SVN] r64921 - in grass/branches/releasebranch_7_0/gui/wxpython: gui_core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 25 13:26:02 PDT 2015


Author: martinl
Date: 2015-03-25 13:26:02 -0700 (Wed, 25 Mar 2015)
New Revision: 64921

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/gui_core/forms.py
   grass/branches/releasebranch_7_0/gui/wxpython/lmgr/giface.py
Log:
wxGUI: gselect.Select() - show grouped maps from map display
       LayerList - add len()
       (merge r64855:6 from trunk)


Modified: grass/branches/releasebranch_7_0/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gui_core/forms.py	2015-03-25 20:12:49 UTC (rev 64920)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gui_core/forms.py	2015-03-25 20:26:02 UTC (rev 64921)
@@ -1200,11 +1200,20 @@
                                 if maps_param and orig_elem == 'stds':
                                     element_dict = {'raster': 'strds', 'vector': 'stvds', 'raster_3d': 'str3ds'}
                                     elem = element_dict[type_param.get('default')]
-                        
-                        if self._giface and hasattr(self._giface, "_model"):
-                            extraItems = {_('Graphical Modeler') : self._giface.GetLayerList(p.get('prompt'))}
-                        else:
-                            extraItems = None
+
+                        extraItems = None
+                        if self._giface:
+                            if hasattr(self._giface, "_model"):
+                                extraItems = {_('Graphical Modeler') : self._giface.GetLayerList(p.get('prompt'))}
+                            else:
+                                layers = self._giface.GetLayerList()
+                                if len(layers) > 0:
+                                    mapList = []
+                                    extraItems = {_('Map Display') : mapList}
+                                    for layer in layers:
+                                        if layer.type != p.get('prompt'):
+                                            continue
+                                        mapList.append(str(layer))
                         selection = gselect.Select(parent = which_panel, id = wx.ID_ANY,
                                                    size = globalvar.DIALOG_GSELECT_SIZE,
                                                    type = elem, multiple = multiple, nmaps = len(p.get('key_desc', [])),

Modified: grass/branches/releasebranch_7_0/gui/wxpython/lmgr/giface.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/lmgr/giface.py	2015-03-25 20:12:49 UTC (rev 64920)
+++ grass/branches/releasebranch_7_0/gui/wxpython/lmgr/giface.py	2015-03-25 20:26:02 UTC (rev 64921)
@@ -47,11 +47,16 @@
     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."""
-        for item in self._tree.GetSelectedLayer(multi=True):
+        item = self._tree.GetFirstChild(self._tree.root)[0]
+        while item and item.IsOk():
             yield Layer(self._tree.GetPyData(item))
-
+            item = self._tree.GetNextItem(item)
+        
     def __getitem__(self, index):
         """Select a layer from the LayerList using the index."""
         return [l for l in self][index]



More information about the grass-commit mailing list