[GRASS-SVN] r58157 - in grass/trunk/gui/wxpython: core lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Nov 6 07:08:42 PST 2013
Author: martinl
Date: 2013-11-06 07:08:42 -0800 (Wed, 06 Nov 2013)
New Revision: 58157
Modified:
grass/trunk/gui/wxpython/core/gconsole.py
grass/trunk/gui/wxpython/lmgr/frame.py
Log:
wxGUI: move iterface check (r58156) to gconsole
Modified: grass/trunk/gui/wxpython/core/gconsole.py
===================================================================
--- grass/trunk/gui/wxpython/core/gconsole.py 2013-11-06 14:56:57 UTC (rev 58156)
+++ grass/trunk/gui/wxpython/core/gconsole.py 2013-11-06 15:08:42 UTC (rev 58157)
@@ -536,6 +536,24 @@
else:
# Send any other command to the shell. Send output to
# console output window
+ #
+ # Check if the script has an interface (avoid double-launching
+ # of the script)
+ skipInterface = True
+ if os.path.splitext(command[0])[1] in ('.py', '.sh'):
+ try:
+ sfile = open(command[0], "r")
+ for line in sfile.readlines():
+ if len(line) < 2:
+ continue
+ if line[0] is '#' and line[1] is '%':
+ skipInterface = False
+ break
+ except IOError:
+ pass
+ finally:
+ sfile.close()
+
if len(command) == 1 and not skipInterface:
try:
task = gtask.parse_interface(command[0])
Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py 2013-11-06 14:56:57 UTC (rev 58156)
+++ grass/trunk/gui/wxpython/lmgr/frame.py 2013-11-06 15:08:42 UTC (rev 58157)
@@ -848,22 +848,6 @@
dlg.Destroy()
self._gconsole.WriteCmdLog(_("Launching script '%s'...") % filename)
- # check if the script has an interface (avoid double-launching
- # of the script)
- skipInterface = True
- try:
- sfile = open(filename, "r")
- for line in sfile.readlines():
- if len(line) < 2:
- continue
- if line[0] is '#' and line[1] is '%':
- skipInterface = False
- break
- except IOError:
- pass
- finally:
- sfile.close()
-
self._gconsole.RunCmd([filename], skipInterface=skipInterface)
def OnChangeLocation(self, event):
More information about the grass-commit
mailing list