Procházet zdrojové kódy

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 před 10 roky
rodič
revize
9841eddac7
1 změnil soubory, kde provedl 9 přidání a 4 odebrání
  1. 9 4
      lib/init/grass.py

+ 9 - 4
lib/init/grass.py

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