SVGHMI: Widget transform before DnD now have HMI path as a parameter svghmi
authorEdouard Tisserant
Tue, 06 Apr 2021 14:04:08 +0200
branchsvghmi
changeset 3224 507dd7bc8cb5
parent 3223 061796d9855e
child 3225 cfa5690c8c15
SVGHMI: Widget transform before DnD now have HMI path as a parameter
svghmi/gen_dnd_widget_svg.xslt
svghmi/hmi_tree.py
--- a/svghmi/gen_dnd_widget_svg.xslt	Tue Apr 06 11:47:07 2021 +0200
+++ b/svghmi/gen_dnd_widget_svg.xslt	Tue Apr 06 14:04:08 2021 +0200
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:func="http://exslt.org/functions" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn">
+<xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg" xmlns:str="http://exslt.org/strings" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns="beremiz" xmlns:cc="http://creativecommons.org/ns#" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0" exclude-result-prefixes="ns func exsl regexp str dyn">
   <xsl:output method="xml"/>
   <xsl:param name="hmi_path"/>
   <xsl:variable name="svg" select="/svg:svg"/>
--- a/svghmi/hmi_tree.py	Tue Apr 06 11:47:07 2021 +0200
+++ b/svghmi/hmi_tree.py	Tue Apr 06 14:04:08 2021 +0200
@@ -125,7 +125,9 @@
         # hash is computed on demand
         node = cls(path, name, nodetype, hmiclass=hmiclass)
         for child in enode.iterchildren():
-            node.children.append(cls.from_etree(child))
+            newnode = cls.from_etree(child)
+            newnode.parent = weakref.ref(node)
+            node.children.append(newnode)
         return node
 
     def traverse(self):