[GRASS-SVN] r66204 - in grass/trunk/gui/wxpython: core tplot
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Sep 13 19:49:57 PDT 2015
Author: annakrat
Date: 2015-09-13 19:49:57 -0700 (Sun, 13 Sep 2015)
New Revision: 66204
Modified:
grass/trunk/gui/wxpython/core/toolboxes.py
grass/trunk/gui/wxpython/tplot/g.gui.tplot.py
Log:
workaround some compilation problems on Mac (see #2142, #1819)
Modified: grass/trunk/gui/wxpython/core/toolboxes.py
===================================================================
--- grass/trunk/gui/wxpython/core/toolboxes.py 2015-09-13 22:14:56 UTC (rev 66203)
+++ grass/trunk/gui/wxpython/core/toolboxes.py 2015-09-14 02:49:57 UTC (rev 66204)
@@ -62,14 +62,20 @@
# (these files are always check for existence here)
return ""
-userToolboxesFile = os.path.join(GetSettingsPath(), 'toolboxes', 'toolboxes.xml')
-userMainMenuFile = os.path.join(GetSettingsPath(), 'toolboxes', 'main_menu.xml')
-if not os.path.exists(userToolboxesFile):
- userToolboxesFile = None
-if not os.path.exists(userMainMenuFile):
- userMainMenuFile = None
+def _getUserToolboxesFile():
+ userToolboxesFile = os.path.join(GetSettingsPath(), 'toolboxes', 'toolboxes.xml')
+ if not os.path.exists(userToolboxesFile):
+ userToolboxesFile = None
+ return userToolboxesFile
+def _getUserMainMenuFile():
+ userMainMenuFile = os.path.join(GetSettingsPath(), 'toolboxes', 'main_menu.xml')
+ if not os.path.exists(userMainMenuFile):
+ userMainMenuFile = None
+ return userMainMenuFile
+
+
def _(string):
"""Get translated version of a string"""
# is attribute initialized to actual value?
@@ -156,27 +162,27 @@
if os.path.exists(menudataFile):
# remove menu file when there is no main_menu and toolboxes
- if not userToolboxesFile and not userRootFile:
+ if not _getUserToolboxesFile() and not userRootFile:
os.remove(menudataFile)
_debug(2, "toolboxes.getMenudataFile: no user defined files, menudata deleted")
return fallback
- if bool(userToolboxesFile) != bool(userRootFile):
+ if bool(_getUserToolboxesFile()) != bool(userRootFile):
# always generate new because we don't know if there has been any change
generateNew = True
_debug(2, "toolboxes.getMenudataFile: only one of the user defined files")
else:
# if newer files -> generate new
menudataTime = os.path.getmtime(menudataFile)
- if userToolboxesFile:
- if os.path.getmtime(userToolboxesFile) > menudataTime:
+ if _getUserToolboxesFile():
+ if os.path.getmtime(_getUserToolboxesFile()) > menudataTime:
_debug(2, "toolboxes.getMenudataFile: user toolboxes is newer than menudata")
generateNew = True
if userRootFile:
if os.path.getmtime(userRootFile) > menudataTime:
_debug(2, "toolboxes.getMenudataFile: user root file is newer than menudata")
generateNew = True
- elif userToolboxesFile or userRootFile:
+ elif _getUserToolboxesFile() or userRootFile:
_debug(2, "toolboxes.getMenudataFile: no menudata")
generateNew = True
else:
@@ -256,8 +262,8 @@
toolboxes = etree.parse(toolboxesFile)
- if userDefined and userToolboxesFile:
- userToolboxes = etree.parse(userToolboxesFile)
+ if userDefined and _getUserToolboxesFile():
+ userToolboxes = etree.parse(_getUserToolboxesFile())
else:
userToolboxes = None
@@ -604,9 +610,11 @@
hasErrors = True
if hasErrors:
- sys.stderr.write(_("WARNING: Some addons failed when loading. "
- "Please consider to update your addons by running 'g.extension.all -f'.\n"))
-
+ # not translatable until toolboxes compilation on Mac is fixed
+ # translating causes importing globalvar, where sys.exit is called
+ sys.stderr.write("WARNING: Some addons failed when loading. "
+ "Please consider to update your addons by running 'g.extension.all -f'.\n")
+
def _escapeXML(text):
"""Helper function for correct escaping characters for XML.
Modified: grass/trunk/gui/wxpython/tplot/g.gui.tplot.py
===================================================================
--- grass/trunk/gui/wxpython/tplot/g.gui.tplot.py 2015-09-13 22:14:56 UTC (rev 66203)
+++ grass/trunk/gui/wxpython/tplot/g.gui.tplot.py 2015-09-14 02:49:57 UTC (rev 66204)
@@ -72,7 +72,6 @@
#%end
import grass.script as gscript
-from core.giface import StandaloneGrassInterface
def main():
@@ -80,6 +79,7 @@
import wx
from core.utils import _
+ from core.giface import StandaloneGrassInterface
try:
from tplot.frame import TplotFrame
except ImportError as e:
More information about the grass-commit
mailing list