[GRASS-SVN] r68398 - grass/trunk/gui/wxpython/core
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 7 19:13:17 PDT 2016
Author: wenzeslaus
Date: 2016-05-07 19:13:17 -0700 (Sat, 07 May 2016)
New Revision: 68398
Modified:
grass/trunk/gui/wxpython/core/gconsole.py
grass/trunk/gui/wxpython/core/giface.py
Log:
wxGUI: add environment paramater to GConsole
Modified: grass/trunk/gui/wxpython/core/gconsole.py
===================================================================
--- grass/trunk/gui/wxpython/core/gconsole.py 2016-05-07 21:32:41 UTC (rev 68397)
+++ grass/trunk/gui/wxpython/core/gconsole.py 2016-05-08 02:13:17 UTC (rev 68398)
@@ -431,7 +431,7 @@
"""Write message in error style"""
self.writeError.emit(text=text)
- def RunCmd(self, command, compReg=True, skipInterface=False,
+ def RunCmd(self, command, compReg=True, env=None, skipInterface=False,
onDone=None, onPrepare=None, userData=None, addLayer=None,
notification=Notification.MAKE_VISIBLE):
"""Run command typed into console command prompt (GPrompt).
@@ -542,12 +542,14 @@
return
+ if env:
+ env = env.copy()
+ else:
+ env = os.environ.copy()
# activate computational region (set with g.region)
# for all non-display commands.
- if compReg:
- tmpreg = os.getenv("GRASS_REGION")
- if "GRASS_REGION" in os.environ:
- del os.environ["GRASS_REGION"]
+ if compReg and "GRASS_REGION" in env:
+ del env["GRASS_REGION"]
# process GRASS command with argument
self.cmdThread.RunCmd(command,
@@ -555,14 +557,12 @@
stderr=self.cmdStdErr,
onDone=onDone, onPrepare=onPrepare,
userData=userData, addLayer=addLayer,
- env=os.environ.copy(),
+ env=env,
notification=notification)
self.cmdOutputTimer.Start(50)
- # deactivate computational region and return to display
- # settings
- if compReg and tmpreg:
- os.environ["GRASS_REGION"] = tmpreg
+ # we don't need to change computational region settings
+ # because we work on a copy
else:
# Send any other command to the shell. Send output to
# console output window
@@ -609,6 +609,7 @@
stderr=self.cmdStdErr,
onDone=onDone, onPrepare=onPrepare,
userData=userData, addLayer=addLayer,
+ env=env,
notification=notification)
self.cmdOutputTimer.Start(50)
Modified: grass/trunk/gui/wxpython/core/giface.py
===================================================================
--- grass/trunk/gui/wxpython/core/giface.py 2016-05-07 21:32:41 UTC (rev 68397)
+++ grass/trunk/gui/wxpython/core/giface.py 2016-05-08 02:13:17 UTC (rev 68398)
@@ -246,13 +246,13 @@
grass.percent(event.value, 100, 1)
event.Skip()
- def RunCmd(
- self, command, compReg=True, skipInterface=False, onDone=None,
- onPrepare=None, userData=None,
- notification=Notification.MAKE_VISIBLE):
+ def RunCmd(self, command, compReg=True, env=None, skipInterface=False,
+ onDone=None, onPrepare=None, userData=None,
+ notification=Notification.MAKE_VISIBLE):
self._gconsole.RunCmd(
command=command,
compReg=compReg,
+ env=env,
skipInterface=skipInterface,
onDone=onDone,
onPrepare=onPrepare,
More information about the grass-commit
mailing list