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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 22 04:18:20 EDT 2010


Author: martinl
Date: 2010-04-22 04:18:08 -0400 (Thu, 22 Apr 2010)
New Revision: 41967

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI: fix _addLayers()
(merge r41966 from trunk)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py	2010-04-22 08:13:14 UTC (rev 41966)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py	2010-04-22 08:18:08 UTC (rev 41967)
@@ -609,7 +609,7 @@
         wx.Dialog.__init__(self, parent=parent, id=wx.ID_ANY, title=title, style=style)
 
         self.parent = parent # GMFrame
-
+        
         #
         # dialog body
         #
@@ -813,8 +813,10 @@
 
         self.parent = parent # GMFrame 
         self.importType = type
-        self.link = link     # Link or import data (only for GDAL/OGR)
+        self.link = link     # Link or import data (only for GDAL/OGR) 
         
+        self.commandId = -1  # id of running command
+       
         wx.Dialog.__init__(self, parent, id, title, style=style)
 
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
@@ -1264,32 +1266,35 @@
         
     def _addLayers(self, returncode):
         """!Add imported/linked layers to layer tree"""
+        self.commandId += 1
+        
         if not self.add.IsChecked():
             return
 
-        data = self.list.GetLayers()
         maptree = self.parent.curr_page.maptree
-        for layer, output in data:
-            if '@' not in output:
-                name = output + '@' + grass.gisenv()['MAPSET']
-            else:
-                name = output
-            # add imported layers into layer tree
-            if self.importType == 'gdal':
-                cmd = ['d.rast',
-                       'map=%s' % name]
-                if UserSettings.Get(group='cmd', key='rasterOverlay', subkey='enabled'):
-                    cmd.append('-o')
-                    
-                maptree.AddLayer(ltype='raster',
-                                 lname=name,
-                                 lcmd=cmd)
-            else:
-                maptree.AddLayer(ltype='vector',
-                                 lname=name,
-                                 lcmd=['d.vect',
-                                       'map=%s' % name])
         
+        layer, output = self.list.GetLayers()[self.commandId]
+        
+        if '@' not in output:
+            name = output + '@' + grass.gisenv()['MAPSET']
+        else:
+            name = output
+        # add imported layers into layer tree
+        if self.importType == 'gdal':
+            cmd = ['d.rast',
+                   'map=%s' % name]
+            if UserSettings.Get(group='cmd', key='rasterOpaque', subkey='enabled'):
+                cmd.append('-n')
+            
+            maptree.AddLayer(ltype='raster',
+                             lname=name,
+                             lcmd=cmd)
+        else:
+            maptree.AddLayer(ltype='vector',
+                             lname=name,
+                             lcmd=['d.vect',
+                                   'map=%s' % name])
+        
     def OnAbort(self, event):
         """!Abort running import
 



More information about the grass-commit mailing list