Kaynağa Gözat

wxGUI/modeler: don't use fully qualified names

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@41840 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 yıl önce
ebeveyn
işleme
0e6c8c3a6a
1 değiştirilmiş dosya ile 20 ekleme ve 4 silme
  1. 20 4
      gui/wxpython/gui_modules/gmodeler.py

+ 20 - 4
gui/wxpython/gui_modules/gmodeler.py

@@ -561,17 +561,30 @@ if __name__ == "__main__":
         
     def GetOptData(self, dcmd, layer, params, propwin):
         """!Process action data"""
-        if dcmd:
-            layer.SetProperties(dcmd, params, propwin)
-        
         if params: # add data items
+            for p in params['params']:
+                if p.get('prompt', '') in ('raster', 'vector', 'raster3d'):
+                    try:
+                        name, mapset = p.get('value', '').split('@', 1)
+                    except IndexError:
+                        continue
+                    
+                    if mapset != grass.gisenv()['MAPSET']:
+                        continue
+                    
+                    # don't use fully qualified names
+                    p['value'] = p.get('value', '').split('@')[0]
+                    for idx in range(1, len(dcmd)):
+                        if p.get('name', '') in dcmd[idx]:
+                            dcmd[idx] = p.get('name', '') + '=' + p.get('value', '')
+                            break
+            
             width, height = self.canvas.GetSize()
             x = [width/2 + 200, width/2 - 200]
             for p in params['params']:
                 if p.get('prompt', '') in ('raster', 'vector', 'raster3d') and \
                         (p.get('value', None) or \
                              p.get('age', 'old') != 'old'):
-                    # create data item
                     data = layer.FindData(p.get('name', ''))
                     if data:
                         data.SetValue(p.get('value', ''))
@@ -618,6 +631,9 @@ if __name__ == "__main__":
             
             self.canvas.Refresh()
         
+        if dcmd:
+            layer.SetProperties(dcmd, params, propwin)
+            
         self.SetStatusText(layer.GetLog(), 0)
         
     def _addLine(self, fromShape, toShape):