Browse Source

d.mon: improve python renderer command (set list of ignored commands)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@64427 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 years ago
parent
commit
c96252f061
2 changed files with 17 additions and 12 deletions
  1. 1 1
      display/d.mon/main.c
  2. 16 11
      display/d.mon/start.c

+ 1 - 1
display/d.mon/main.c

@@ -4,7 +4,7 @@
  * MODULE:       d.mon
  * MODULE:       d.mon
  * AUTHOR(S):    Martin Landa <landa.martin gmail.com>
  * AUTHOR(S):    Martin Landa <landa.martin gmail.com>
  * PURPOSE:      Controls graphics monitors for CLI
  * 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
  *               This program is free software under the GNU General
  *               Public License (>=v2). Read the file COPYING that
  *               Public License (>=v2). Read the file COPYING that

+ 16 - 11
display/d.mon/start.c

@@ -152,17 +152,22 @@ int start_mon(const char *name, const char *output, int select,
                "cmd, dcmd = gtask.cmdstring_to_tuple(sys.argv[1])\n"
                "cmd, dcmd = gtask.cmdstring_to_tuple(sys.argv[1])\n"
                "if not cmd or cmd == 'd.mon':\n"
                "if not cmd or cmd == 'd.mon':\n"
                "    sys.exit(0)\n\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"
                "# read env file\n"
                "fd = open('%s', 'r')\n"
                "fd = open('%s', 'r')\n"
                "if fd is None:\n"
                "if fd is None:\n"