فهرست منبع

wxGUI: gselect.Select() - show grouped maps from map display

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64855 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 سال پیش
والد
کامیت
04611ac78c
2فایلهای تغییر یافته به همراه18 افزوده شده و 7 حذف شده
  1. 14 5
      gui/wxpython/gui_core/forms.py
  2. 4 2
      gui/wxpython/lmgr/giface.py

+ 14 - 5
gui/wxpython/gui_core/forms.py

@@ -1199,11 +1199,20 @@ class CmdPanel(wx.Panel):
                                 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', [])),

+ 4 - 2
gui/wxpython/lmgr/giface.py

@@ -49,9 +49,11 @@ class LayerList(object):
 
     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]