[GRASS-SVN] r35730 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 1 17:18:26 EST 2009


Author: martinl
Date: 2009-02-01 17:18:26 -0500 (Sun, 01 Feb 2009)
New Revision: 35730

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: multiple layer selection fixes (cont'ed)
      (merge from relbr64, r35728)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py	2009-02-01 22:16:36 UTC (rev 35729)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py	2009-02-01 22:18:26 UTC (rev 35730)
@@ -362,6 +362,8 @@
                 self.Bind (wx.EVT_MENU, self.OnNvizProperties, id=self.popupID11)
 
             if numSelected > 1:
+                self.popupMenu.Enable(self.popupID12, False)
+                self.popupMenu.Enable(self.popupID13, False)
                 self.popupMenu.Enable(self.popupID15, False)
                 self.popupMenu.Enable(self.popupID4, False)
                 self.popupMenu.Enable(self.popupID5, False)
@@ -401,19 +403,28 @@
          
     def OnSetCompRegFromMap(self, event):
         """Set computational region from selected raster/vector map"""
-        mapLayer = self.GetPyData(self.layer_selected)[0]['maplayer']
-        mltype = self.GetPyData(self.layer_selected)[0]['type']
-        
+        rast = []
+        vect = []
+        rast3d = []
+        for layer in self.GetSelections():
+            mapLayer = self.GetPyData(layer)[0]['maplayer']
+            mltype = self.GetPyData(layer)[0]['type']
+                
+            if mltype == 'raster':
+                rast.append(mapLayer.name)
+            elif mltype == 'vector':
+                vect.append(mapLayer.name)
+            elif mltype == '3d-raster':
+                rast3d.append(mapLayer.name)
+
         cmd = ['g.region']
+        if rast:
+            cmd.append('rast=%s' % ','.join(rast))
+        if vect:
+            cmd.append('vect=%s' % ','.join(vect))
+        if rast3d:
+            cmd.append('rast3d=%s' % ','.join(rast3d))
         
-        # TODO: other elements
-        if mltype == 'raster':
-            cmd.append('rast=%s' % mapLayer.name)
-        elif mltype == 'vector':
-            cmd.append('vect=%s' % mapLayer.name)
-        elif mltype == '3d-raster':
-            cmd.append('rast3d=%s' % mapLayer.name)
-
         # print output to command log area
         if len(cmd) > 1:
             cmd.append('-p')



More information about the grass-commit mailing list