[GRASS-SVN] r64533 - in grass/trunk/gui/wxpython: core gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 9 09:21:21 PST 2015


Author: annakrat
Date: 2015-02-09 09:21:21 -0800 (Mon, 09 Feb 2015)
New Revision: 64533

Modified:
   grass/trunk/gui/wxpython/core/toolboxes.py
   grass/trunk/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

Modified: grass/trunk/gui/wxpython/core/toolboxes.py
===================================================================
--- grass/trunk/gui/wxpython/core/toolboxes.py	2015-02-09 16:39:33 UTC (rev 64532)
+++ grass/trunk/gui/wxpython/core/toolboxes.py	2015-02-09 17:21:21 UTC (rev 64533)
@@ -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/trunk/gui/wxpython/gui_core/menu.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/menu.py	2015-02-09 16:39:33 UTC (rev 64532)
+++ grass/trunk/gui/wxpython/gui_core/menu.py	2015-02-09 17:21:21 UTC (rev 64533)
@@ -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