[GRASS-SVN] r67310 - in grass/trunk: gui/wxpython/animation gui/wxpython/datacatalog gui/wxpython/dbmgr gui/wxpython/gcp gui/wxpython/gmodeler gui/wxpython/gui_core gui/wxpython/iclass gui/wxpython/mapswipe gui/wxpython/psmap gui/wxpython/rlisetup gui/wxpython/timeline gui/wxpython/tplot gui/wxpython/vdigit lib/init lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 21 17:14:53 PST 2015


Author: martinl
Date: 2015-12-21 17:14:53 -0800 (Mon, 21 Dec 2015)
New Revision: 67310

Modified:
   grass/trunk/gui/wxpython/animation/g.gui.animation.py
   grass/trunk/gui/wxpython/datacatalog/g.gui.datacatalog.py
   grass/trunk/gui/wxpython/dbmgr/g.gui.dbmgr.py
   grass/trunk/gui/wxpython/gcp/g.gui.gcp.py
   grass/trunk/gui/wxpython/gmodeler/g.gui.gmodeler.py
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/iclass/g.gui.iclass.py
   grass/trunk/gui/wxpython/mapswipe/g.gui.mapswipe.py
   grass/trunk/gui/wxpython/psmap/g.gui.psmap.py
   grass/trunk/gui/wxpython/rlisetup/g.gui.rlisetup.py
   grass/trunk/gui/wxpython/timeline/g.gui.timeline.py
   grass/trunk/gui/wxpython/tplot/g.gui.tplot.py
   grass/trunk/gui/wxpython/vdigit/g.gui.vdigit.py
   grass/trunk/lib/init/grass.py
   grass/trunk/lib/python/script/setup.py
Log:
remove wxpath from PYTHONPATH (set path only locally)

Modified: grass/trunk/gui/wxpython/animation/g.gui.animation.py
===================================================================
--- grass/trunk/gui/wxpython/animation/g.gui.animation.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/animation/g.gui.animation.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -61,6 +61,10 @@
     # to avoid issues when only interface is needed
     import grass.temporal as tgis
     import wx
+
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.globalvar import CheckWxVersion
     from core.utils import _
     from core.giface import StandaloneGrassInterface

Modified: grass/trunk/gui/wxpython/datacatalog/g.gui.datacatalog.py
===================================================================
--- grass/trunk/gui/wxpython/datacatalog/g.gui.datacatalog.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/datacatalog/g.gui.datacatalog.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -33,7 +33,10 @@
     # import wx only after running parser
     # to avoid issues when only interface is needed
     import wx
-
+    
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.giface import StandaloneGrassInterface
     from datacatalog.frame import DataCatalogFrame
 

Modified: grass/trunk/gui/wxpython/dbmgr/g.gui.dbmgr.py
===================================================================
--- grass/trunk/gui/wxpython/dbmgr/g.gui.dbmgr.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/dbmgr/g.gui.dbmgr.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -35,6 +35,10 @@
     options, flags = gscript.parser()
 
     import wx
+
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.utils import _
     from dbmgr.manager import AttributeManager
 

Modified: grass/trunk/gui/wxpython/gcp/g.gui.gcp.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/g.gui.gcp.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/gcp/g.gui.gcp.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -47,6 +47,10 @@
     options, flags = gscript.parser()
 
     import wx
+    
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.settings import UserSettings
     from core.globalvar import CheckWxVersion
     from core.giface import StandaloneGrassInterface

Modified: grass/trunk/gui/wxpython/gmodeler/g.gui.gmodeler.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/g.gui.gmodeler.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/gmodeler/g.gui.gmodeler.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -36,11 +36,14 @@
 
 import grass.script as gscript
 
-
 def main():
     options, flags = gscript.parser()
 
     import wx
+    
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.giface import StandaloneGrassInterface
     from core.globalvar import CheckWxVersion
     from gmodeler.frame import ModelFrame

Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -82,6 +82,9 @@
 from grass.script import core as grass
 from grass.script import task as gtask
 
+from grass.script.setup import set_gui_path
+set_gui_path()
+
 from core import globalvar
 from gui_core.widgets import StaticWrapText, ScrolledPanel, ColorTablesComboBox, \
                              BarscalesComboBox, NArrowsComboBox

Modified: grass/trunk/gui/wxpython/iclass/g.gui.iclass.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/g.gui.iclass.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/iclass/g.gui.iclass.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -58,6 +58,10 @@
     options, flags = gscript.parser()
 
     import wx
+
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.settings import UserSettings
     from core.globalvar import CheckWxVersion
     from core.giface import StandaloneGrassInterface

