[GRASS-SVN] r41966 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 22 04:13:39 EDT 2010


Author: martinl
Date: 2010-04-22 04:13:14 -0400 (Thu, 22 Apr 2010)
New Revision: 41966

Modified:
   grass/trunk/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI: fix _addLayers()


Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2010-04-22 07:53:58 UTC (rev 41965)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py	2010-04-22 08:13:14 UTC (rev 41966)
@@ -715,7 +715,7 @@
         wx.Dialog.__init__(self, parent=parent, id=wx.ID_ANY, title=title, style=style)
 
         self.parent = parent # GMFrame
-
+        
         #
         # dialog body
         #
@@ -935,8 +935,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)
@@ -1386,32 +1388,35 @@
         
     def _addLayers(self, returncode):
         """!Add imported/linked layers into 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='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])
+        
+        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