浏览代码

init: use a separate function for wxpython gui paths

The previous code was using os.path.join feature which ignores previous paths when absolute path was given in somewhere in the list. This does not look like an intention.

Also fixing one usage of global variable which should have been already removed in r65246.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65248 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 10 年之前
父节点
当前提交
9841eddac7
共有 1 个文件被更改,包括 9 次插入4 次删除
  1. 9 4
      lib/init/grass.py

+ 9 - 4
lib/init/grass.py

@@ -164,6 +164,11 @@ def Popen(cmd, **kwargs):
 def gfile(*args):
 def gfile(*args):
     return os.path.join(gisbase, *args)
     return os.path.join(gisbase, *args)
 
 
+
+def wxpath(*args):
+    return os.path.join(wxpython_base, *args)
+
+
 help_text = r"""GRASS GIS %s
 help_text = r"""GRASS GIS %s
 Geographic Resources Analysis Support System (GRASS GIS).
 Geographic Resources Analysis Support System (GRASS GIS).
 
 
@@ -516,7 +521,7 @@ MAPSET: <UNKNOWN>
 
 
 
 
 def check_gui(expected_gui):
 def check_gui(expected_gui):
-    global grass_gui, wxpython_base
+    global wxpython_base
     grass_gui = expected_gui
     grass_gui = expected_gui
     # Check if we are running X windows by checking the DISPLAY variable
     # Check if we are running X windows by checking the DISPLAY variable
     if os.getenv('DISPLAY') or windows or macosx:
     if os.getenv('DISPLAY') or windows or macosx:
@@ -688,7 +693,7 @@ def set_data(grass_gui):
 
 
 def gui_startup(grass_gui):
 def gui_startup(grass_gui):
     if grass_gui in ('wxpython', 'gtext'):
     if grass_gui in ('wxpython', 'gtext'):
-        ret = call([os.getenv('GRASS_PYTHON'), gfile(wxpython_base, "gis_set.py")])
+        ret = call([os.getenv('GRASS_PYTHON'), wxpath("gis_set.py")])
 
 
     if ret == 0:
     if ret == 0:
         pass
         pass
@@ -887,7 +892,7 @@ def check_lock():
 
 
     if msg:
     if msg:
         if grass_gui == "wxpython":
         if grass_gui == "wxpython":
-            call([os.getenv('GRASS_PYTHON'), gfile(wxpython_base, "gis_set_error.py"), msg])
+            call([os.getenv('GRASS_PYTHON'), wxpath("gis_set_error.py"), msg])
         else:
         else:
             global remove_lockfile
             global remove_lockfile
             remove_lockfile = False
             remove_lockfile = False
@@ -987,7 +992,7 @@ def start_gui(grass_gui):
 
 
     # Check for gui interface
     # Check for gui interface
     if grass_gui == "wxpython":
     if grass_gui == "wxpython":
-        Popen([os.getenv('GRASS_PYTHON'), gfile(wxpython_base, "wxgui.py")])
+        Popen([os.getenv('GRASS_PYTHON'), wxpath("wxgui.py")])
 
 
 
 
 def clear_screen():
 def clear_screen():