[GRASS-SVN] r32832 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 17 01:46:17 EDT 2008
Author: cmbarton
Date: 2008-08-17 01:46:17 -0400 (Sun, 17 Aug 2008)
New Revision: 32832
Modified:
grass/trunk/gui/wxpython/gui_modules/render.py
Log:
Backport from develbranch_6. Bug fix for layering rendering problem.
Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py 2008-08-17 05:43:51 UTC (rev 32831)
+++ grass/trunk/gui/wxpython/gui_modules/render.py 2008-08-17 05:46:17 UTC (rev 32832)
@@ -30,6 +30,7 @@
compatPath = os.path.join(globalvar.ETCWXDIR, "compat")
sys.path.append(compatPath)
import subprocess
+import tempfile
import wx
@@ -80,8 +81,15 @@
self.opacity, self.hidden))
# generated file for layer
- self.gtemp = utils.GetTempfile()
+ #self.gtemp = utils.GetTempfile()
+ #self.gtemp = os.tmpfile()
+ #self.maskfile = self.gtemp + ".pgm"
+ self.gtemp = tempfile.mkstemp()[1]
self.maskfile = self.gtemp + ".pgm"
+ if self.type == 'overlay':
+ self.mapfile = self.gtemp + ".png"
+ else:
+ self.mapfile = self.gtemp + ".ppm"
def __del__(self):
Debug.msg (3, "Layer.__del__(): layer=%s, cmd='%s'" %
@@ -106,13 +114,14 @@
#
# to be sure, set temporary file with layer and mask
#
- if not self.gtemp:
- gtemp = utils.GetTempfile()
- self.maskfile = gtemp + ".pgm"
- if self.type == 'overlay':
- self.mapfile = gtemp + ".png"
- else:
- self.mapfile = gtemp + ".ppm"
+ #if not self.gtemp:
+ #gtemp = utils.GetTempfile()
+ #gtemp = tempfile.mkstemp()[1]
+ #self.maskfile = gtemp + ".pgm"
+ #if self.type == 'overlay':
+ # self.mapfile = gtemp + ".png"
+ #else:
+ # self.mapfile = gtemp + ".ppm"
#
# prepare command for each layer
@@ -138,7 +147,7 @@
else:
if self.mapfile:
os.environ["GRASS_PNGFILE"] = self.mapfile
-
+
#
# execute command
#
@@ -274,7 +283,7 @@
Layer.__init__(self, type, cmd, name,
active, hidden, opacity)
- self.mapfile = self.gtemp + ".ppm"
+ #self.mapfile = self.gtemp + ".ppm"
def GetMapset(self):
"""
@@ -308,7 +317,7 @@
active, hidden, opacity)
self.id = id
- self.mapfile = self.gtemp + ".png"
+ #self.mapfile = self.gtemp + ".png"
class Map(object):
"""
@@ -838,31 +847,31 @@
Debug.msg (3, "Map.Render() type=%s, layer=%s " % (layer.type, layer.name))
- # ugly hack for MSYS
- if not subprocess.mswindows:
- mapstr = ",".join(maps)
- maskstr = ",".join(masks)
+ # ugly hack for MSYS
+ if not subprocess.mswindows:
+ mapstr = ",".join(maps)
+ maskstr = ",".join(masks)
mapoutstr = self.mapfile
- else:
- mapstr = ""
- for item in maps:
+ else:
+ mapstr = ""
+ for item in maps:
mapstr += item.replace('\\', '/')
- mapstr = mapstr.rstrip(',')
- maskstr = ""
+ mapstr = mapstr.rstrip(',')
+ maskstr = ""
for item in masks:
- maskstr += item.replace('\\', '/')
- maskstr = maskstr.rstrip(',')
- mapoutstr = self.mapfile.replace('\\', '/')
+ maskstr += item.replace('\\', '/')
+ maskstr = maskstr.rstrip(',')
+ mapoutstr = self.mapfile.replace('\\', '/')
# compose command
complist = ["g.pnmcomp",
- "in=%s" % ",".join(maps),
- "mask=%s" % ",".join(masks),
- "opacity=%s" % ",".join(opacities),
- "background=255:255:255",
- "width=%s" % str(self.width),
- "height=%s" % str(self.height),
- "output=%s" % self.mapfile]
+ "in=%s" % ",".join(maps),
+ "mask=%s" % ",".join(masks),
+ "opacity=%s" % ",".join(opacities),
+ "background=255:255:255",
+ "width=%s" % str(self.width),
+ "height=%s" % str(self.height),
+ "output=%s" % self.mapfile]
# render overlays
More information about the grass-commit
mailing list