[GRASS-SVN] r65309 - in grass/trunk/gui/wxpython: core mapdisp
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri May 22 01:45:35 PDT 2015
Author: martinl
Date: 2015-05-22 01:45:35 -0700 (Fri, 22 May 2015)
New Revision: 65309
Modified:
grass/trunk/gui/wxpython/core/render.py
grass/trunk/gui/wxpython/core/ws.py
grass/trunk/gui/wxpython/mapdisp/main.py
Log:
wxGUI: fix zooming in wx monitors together with d.frame
Modified: grass/trunk/gui/wxpython/core/render.py
===================================================================
--- grass/trunk/gui/wxpython/core/render.py 2015-05-22 08:42:12 UTC (rev 65308)
+++ grass/trunk/gui/wxpython/core/render.py 2015-05-22 08:45:35 UTC (rev 65309)
@@ -105,8 +105,6 @@
self.forceRender = render
- self.render_env = { "GRASS_RENDER_FILE": self.mapfile }
-
Debug.msg (3, "Layer.__init__(): type=%s, cmd='%s', name=%s, " \
"active=%d, opacity=%d, hidden=%d" % \
(self.type, self.GetCmd(string=True), self.name,
@@ -147,7 +145,6 @@
if not env:
env = os.environ.copy()
- env.update(self.render_env)
# render layers
try:
@@ -250,11 +247,16 @@
raise GException(_("Unsupported map layer type '%s'") % ltype)
if not self.renderMgr:
+ env = {}
if ltype == 'wms':
renderMgr = RenderWMSMgr
else:
renderMgr = RenderLayerMgr
- self.renderMgr = renderMgr(self)
+ env['GRASS_RENDER_FILE'] = self.mapfile
+ if ltype == 'overlay':
+ env['GRASS_RENDER_FILE_READ'] = 'FALSE'
+ env['GRASS_RENDER_TRANSPARENT'] = 'TRUE'
+ self.renderMgr = renderMgr(self, env)
self.type = ltype
@@ -332,11 +334,9 @@
"""
Layer.__init__(self, ltype='overlay', *args, **kwargs)
self.id = id
- self.render_env["GRASS_RENDER_FILE_READ"] = "FALSE"
- self.render_env["GRASS_RENDER_TRANSPARENT"] = "TRUE"
class RenderLayerMgr(wx.EvtHandler):
- def __init__(self, layer):
+ def __init__(self, layer, env):
"""Render layer into image
:param layer: Layer to be rendered
@@ -349,7 +349,11 @@
self.updateProgress = Signal('RenderLayerMgr.updateProgress')
self._startTime = None
-
+ self._render_env = env
+
+ def UpdateRenderEnv(self, env):
+ self._render_env.update(env)
+
def Render(self, cmd, env):
"""Render layer
@@ -360,6 +364,7 @@
(self.layer, self.layer.forceRender, self.layer.mapfile))
env_cmd = env.copy()
+ env_cmd.update(self._render_env)
env_cmd['GRASS_RENDER_FILE'] = self.layer.mapfile
cmd_render = copy.deepcopy(cmd)
Modified: grass/trunk/gui/wxpython/core/ws.py
===================================================================
--- grass/trunk/gui/wxpython/core/ws.py 2015-05-22 08:42:12 UTC (rev 65308)
+++ grass/trunk/gui/wxpython/core/ws.py 2015-05-22 08:45:35 UTC (rev 65309)
@@ -45,7 +45,7 @@
class RenderWMSMgr(wx.EvtHandler):
"""Fetch and prepare WMS data for rendering.
"""
- def __init__(self, layer):
+ def __init__(self, layer, env={}):
if not haveGdal:
sys.stderr.write(_("Unable to load GDAL Python bindings.\n"\
"WMS layers can not be displayed without the bindings.\n"))
Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py 2015-05-22 08:42:12 UTC (rev 65308)
+++ grass/trunk/gui/wxpython/mapdisp/main.py 2015-05-22 08:45:35 UTC (rev 65309)
@@ -139,11 +139,18 @@
# next number in rendering order
next_layer = 0
mapFile = None
+ render_env = dict()
for line in lines:
- if line.startswith('#') and 'GRASS_RENDER_FILE' in line:
- mapFile = line.split('=', 1)[1].strip()
+ if line.startswith('#'):
+ if 'GRASS_RENDER_FILE' in line:
+ mapFile = line.split('=', 1)[1].strip()
+ try:
+ k, v = line[2:].strip().split('=', 1)
+ except:
+ pass
+ render_env[k] = v
continue
-
+
cmd = utils.split(line.strip())
ltype = None
@@ -167,7 +174,10 @@
mapLayer = classLayer(name = name, cmd = cmd, Map = None,
hidden = True, render = False, mapfile = mapFile, **args)
mapLayer.GetRenderMgr().updateProgress.connect(self.GetRenderMgr().ReportProgress)
-
+ if render_env:
+ mapLayer.GetRenderMgr().UpdateRenderEnv(render_env)
+ render_env = dict()
+
exists = False
for i, layer in enumerate(existingLayers):
if layer.GetCmd(string=True) == mapLayer.GetCmd(string=True):
More information about the grass-commit
mailing list