[GRASS-SVN] r64629 - in grass/branches/releasebranch_7_0/gui/wxpython: core gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Feb 14 09:35:06 PST 2015
Author: annakrat
Date: 2015-02-14 09:35:06 -0800 (Sat, 14 Feb 2015)
New Revision: 64629
Modified:
grass/branches/releasebranch_7_0/gui/wxpython/core/toolboxes.py
grass/branches/releasebranch_7_0/gui/wxpython/gui_core/menu.py
Log:
wxGUI: do not load addons metadata at gui start on Windows because it results in crash dialog when addon is incompatible with the current version (merge from trunk, r64533)
Modified: grass/branches/releasebranch_7_0/gui/wxpython/core/toolboxes.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/core/toolboxes.py 2015-02-14 17:30:55 UTC (rev 64628)
+++ grass/branches/releasebranch_7_0/gui/wxpython/core/toolboxes.py 2015-02-14 17:35:06 UTC (rev 64629)
@@ -271,7 +271,13 @@
root = tree.getroot()
_expandAddonsItem(root)
# expanding and converting is done twice, so there is some overhead
- _expandRuntimeModules(root)
+ # we don't load metadata by calling modules on Windows because when
+ # installed addons are not compatible, Windows show ugly crash dialog
+ # for every incompatible addon
+ if sys.platform == "win32":
+ _expandRuntimeModules(root, loadMetadata=False)
+ else:
+ _expandRuntimeModules(root, loadMetadata=True)
_addHandlers(root)
_convertTree(root)
@@ -487,9 +493,11 @@
moduleItem.append(node)
-def _expandRuntimeModules(node):
+def _expandRuntimeModules(node, loadMetadata=True):
"""Add information to modules (desc, keywords)
by running them with --interface-description.
+ If loadMetadata is False, modules are not called,
+ useful for incompatible addons.
>>> tree = etree.fromstring('<items>'
... '<module-item name="g.region"></module-item>'
@@ -513,12 +521,15 @@
n.text = name
if module.find('description') is None:
- desc, keywords = _loadMetadata(name)
+ if loadMetadata:
+ desc, keywords = _loadMetadata(name)
+ else:
+ desc, keywords = '', ''
n = etree.SubElement(parent=module, tag='description')
n.text = _escapeXML(desc)
n = etree.SubElement(parent=module, tag='keywords')
n.text = _escapeXML(','.join(keywords))
- if not desc:
+ if loadMetadata and not desc:
hasErrors = True
if hasErrors:
Modified: grass/branches/releasebranch_7_0/gui/wxpython/gui_core/menu.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/gui_core/menu.py 2015-02-14 17:30:55 UTC (rev 64628)
+++ grass/branches/releasebranch_7_0/gui/wxpython/gui_core/menu.py 2015-02-14 17:35:06 UTC (rev 64629)
@@ -237,7 +237,9 @@
return
if data['command']:
- label = data['command'] + ' -- ' + data['description']
+ label = data['command']
+ if data['description']:
+ label += ' -- ' + data['description']
else:
label = data['description']
More information about the grass-commit
mailing list