[GRASS-SVN] r60215 - in grass/trunk: gui/wxpython/mapdisp lib/display
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 12 20:28:43 PDT 2014
Author: hcho
Date: 2014-05-12 20:28:43 -0700 (Mon, 12 May 2014)
New Revision: 60215
Modified:
grass/trunk/gui/wxpython/mapdisp/main.py
grass/trunk/lib/display/r_raster.c
Log:
Allow MONITOR=wx* and GRASS_RENDER_IMMEDIATE at the same time to avoid calling
display commands without MONITOR while the wx monitor is rendering.
Fix ticket #2285.
Modified: grass/trunk/gui/wxpython/mapdisp/main.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/main.py 2014-05-12 23:11:08 UTC (rev 60214)
+++ grass/trunk/gui/wxpython/mapdisp/main.py 2014-05-13 03:28:43 UTC (rev 60215)
@@ -194,16 +194,8 @@
For input params and returned data see overridden method in Map class.
"""
- 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)
-
return ret
def AddLayer(self, *args, **kwargs):
@@ -211,11 +203,6 @@
For input params and returned data see overridden method in Map class.
"""
- currMon = grass.gisenv()['MONITOR']
-
- RunCommand('g.gisenv',
- unset = 'MONITOR') # GRASS_RENDER_IMMEDIATE doesn't like monitors
-
driver = UserSettings.Get(group = 'display', key = 'driver', subkey = 'type')
if driver == 'png':
@@ -227,9 +214,6 @@
del os.environ["GRASS_RENDER_IMMEDIATE"]
- RunCommand('g.gisenv',
- set='MONITOR=%s' % currMon)
-
return layer
Modified: grass/trunk/lib/display/r_raster.c
===================================================================
--- grass/trunk/lib/display/r_raster.c 2014-05-12 23:11:08 UTC (rev 60214)
+++ grass/trunk/lib/display/r_raster.c 2014-05-13 03:28:43 UTC (rev 60215)
@@ -105,7 +105,11 @@
G_debug(1, "D_open_driver():");
p = getenv("GRASS_RENDER_IMMEDIATE");
m = G__getenv("MONITOR");
- if (m) {
+
+ if (m && G_strncasecmp(m, "wx", 2) == 0) {
+ /* wx monitors always use GRASS_RENDER_IMMEDIATE. */
+ p = NULL; /* use default display driver */
+ } else if (m) {
char *env;
const char *v;
char *u_m;
@@ -119,13 +123,10 @@
env = NULL;
G_asprintf(&env, "MONITOR_%s_MAPFILE", u_m);
v = G__getenv(env);
- if (G_strncasecmp(m, "wx", 2) == 0)
- p = NULL; /* use default display driver */
- else
- p = m;
-
+ p = m;
+
if (v) {
- if (p && G_strcasecmp(p, "ps") == 0)
+ if (G_strcasecmp(p, "ps") == 0)
G_putenv("GRASS_PSFILE", v);
else
G_putenv("GRASS_PNGFILE", v);
@@ -201,9 +202,12 @@
G_debug(1, "D_save_command(): %s", cmd);
mon_name = G__getenv("MONITOR");
- if (!mon_name)
+ if (!mon_name || /* if no monitor selected */
+ /* or wx monitor selected and display commands called by the monitor */
+ (G_strncasecmp(mon_name, "wx", 2) == 0 &&
+ getenv("GRASS_RENDER_IMMEDIATE")))
return 0;
-
+
/* GRASS variable names should be upper case. */
u_mon_name = G_store_upper(mon_name);
More information about the grass-commit
mailing list