[GRASS-SVN] r50415 - in grass/trunk/gui/wxpython: core gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 24 11:29:50 EST 2012


Author: martinl
Date: 2012-01-24 08:29:50 -0800 (Tue, 24 Jan 2012)
New Revision: 50415

Modified:
   grass/trunk/gui/wxpython/core/gcmd.py
   grass/trunk/gui/wxpython/core/utils.py
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/gui_core/prompt.py
Log:
wxGUI: move GetRealCmd from `utils` module to `gcmd`


Modified: grass/trunk/gui/wxpython/core/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/core/gcmd.py	2012-01-24 15:42:26 UTC (rev 50414)
+++ grass/trunk/gui/wxpython/core/gcmd.py	2012-01-24 16:29:50 UTC (rev 50415)
@@ -47,8 +47,17 @@
 
 from core       import globalvar
 from core.debug import Debug
-from core.utils import GetRealCmd
 
+def GetRealCmd(cmd):
+    """!Return real command name - only for MS Windows
+    """
+    if sys.platform == 'win32':
+        for ext in globalvar.grassScripts.keys():
+            if cmd in globalvar.grassScripts[ext]:
+                return cmd + ext
+    
+    return cmd
+
 def DecodeString(string):
     """!Decode string using system encoding
     

Modified: grass/trunk/gui/wxpython/core/utils.py
===================================================================
--- grass/trunk/gui/wxpython/core/utils.py	2012-01-24 15:42:26 UTC (rev 50414)
+++ grass/trunk/gui/wxpython/core/utils.py	2012-01-24 16:29:50 UTC (rev 50415)
@@ -20,7 +20,7 @@
 import shlex
 import re
 
-from core.globalvar import ETCDIR, grassScripts
+from core.globalvar import ETCDIR
 sys.path.append(os.path.join(ETCDIR, "python"))
 
 from grass.script import core as grass
@@ -742,13 +742,3 @@
         return os.path.join(os.getenv('APPDATA'), 'grass%d' % version)
     
     return os.path.join(os.getenv('HOME'), '.grass%d' % version)
-
-def GetRealCmd(cmd):
-    """!Return real command name - only for MS Windows
-    """
-    if sys.platform == 'win32':
-        for ext in grassScripts.keys():
-            if cmd in grassScripts[ext]:
-                return cmd + ext
-    
-    return cmd

Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2012-01-24 15:42:26 UTC (rev 50414)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2012-01-24 16:29:50 UTC (rev 50415)
@@ -2008,7 +2008,7 @@
         # parse the interface decription
         try:
             global _blackList
-            self.grass_task = gtask.parse_interface(utils.GetRealCmd(cmd[0]),
+            self.grass_task = gtask.parse_interface(gcmd.GetRealCmd(cmd[0]),
                                                     blackList = _blackList)
         except (grass.ScriptError, ValueError), e: 
             raise gcmd.GException(e.value)
@@ -2162,7 +2162,7 @@
     if sys.argv[1] !=  'test':
         q = wx.LogNull()
         cmd = utils.split(sys.argv[1])
-        task = gtask.grassTask(utils.GetRealCmd(cmd[0]))
+        task = gtask.grassTask(gcmd.GetRealCmd(cmd[0]))
         task.set_options(cmd[1:])
         app = GrassGUIApp(task)
         app.MainLoop()

Modified: grass/trunk/gui/wxpython/gui_core/prompt.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/prompt.py	2012-01-24 15:42:26 UTC (rev 50414)
+++ grass/trunk/gui/wxpython/gui_core/prompt.py	2012-01-24 16:29:50 UTC (rev 50415)
@@ -35,7 +35,7 @@
 from core          import globalvar
 from core          import utils
 from lmgr.menudata import ManagerData
-from core.gcmd     import EncodeString, DecodeString
+from core.gcmd     import EncodeString, DecodeString, GetRealCmd
 
 class PromptListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
     """!PopUp window used by GPromptPopUp"""
@@ -801,7 +801,7 @@
                 self.OnCmdErase(None)
             else:
                 try:
-                    self.cmdDesc = gtask.parse_interface(utils.GetRealCmd(cmd))
+                    self.cmdDesc = gtask.parse_interface(GetRealCmd(cmd))
                 except IOError:
                     self.cmdDesc = None
         
@@ -1039,7 +1039,7 @@
             if cmd not in globalvar.grassCmd:
                 return
             
-            info = gtask.command_info(utils.GetRealCmd(cmd))
+            info = gtask.command_info(GetRealCmd(cmd))
             
             self.CallTipSetBackground("#f4f4d1")
             self.CallTipSetForeground("BLACK")
@@ -1117,7 +1117,7 @@
                         (not self.cmdDesc or cmd != self.cmdDesc.get_name()):
                     
                     try:
-                        self.cmdDesc = gtask.parse_interface(utils.GetRealCmd(cmd))
+                        self.cmdDesc = gtask.parse_interface(GetRealCmd(cmd))
                     except IOError:
                         self.cmdDesc = None
             event.Skip()



More information about the grass-commit mailing list