[GRASS-SVN] r45983 - grass-addons/grass7/display/d.mon

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 14 19:22:10 EDT 2011


Author: hamish
Date: 2011-04-14 16:22:10 -0700 (Thu, 14 Apr 2011)
New Revision: 45983

Modified:
   grass-addons/grass7/display/d.mon/d.mon.html
   grass-addons/grass7/display/d.mon/d.mon.py
Log:
allow variable tempfile name

Modified: grass-addons/grass7/display/d.mon/d.mon.html
===================================================================
--- grass-addons/grass7/display/d.mon/d.mon.html	2011-04-14 23:03:02 UTC (rev 45982)
+++ grass-addons/grass7/display/d.mon/d.mon.html	2011-04-14 23:22:10 UTC (rev 45983)
@@ -11,7 +11,17 @@
   fi
 </pre>
 
+<p>
+By default the temporary file will be stored in $MAPSET/.tmp/ and cleared
+at the end of the session. You can put it somewhere else with the
+<b>tempfile</b> option. For example, when working remotely with
+PuTTY (ssh without tunnelled X) + Apache:
+<pre>
+   alias d.mon='eval `d.mon.py -b tempfile=/var/www/grass/grassmap.png`'
+</pre>
+then just hit reload in your web browser whenever a refresh is needed.
 
+
 <h2>AUTHOR</h2>
 Hamish Bowman<br>
 Dunedin, New Zealand

Modified: grass-addons/grass7/display/d.mon/d.mon.py
===================================================================
--- grass-addons/grass7/display/d.mon/d.mon.py	2011-04-14 23:03:02 UTC (rev 45982)
+++ grass-addons/grass7/display/d.mon/d.mon.py	2011-04-14 23:22:10 UTC (rev 45983)
@@ -36,6 +36,13 @@
 #% answer: wximgview
 #%End
 #%option
+#% key: tempfile
+#% type: string
+#% gisprompt: new_file,file,input
+#% description: Name and location of temp file
+#% required : no
+#%end
+#%option
 #% key: percent
 #% type: integer
 #% description: Percentage of CPU time to use
@@ -68,9 +75,13 @@
 def main():
     handler = options['handler']
 
-    img_tmp = grass.tempfile()
-    os.remove(img_tmp)
-    img_tmp += ".bmp"
+    if options['tempfile']:
+        img_tmp = options['tempfile']
+        #TODO: add option for GRASS_PNG_COMPRESSION=0,1-9
+    else:
+        img_tmp = grass.tempfile()
+        os.remove(img_tmp)
+        img_tmp += ".bmp"
 
 
     if flags['b']:



More information about the grass-commit mailing list