[GRASS-SVN] r50983 - in grass/branches/releasebranch_6_4/gui:
scripts wxpython/core
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Mar 4 06:52:57 EST 2012
Author: martinl
Date: 2012-03-04 03:52:56 -0800 (Sun, 04 Mar 2012)
New Revision: 50983
Added:
grass/branches/releasebranch_6_4/gui/scripts/r.mapcalc_wrapper
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/core/globalvar.py
Log:
wxGUI: add r.mapcalc_wrapper (ignore wrappers in cmd)
Copied: grass/branches/releasebranch_6_4/gui/scripts/r.mapcalc_wrapper (from rev 50976, grass/branches/develbranch_6/gui/scripts/r.mapcalc_wrapper)
===================================================================
--- grass/branches/releasebranch_6_4/gui/scripts/r.mapcalc_wrapper (rev 0)
+++ grass/branches/releasebranch_6_4/gui/scripts/r.mapcalc_wrapper 2012-03-04 11:52:56 UTC (rev 50983)
@@ -0,0 +1,65 @@
+#!/bin/sh
+#
+############################################################################
+#
+# MODULE: r.mapcalc_wrapper
+# AUTHOR(S): Martin Landa <landa.martin gmail.com>
+# PURPOSE: Simulate standard g.parser interface for GUI
+# COPYRIGHT: (C) 2011 by The GRASS Development Team
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+############################################################################
+
+#%module
+#% description: Raster map calculator.
+#% keywords: raster, algebra
+#%end
+#%option
+#% key: expression
+#% type: string
+#% required: no
+#% multiple: no
+#% description: Expression to evaluate
+#% guisection: Expression
+#%end
+#%option
+#% key: file
+#% type: string
+#% required: no
+#% multiple: no
+#% key_desc: name
+#% description: File containing expression(s) to evaluate
+#% gisprompt: old,file,input
+#% guisection: Expression
+#%end
+
+if [ -z "$GISBASE" ] ; then
+ echo "You must be in GRASS GIS to run this program." 1>&2
+ exit 1
+fi
+
+if [ "$1" != "@ARGS_PARSED@" ] ; then
+ exec g.parser "$0" "$@"
+fi
+
+if [ -n "$GIS_OPT_FILE" ] ; then
+ exec r.mapcalc < "$GIS_OPT_FILE"
+else
+ if [ -n "$GIS_OPT_EXPRESSION" ] ; then
+ exec r.mapcalc "$GIS_OPT_EXPRESSION"
+ else
+ exec g.message -e message="Either <expression> or <file> option must be given"
+ exit 1
+ fi
+fi
+
+exit 0
Modified: grass/branches/releasebranch_6_4/gui/wxpython/core/globalvar.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/core/globalvar.py 2012-03-04 11:50:54 UTC (rev 50982)
+++ grass/branches/releasebranch_6_4/gui/wxpython/core/globalvar.py 2012-03-04 11:52:56 UTC (rev 50983)
@@ -139,7 +139,11 @@
if os.path.exists(os.path.join(gisbase, 'etc', 'gui', 'scripts')):
os.environ["PATH"] = os.getenv("PATH") + os.pathsep + os.path.join(gisbase, 'etc', 'gui', 'scripts')
os.environ["PATH"] = os.getenv("PATH") + os.pathsep + os.path.join(gisbase, 'etc', 'wxpython', 'scripts')
- cmd = cmd + os.listdir(os.path.join(gisbase, 'etc', 'gui', 'scripts'))
+
+ pattern = "_wrapper"
+ for script in os.listdir(os.path.join(gisbase, 'etc', 'gui', 'scripts')):
+ if script[-len(pattern):] != pattern: # ignore wrappers
+ cmd.append(script)
# scan addons (path)
if os.getenv('GRASS_ADDON_PATH'):
More information about the grass-commit
mailing list