[GRASS-SVN] r72833 - grass/trunk/gui/wxpython/core

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jun 15 08:10:42 PDT 2018


Author: wenzeslaus
Date: 2018-06-15 08:10:42 -0700 (Fri, 15 Jun 2018)
New Revision: 72833

Modified:
   grass/trunk/gui/wxpython/core/toolboxes.py
Log:
wxGUI: etree takes only non-keyword arguments for parent and tag in Python 3

The error in Python 3.5 was:
TypeError: SubElement() takes at least 2 arguments (1 given)

Fixes building of toolboxes (compilation and start of GUI).


Modified: grass/trunk/gui/wxpython/core/toolboxes.py
===================================================================
--- grass/trunk/gui/wxpython/core/toolboxes.py	2018-06-15 02:38:17 UTC (rev 72832)
+++ grass/trunk/gui/wxpython/core/toolboxes.py	2018-06-15 15:10:42 UTC (rev 72833)
@@ -491,9 +491,9 @@
             'toolbox', attrib={
                 'name': 'GeneratedUserToolboxesList'})
         items.insert(idx, el)
-        label = etree.SubElement(el, tag='label')
+        label = etree.SubElement(el, 'label')
         label.text = _("Custom toolboxes")
-        it = etree.SubElement(el, tag='items')
+        it = etree.SubElement(el, 'items')
         for toolbox in tboxes:
             it.append(copy.deepcopy(toolbox))
         items.remove(n)
@@ -572,13 +572,13 @@
         # attib={'name': 'AddonsList'}
         el = etree.Element('menu')
         items.insert(idx, el)
-        label = etree.SubElement(el, tag='label')
+        label = etree.SubElement(el, 'label')
         label.text = _("Addons")
-        it = etree.SubElement(el, tag='items')
+        it = etree.SubElement(el, 'items')
         for addon in addons:
-            addonItem = etree.SubElement(it, tag='module-item')
+            addonItem = etree.SubElement(it, 'module-item')
             addonItem.attrib = {'name': addon}
-            addonLabel = etree.SubElement(addonItem, tag='label')
+            addonLabel = etree.SubElement(addonItem, 'label')
             addonLabel.text = addon
         items.remove(n)
 
@@ -637,7 +637,7 @@
     for module in modules:
         name = module.get('name')
         if module.find('module') is None:
-            n = etree.SubElement(parent=module, tag='module')
+            n = etree.SubElement(module, 'module')
             n.text = name
 
         if module.find('description') is None:
@@ -645,9 +645,9 @@
                 desc, keywords = _loadMetadata(name)
             else:
                 desc, keywords = '', ''
-            n = etree.SubElement(parent=module, tag='description')
+            n = etree.SubElement(module, 'description')
             n.text = _escapeXML(desc)
-            n = etree.SubElement(parent=module, tag='keywords')
+            n = etree.SubElement(module, 'keywords')
             n.text = _escapeXML(','.join(keywords))
             if loadMetadata and not desc:
                 hasErrors = True
@@ -692,13 +692,13 @@
     """Add missing handlers to modules"""
     for n in node.findall('.//module-item'):
         if n.find('handler') is None:
-            handlerNode = etree.SubElement(parent=n, tag='handler')
+            handlerNode = etree.SubElement(n, 'handler')
             handlerNode.text = 'OnMenuCmd'
 
     # e.g. g.region -p
     for n in node.findall('.//wxgui-item'):
         if n.find('command') is not None:
-            handlerNode = etree.SubElement(parent=n, tag='handler')
+            handlerNode = etree.SubElement(n, 'handler')
             handlerNode.text = 'RunMenuCmd'
 
 



More information about the grass-commit mailing list