[GRASS-SVN] r57206 - in grass/trunk/gui/wxpython: core lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 18 05:27:01 PDT 2013
Author: annakrat
Date: 2013-07-18 05:27:01 -0700 (Thu, 18 Jul 2013)
New Revision: 57206
Modified:
grass/trunk/gui/wxpython/core/menutree.py
grass/trunk/gui/wxpython/lmgr/menudata.py
Log:
wxGUI/toolboxes: do not expand addons tag during compilation
Modified: grass/trunk/gui/wxpython/core/menutree.py
===================================================================
--- grass/trunk/gui/wxpython/core/menutree.py 2013-07-18 10:31:48 UTC (rev 57205)
+++ grass/trunk/gui/wxpython/core/menutree.py 2013-07-18 12:27:01 UTC (rev 57206)
@@ -50,7 +50,7 @@
from core.treemodel import TreeModel, ModuleNode
from core.settings import UserSettings
-from core.toolboxes import expandAddons
+from core.toolboxes import expandAddons as expAddons
if not os.getenv("GISBASE"):
sys.exit("GRASS is not running. Exiting...")
@@ -59,14 +59,16 @@
# TODO: change the system to remove strange derived classes
class MenuTreeModelBuilder:
"""!Abstract menu data class"""
- def __init__(self, filename):
+ def __init__(self, filename, expandAddons=True):
self.menustyle = UserSettings.Get(group = 'appearance',
key = 'menustyle',
subkey = 'selection')
xmlTree = etree.parse(filename)
- expandAddons(xmlTree)
+ if expandAddons:
+ expAddons(xmlTree)
+
self.model = TreeModel(ModuleNode)
self._createModel(xmlTree)
Modified: grass/trunk/gui/wxpython/lmgr/menudata.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/menudata.py 2013-07-18 10:31:48 UTC (rev 57205)
+++ grass/trunk/gui/wxpython/lmgr/menudata.py 2013-07-18 12:27:01 UTC (rev 57206)
@@ -25,13 +25,18 @@
class LayerManagerMenuData(MenuTreeModelBuilder):
def __init__(self, filename=None):
+ if filename:
+ expandAddons = False
+ else:
+ expandAddons = True
+
fallback = os.path.join(ETCWXDIR, 'xml', 'menudata.xml')
if not filename:
filename = getMenudataFile(userRootFile='main_menu.xml',
newFile='menudata.xml',
fallback=fallback)
try:
- MenuTreeModelBuilder.__init__(self, filename)
+ MenuTreeModelBuilder.__init__(self, filename, expandAddons=expandAddons)
except (ValueError, AttributeError, TypeError):
GError(_("Unable to parse user toolboxes XML files. "
"Default main menu will be loaded."))
@@ -41,6 +46,11 @@
class LayerManagerModuleTree(MenuTreeModelBuilder):
def __init__(self, filename=None):
+ if filename:
+ expandAddons = False
+ else:
+ expandAddons = True
+
fallback = os.path.join(ETCWXDIR, 'xml', 'module_tree_menudata.xml')
if not filename:
filename = getMenudataFile(userRootFile='module_tree.xml',
@@ -48,7 +58,7 @@
fallback=fallback)
# TODO: try-except useless?
try:
- MenuTreeModelBuilder.__init__(self, filename)
+ MenuTreeModelBuilder.__init__(self, filename, expandAddons=expandAddons)
except (ValueError, AttributeError, TypeError):
GError(_("Unable to parse user toolboxes XML files. "
"Default module tree will be loaded."))
More information about the grass-commit
mailing list