Opened 11 years ago
Last modified 10 years ago
#2285 closed defect
Repetitive d.rast calls for wx0 monitor from command line — at Initial Version
Reported by: | hcho | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | 7.0.0 |
Component: | Display | Version: | svn-trunk |
Keywords: | d.mon | Cc: | |
CPU: | x86-64 | Platform: | Linux |
Description
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.