[GRASS-dev] [GRASS GIS] #2285: Repetitive d.rast calls for wx0 monitor from command line
GRASS GIS
trac at osgeo.org
Sat May 10 06:47:37 PDT 2014
#2285: Repetitive d.rast calls for wx0 monitor from command line
---------------------+------------------------------------------------------
Reporter: hcho | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 7.0.0
Component: Display | Version: svn-trunk
Keywords: | Platform: Linux
Cpu: x86-64 |
---------------------+------------------------------------------------------
I was drawing 168 raster maps on the wx monitor from a shell script:
{{{
#!/bin/sh
maps=`g.mlist rast pattern="n[0-9]*w[0-9]*_1" sep=,`
g.region rast=$maps res=00:01:00
d.erase
for i in `echo $maps | sed 's/,/ /g'`
do
d.rast $i
done
}}}
after starting and selecting a wx monitor. I'm getting the following error
messages and not all the raster maps are displayed:
{{{
100%
100%
100%
100%
100%
100%
100%
ERROR: No graphics device selected. Use d.mon to select graphics device.
ERROR: No graphics device selected. Use d.mon to select graphics device.
ERROR: No graphics device selected. Use d.mon to select graphics device.
100%
100%
100%
}}}
I digged into the wx monitor script (gui/wxpython/mapdisp/main.py
DMonMap.Render) and found that it unsets MONITOR (because
GRASS_RENDER_IMMEDIATE doesn't like monitors) before calling d.rast and
then restores it:
{{{
currMon = grass.gisenv()['MONITOR']
RunCommand('g.gisenv',
unset = 'MONITOR') # GRASS_RENDER_IMMEDIATE doesn't
like monitors
ret = Map.Render(self, *args, **kwargs)
RunCommand('g.gisenv',
set = 'MONITOR=%s' % currMon)
}}}
So far, so good. Unfortunately, the wx monitor is running in a different
process than d.rast calls from command line. Many d.rast calls cannot see
the MONITOR variable while the monitor is rendering existing maps, which
causes the above error.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2285>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list