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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 3 07:41:53 PST 2015


Author: martinl
Date: 2015-02-03 07:41:52 -0800 (Tue, 03 Feb 2015)
New Revision: 64427

Modified:
   grass/trunk/display/d.mon/main.c
   grass/trunk/display/d.mon/start.c
Log:
d.mon: improve python renderer command (set list of ignored commands)

Modified: grass/trunk/display/d.mon/main.c
===================================================================
--- grass/trunk/display/d.mon/main.c	2015-02-03 15:20:48 UTC (rev 64426)
+++ grass/trunk/display/d.mon/main.c	2015-02-03 15:41:52 UTC (rev 64427)
@@ -4,7 +4,7 @@
  * MODULE:       d.mon
  * AUTHOR(S):    Martin Landa <landa.martin gmail.com>
  * PURPOSE:      Controls graphics monitors for CLI
- * COPYRIGHT:    (C) 2011-2014 by Martin Landa, and the GRASS Development Team
+ * COPYRIGHT:    (C) 2011-2015 by Martin Landa, and the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2). Read the file COPYING that

Modified: grass/trunk/display/d.mon/start.c
===================================================================
--- grass/trunk/display/d.mon/start.c	2015-02-03 15:20:48 UTC (rev 64426)
+++ grass/trunk/display/d.mon/start.c	2015-02-03 15:41:52 UTC (rev 64427)
@@ -152,17 +152,22 @@
                "cmd, dcmd = gtask.cmdstring_to_tuple(sys.argv[1])\n"
                "if not cmd or cmd == 'd.mon':\n"
                "    sys.exit(0)\n\n"
-               "mode = 'w' if cmd == 'd.erase' else 'a'\n\n"
-               "# update cmd file\n"
-               "fd = open('%s', mode)\n"
-               "if fd is None:\n"
-               "    grass.fatal(\"Unable to open file '%s'\")\n"
-               "if mode == 'a':\n"
-               "    fd.write(sys.argv[1])\n"
-               "    fd.write('\\n')\n"
-               "else:\n"
-               "    fd.write('')\n"
-               "fd.close()\n\n"
+               "ignoredCmd = ('d.colorlist', 'd.font', 'd.fontlist',\n"
+               "              'd.frame', 'd.info', 'd.mon', 'd.out.file',\n"
+               "              'd.redraw', 'd.to.rast', 'd.what.rast',\n"
+               "              'd.what.vect', 'd.where')\n"
+               "if cmd not in ignoredCmd:\n"
+               "    mode = 'w' if cmd == 'd.erase' else 'a'\n\n"
+               "    # update cmd file\n"
+               "    fd = open('%s', mode)\n"
+               "    if fd is None:\n"
+               "        grass.fatal(\"Unable to open file '%s'\")\n"
+               "    if mode == 'a':\n"
+               "        fd.write(sys.argv[1])\n"
+               "        fd.write('\\n')\n"
+               "    else:\n"
+               "         fd.write('')\n"
+               "    fd.close()\n\n"
                "# read env file\n"
                "fd = open('%s', 'r')\n"
                "if fd is None:\n"



More information about the grass-commit mailing list