# HG changeset patch # User Edouard Tisserant # Date 1619991837 -7200 # Node ID f2bfb047d0e6c776ee06554c398ddfa7c4f6f77c # Parent 315f17e74ef5f5150b471b6760e32921f0221a91 SVGHMI: drop useless code from gen_dnd_widget.yslt2, renamed python callback to pass messages diff -r 315f17e74ef5 -r f2bfb047d0e6 svghmi/gen_dnd_widget_svg.xslt --- a/svghmi/gen_dnd_widget_svg.xslt Sun May 02 23:15:23 2021 +0200 +++ b/svghmi/gen_dnd_widget_svg.xslt Sun May 02 23:43:57 2021 +0200 @@ -1,11 +1,11 @@ - + - + @@ -51,22 +51,29 @@ - - + + + + + + + + + - + + + + - - - - + Widget id: @@ -128,9 +135,9 @@ @ - : + , - : + , @@ -214,7 +221,7 @@ - + diff -r 315f17e74ef5 -r f2bfb047d0e6 svghmi/gen_dnd_widget_svg.ysl2 --- a/svghmi/gen_dnd_widget_svg.ysl2 Sun May 02 23:15:23 2021 +0200 +++ b/svghmi/gen_dnd_widget_svg.ysl2 Sun May 02 23:43:57 2021 +0200 @@ -11,7 +11,6 @@ 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" /* Namespace to invoke python code */ xmlns:ns="beremiz" @@ -20,7 +19,6 @@ exclude-result-prefixes="ns func exsl regexp str dyn" { param "hmi_path"; - const "svg", "/svg:svg"; const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]"; const "subhmitree", "ns:GetSubHMITree()"; @@ -84,7 +82,7 @@ msg value "$svg_widget_type"; } - value "ns:GiveDetails($testmsg)"; + value "ns:PassMessage($testmsg)"; apply "/", mode="inline_svg"; } diff -r 315f17e74ef5 -r f2bfb047d0e6 svghmi/ui.py --- a/svghmi/ui.py Sun May 02 23:15:23 2021 +0200 +++ b/svghmi/ui.py Sun May 02 23:43:57 2021 +0200 @@ -293,6 +293,10 @@ for msg in msgs: self.msg += msg.text + "\n" + def PassMessage(self, _context, msgs): + for msg in msgs: + self.msg += msg.text + "\n" + def GetSubHMITree(self, _context): return [self.hmitree_node.etree()] @@ -312,7 +316,7 @@ transform = XSLTransform( os.path.join(ScriptDirectory, "gen_dnd_widget_svg.xslt"), [("GetSubHMITree", self.GetSubHMITree), - ("GiveDetails", self.GiveDetails)]) + ("PassMessage", self.GiveDetails)]) svgdom = etree.parse(self.selected_SVG)