[GRASS-SVN] r65248 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Fri May 15 07:45:57 PDT 2015


Author: wenzeslaus
Date: 2015-05-15 07:45:57 -0700 (Fri, 15 May 2015)
New Revision: 65248

Modified:
   grass/trunk/lib/init/grass.py
Log:
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.


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2015-05-15 14:11:00 UTC (rev 65247)
+++ grass/trunk/lib/init/grass.py	2015-05-15 14:45:57 UTC (rev 65248)
@@ -164,6 +164,11 @@
 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 @@
 
 
 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 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 @@
 
     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 @@
 
     # 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():



More information about the grass-commit mailing list