Browse Source

wxGUI: move iterface check (https://trac.osgeo.org/grass/changeset/58156) to gconsole

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58157 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 years ago
parent
commit
78600418f3
2 changed files with 18 additions and 16 deletions
  1. 18 0
      gui/wxpython/core/gconsole.py
  2. 0 16
      gui/wxpython/lmgr/frame.py

+ 18 - 0
gui/wxpython/core/gconsole.py

@@ -536,6 +536,24 @@ class GConsole(wx.EvtHandler):
         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])

+ 0 - 16
gui/wxpython/lmgr/frame.py

@@ -848,22 +848,6 @@ class GMFrame(wx.Frame):
             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):