[GRASS-SVN] r41964 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Apr 22 03:42:42 EDT 2010
Author: martinl
Date: 2010-04-22 03:42:33 -0400 (Thu, 22 Apr 2010)
New Revision: 41964
Modified:
grass/trunk/gui/wxpython/gui_modules/gdialogs.py
Log:
wxGUI: add layer when import is finished
Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2010-04-22 07:33:13 UTC (rev 41963)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2010-04-22 07:42:33 UTC (rev 41964)
@@ -1379,35 +1379,39 @@
cmd.append('--overwrite')
# run in Layer Manager
- self.parent.goutput.RunCmd(cmd, switchPage=True)
-
- if self.add.IsChecked():
- 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])
+ self.parent.goutput.RunCmd(cmd, switchPage=True,
+ onDone = self._addLayers)
- ### wx.CallAfter(self.parent.notebook.SetSelection, 0)
-
self.OnCancel()
+ def _addLayers(self, returncode):
+ """!Add imported/linked layers into layer tree"""
+ 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])
+
def OnAbort(self, event):
"""!Abort running import
More information about the grass-commit
mailing list