[GRASS-SVN] r65302 - grass/trunk/display/d.mon

svn_grass at osgeo.org svn_grass at osgeo.org
Thu May 21 10:51:29 PDT 2015


Author: martinl
Date: 2015-05-21 10:51:29 -0700 (Thu, 21 May 2015)
New Revision: 65302

Modified:
   grass/trunk/display/d.mon/render_cmd.py
Log:
d.mon: fix r65300 to work with file-based monitors


Modified: grass/trunk/display/d.mon/render_cmd.py
===================================================================
--- grass/trunk/display/d.mon/render_cmd.py	2015-05-21 17:42:05 UTC (rev 65301)
+++ grass/trunk/display/d.mon/render_cmd.py	2015-05-21 17:51:29 UTC (rev 65302)
@@ -32,7 +32,8 @@
 # run display command
 def render(cmd, mapfile):
     env = os.environ.copy()
-    env['GRASS_RENDER_FILE'] = mapfile
+    if mapfile:
+        env['GRASS_RENDER_FILE'] = mapfile
     try:
         grass.run_command(cmd[0], env=env, **cmd[1])
     except Exception as e:
@@ -52,7 +53,8 @@
     if fd is None:
         grass.fatal("Unable to open file '{}'".format(cmd_file))
     if mode == 'a':
-        fd.write('# GRASS_RENDER_FILE={}\n'.format(mapfile))
+        if mapfile:
+            fd.write('# GRASS_RENDER_FILE={}\n'.format(mapfile))
         fd.write(' '.join(gtask.cmdtuple_to_list(cmd)))
         fd.write('\n')
     else:
@@ -97,10 +99,13 @@
     mon = os.path.split(path)[-1]
     
     width, height = read_env_file(os.path.join(path, 'env'))
-    if not mon.startswith('wx'):
+    if mon.startswith('wx'):
+        mapfile = tempfile.NamedTemporaryFile(dir=path).name + '.ppm'
+    else:
+        mapfile = None
         adjust_region(width, height)
+        
 
-    mapfile = tempfile.NamedTemporaryFile(dir=path).name + '.ppm'
     render(cmd, mapfile)
     update_cmd_file(os.path.join(path, 'cmd'), cmd, mapfile)
         



More information about the grass-commit mailing list