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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 14 10:55:55 PDT 2015


Author: martinl
Date: 2015-03-14 10:55:55 -0700 (Sat, 14 Mar 2015)
New Revision: 64855

Modified:
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/lmgr/giface.py
Log:
wxGUI: gselect.Select() - show grouped maps from map display


Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2015-03-14 14:46:29 UTC (rev 64854)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2015-03-14 17:55:55 UTC (rev 64855)
@@ -1199,11 +1199,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 layers:
+                                    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/trunk/gui/wxpython/lmgr/giface.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/giface.py	2015-03-14 14:46:29 UTC (rev 64854)
+++ grass/trunk/gui/wxpython/lmgr/giface.py	2015-03-14 17:55:55 UTC (rev 64855)
@@ -49,9 +49,11 @@
 
     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