[GRASS-SVN] r35728 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 1 17:15:08 EST 2009


Author: martinl
Date: 2009-02-01 17:15:08 -0500 (Sun, 01 Feb 2009)
New Revision: 35728

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: multiple layer selection fixes (cont'ed)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py	2009-02-01 22:14:44 UTC (rev 35727)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py	2009-02-01 22:15:08 UTC (rev 35728)
@@ -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