[GRASS-SVN] r64415 - grass/trunk/scripts/d.redraw
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Feb 3 03:48:50 PST 2015
Author: martinl
Date: 2015-02-03 03:48:50 -0800 (Tue, 03 Feb 2015)
New Revision: 64415
Modified:
grass/trunk/scripts/d.redraw/d.redraw.py
Log:
d.redraw: update for new d.mon architecture
Modified: grass/trunk/scripts/d.redraw/d.redraw.py
===================================================================
--- grass/trunk/scripts/d.redraw/d.redraw.py 2015-02-03 11:07:35 UTC (rev 64414)
+++ grass/trunk/scripts/d.redraw/d.redraw.py 2015-02-03 11:48:50 UTC (rev 64415)
@@ -5,7 +5,7 @@
# MODULE: d.redraw
# AUTHOR(S): Martin Landa <landa.martin gmail.com>
# PURPOSE: Redraws the content of currently selected monitor
-# COPYRIGHT: (C) 2011 by the GRASS Development Team
+# COPYRIGHT: (C) 2011-2015 by the GRASS Development Team
#
# This program is free software under the GNU General
# Public License (>=v2). Read the file COPYING that
@@ -20,30 +20,22 @@
#% keyword: monitors
#%end
+import os
import sys
-import shlex
from grass.script import core as grass
+from grass.script.utils import split
-def split(s):
- """!Platform specific shlex.split"""
- if sys.version_info >= (2, 6):
- return shlex.split(s, posix = (sys.platform != "win32"))
- elif sys.platform == "win32":
- return shlex.split(s.replace('\\', r'\\'))
- else:
- return shlex.split(s)
-
def main():
env = grass.gisenv()
mon = env.get('MONITOR', None)
if not mon:
grass.fatal(_("No graphics device selected. Use d.mon to select graphics device."))
-
- monCmd = env.get('MONITOR_%s_CMDFILE' % mon.upper())
- if not monCmd:
- grass.fatal(_("No cmd file found for monitor <%s>") % mon)
+ monCmd = os.sep.join(grass.tempfile().split(os.sep)[:-1] + ['MONITORS', mon, 'cmd'])
+ if not monCmd or not os.path.isfile(monCmd):
+ grass.fatal(_("Unable to open file '%s'") % monCmd)
+
try:
fd = open(monCmd, 'r')
cmdList = fd.readlines()
More information about the grass-commit
mailing list