Modified: grass/trunk/gui/wxpython/mapswipe/g.gui.mapswipe.py
===================================================================
--- grass/trunk/gui/wxpython/mapswipe/g.gui.mapswipe.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/mapswipe/g.gui.mapswipe.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -52,6 +52,10 @@
     options, flags = gscript.parser()
 
     import wx
+    
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.settings import UserSettings
     from core.globalvar import CheckWxVersion
     from core.giface import StandaloneGrassInterface

Modified: grass/trunk/gui/wxpython/psmap/g.gui.psmap.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/g.gui.psmap.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/psmap/g.gui.psmap.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -39,6 +39,10 @@
     options, flags = gscript.parser()
 
     import wx
+    
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.globalvar import CheckWxVersion
     from psmap.frame import PsMapFrame
 

Modified: grass/trunk/gui/wxpython/rlisetup/g.gui.rlisetup.py
===================================================================
--- grass/trunk/gui/wxpython/rlisetup/g.gui.rlisetup.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/rlisetup/g.gui.rlisetup.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -33,6 +33,10 @@
     gscript.parser()
 
     import wx
+
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.giface import StandaloneGrassInterface
     from core.globalvar import CheckWxVersion
     from rlisetup.frame import RLiSetupFrame

Modified: grass/trunk/gui/wxpython/timeline/g.gui.timeline.py
===================================================================
--- grass/trunk/gui/wxpython/timeline/g.gui.timeline.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/timeline/g.gui.timeline.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -40,6 +40,10 @@
     options, flags = gscript.parser()
 
     import wx
+
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     try:
         from timeline.frame import TimelineFrame
     except ImportError as e:

Modified: grass/trunk/gui/wxpython/tplot/g.gui.tplot.py
===================================================================
--- grass/trunk/gui/wxpython/tplot/g.gui.tplot.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/tplot/g.gui.tplot.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -78,6 +78,10 @@
     options, flags = gscript.parser()
 
     import wx
+    
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.utils import _
     from core.giface import StandaloneGrassInterface
     try:

Modified: grass/trunk/gui/wxpython/vdigit/g.gui.vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/g.gui.vdigit.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/gui/wxpython/vdigit/g.gui.vdigit.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -46,6 +46,10 @@
     # import wx only after running parser
     # to avoid issues with complex imports when only interface is needed
     import wx
+
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+    
     from core.globalvar import CheckWxVersion
     from core.utils import _
     from core.render import Map

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/lib/init/grass.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -574,8 +574,6 @@
     path_prepend(gpath('bin'), 'PATH')
 
     # Set PYTHONPATH to find GRASS Python modules
-    if os.path.exists(gpath('gui', 'wxpython')):
-        path_prepend(gpath('gui', 'wxpython'), 'PYTHONPATH')
     if os.path.exists(gpath('etc', 'python')):
         path_prepend(gpath('etc', 'python'), 'PYTHONPATH')
 

Modified: grass/trunk/lib/python/script/setup.py
===================================================================
--- grass/trunk/lib/python/script/setup.py	2015-12-21 22:17:28 UTC (rev 67309)
+++ grass/trunk/lib/python/script/setup.py	2015-12-22 01:14:53 UTC (rev 67310)
@@ -109,10 +109,16 @@
     return gisrc
 
 
+def set_gui_path():
+    """Insert wxPython GRASS path to sys.path."""
+    gui_path = os.path.join(os.environ['GISBASE'], 'gui', 'wxpython')
+    if gui_path and gui_path not in sys.path:
+        sys.path.insert(0, gui_path)
+
+
 # TODO: there should be a function to do the clean up
 # (unset the GISRC and delete the file)
-def init(gisbase, dbase='', location='demolocation', mapset='PERMANENT',
-         initgui=False):
+def init(gisbase, dbase='', location='demolocation', mapset='PERMANENT'):
     """Initialize system variables to run GRASS modules
 
     This function is for running GRASS GIS without starting it
@@ -142,7 +148,6 @@
     :param dbase: path to GRASS database (default: '')
     :param location: location name (default: 'demolocation')
     :param mapset: mapset within given location (default: 'PERMANENT')
-    :param initgui: add also GRASS wxPython packages to PYTHONPATH
     
     :returns: path to ``gisrc`` file (to be deleted later)
     """
@@ -183,8 +188,6 @@
     
     path = os.getenv('PYTHONPATH')
     etcpy = os.path.join(gisbase, 'etc', 'python')
-    if initgui:
-        etcpy += os.pathsep + os.path.join(gisbase, 'gui', 'wxpython')
     if path:
         path = etcpy + os.pathsep + path
     else:



More information about the grass-commit mailing list