[GRASS-SVN] r63306 - in grass/trunk/scripts: d.shade d.vect.thematic

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 30 16:44:13 PST 2014


Author: wenzeslaus
Date: 2014-11-30 16:44:13 -0800 (Sun, 30 Nov 2014)
New Revision: 63306

Modified:
   grass/trunk/scripts/d.shade/d.shade.py
   grass/trunk/scripts/d.vect.thematic/d.vect.thematic.py
Log:
d.* scripts: check if graphics device is open or render immediate set for modules which run from wxGUI

 * changing r62845 for d.shade and d.vect.thematic
 * MONITOR GRASS GIS variable is set by d.mon but GRASS_RENDER_IMMEDIATE environmental variable is set in wxGUI
 * similar change might be needed for other modules too in case they are used with GRASS_RENDER_IMMEDIATE
 * better error message might be needed for GRASS_RENDER_IMMEDIATE, common implementation might be advantageous


Modified: grass/trunk/scripts/d.shade/d.shade.py
===================================================================
--- grass/trunk/scripts/d.shade/d.shade.py	2014-12-01 00:21:48 UTC (rev 63305)
+++ grass/trunk/scripts/d.shade/d.shade.py	2014-12-01 00:44:13 UTC (rev 63306)
@@ -50,7 +50,11 @@
     env = gcore.gisenv()
     mon = env.get('MONITOR', None)
     if not mon:
-        gcore.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
+        # os is needed only here
+        import os
+        if not 'GRASS_RENDER_IMMEDIATE' in os.environ:
+            gcore.fatal(_("No graphics device selected."
+                          " Use d.mon to select graphics device."))
 
     drape_map = options['drapemap']
     relief_map = options['reliefmap']

Modified: grass/trunk/scripts/d.vect.thematic/d.vect.thematic.py
===================================================================
--- grass/trunk/scripts/d.vect.thematic/d.vect.thematic.py	2014-12-01 00:21:48 UTC (rev 63305)
+++ grass/trunk/scripts/d.vect.thematic/d.vect.thematic.py	2014-12-01 00:44:13 UTC (rev 63306)
@@ -231,10 +231,12 @@
 def main():
     global tmp_graph, tmp_group, tmp_psmap, tmp_psleg, tmp_gisleg
 
-    env = grass.gisenv()
+    env = gcore.gisenv()
     mon = env.get('MONITOR', None)
     if not mon:
-        grass.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
+        if not 'GRASS_RENDER_IMMEDIATE' in os.environ:
+            gcore.fatal(_("No graphics device selected."
+                          " Use d.mon to select graphics device."))
 
     breakpoints = options['breakpoints']
     colorscheme = options['colorscheme']



More information about the grass-commit mailing list