[GRASS-SVN] r38336 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 9 14:34:48 EDT 2009
Author: martinl
Date: 2009-07-09 14:34:48 -0400 (Thu, 09 Jul 2009)
New Revision: 38336
Modified:
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
Log:
attempt to fix trac #483
(merge from relbr64, r38334)
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-07-09 18:25:06 UTC (rev 38335)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-07-09 18:34:48 UTC (rev 38336)
@@ -1362,7 +1362,7 @@
vectstr += "%s," % name
# use display region settings instead of computation region settings
- tmpreg = os.getenv("GRASS_REGION")
+ self.tmpreg = os.getenv("GRASS_REGION")
os.environ["GRASS_REGION"] = self.Map.SetRegion(windres=False)
# build query commands for any selected rasters and vectors
@@ -1398,19 +1398,33 @@
if self._layerManager:
if raststr:
self._layerManager.goutput.RunCmd(rcmd,
- compReg=False)
+ compReg=False,
+ onDone = self._QueryMapDone)
if vectstr:
- self._layerManager.goutput.RunCmd(vcmd)
+ self._layerManager.goutput.RunCmd(vcmd,
+ onDone = self._QueryMapDone)
else:
if raststr:
gcmd.RunCommand(rcmd)
if vectstr:
gcmd.RunCommand(vcmd)
+
+ def _QueryMapDone(self, returncode):
+ """!Restore settings after querying (restore GRASS_REGION)
- # restore GRASS_REGION
- if tmpreg:
- os.environ["GRASS_REGION"] = tmpreg
+ @param returncode command return code
+ """
+ if hasattr(self, "tmpreg"):
+ if self.tmpreg:
+ os.environ["GRASS_REGION"] = self.tmpreg
+ elif os.environ.has_key('GRASS_REGION'):
+ del os.environ["GRASS_REGION"]
+ elif os.environ.has_key('GRASS_REGION'):
+ del os.environ["GRASS_REGION"]
+ if hasattr(self, "tmpreg"):
+ del self.tmpreg
+
def QueryVector(self, x, y):
"""
Query vector map layer features
More information about the grass-commit
mailing list