author | Edouard Tisserant <edouard@beremiz.fr> |
Fri, 30 Aug 2024 11:50:23 +0200 | |
changeset 4008 | f30573e98600 |
parent 3579 | c5070b6973ba |
child 4024 | f9c6bbf66eea |
permissions | -rw-r--r-- |
2873
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
1 |
// hmi_tree.ysl2 |
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
2 |
|
3381
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
3 |
// Location identifies uniquely SVGHMI instance |
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
4 |
param "instance_name"; |
2843
94696b3f69fb
SVGHMI : still trying to optimize. Added xslt code to identitfy minimum set of elements needed by a particular page. Plan is to remove unseen/unused elements from the DOM, and re-appending them later when used, on page switch. Disabled previous optimization.
Edouard Tisserant
parents:
2842
diff
changeset
|
5 |
|
2873
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
6 |
// HMI Tree computed from VARIABLES.CSV in svghmi.py |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
7 |
const "hmitree", "ns:GetHMITree()"; |
2853 | 8 |
|
2877
682bce953795
SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents:
2874
diff
changeset
|
9 |
const "_categories" { |
682bce953795
SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents:
2874
diff
changeset
|
10 |
noindex > HMI_PLC_STATUS |
682bce953795
SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents:
2874
diff
changeset
|
11 |
noindex > HMI_CURRENT_PAGE |
682bce953795
SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents:
2874
diff
changeset
|
12 |
} |
682bce953795
SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents:
2874
diff
changeset
|
13 |
const "categories", "exsl:node-set($_categories)"; |
2867
901c89c0cc08
SVGHMI: unsignificant changes or changes in generated code
Edouard Tisserant
parents:
2866
diff
changeset
|
14 |
|
2873
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
15 |
// HMI Tree Index |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
16 |
const "_indexed_hmitree" apply "$hmitree", mode="index"; |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
17 |
const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)"; |
2843
94696b3f69fb
SVGHMI : still trying to optimize. Added xslt code to identitfy minimum set of elements needed by a particular page. Plan is to remove unseen/unused elements from the DOM, and re-appending them later when used, on page switch. Disabled previous optimization.
Edouard Tisserant
parents:
2842
diff
changeset
|
18 |
|
2941
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
19 |
emit "preamble:hmi-tree" { |
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
20 |
| var hmi_hash = [«$hmitree/@hash»]; |
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
21 |
| |
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
22 |
| var heartbeat_index = «$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index»; |
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
23 |
| |
3381
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
24 |
| var current_page_var_index = «$indexed_hmitree/*[@hmipath = concat('/CURRENT_PAGE_', $instance_name)]/@index»; |
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
25 |
| |
2941
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
26 |
| var hmitree_types = [ |
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
27 |
|
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
28 |
foreach "$indexed_hmitree/*" |
3381
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
29 |
| "«substring(local-name(), 5)»"`if "position()!=last()" > ,` |
3205
62753288be74
SVGHMI: Add list of HMI tree path in a JS array, so that we can use it for multiple purpose :
Edouard Tisserant
parents:
3129
diff
changeset
|
30 |
|
62753288be74
SVGHMI: Add list of HMI tree path in a JS array, so that we can use it for multiple purpose :
Edouard Tisserant
parents:
3129
diff
changeset
|
31 |
| ]; |
62753288be74
SVGHMI: Add list of HMI tree path in a JS array, so that we can use it for multiple purpose :
Edouard Tisserant
parents:
3129
diff
changeset
|
32 |
| |
62753288be74
SVGHMI: Add list of HMI tree path in a JS array, so that we can use it for multiple purpose :
Edouard Tisserant
parents:
3129
diff
changeset
|
33 |
| var hmitree_paths = [ |
62753288be74
SVGHMI: Add list of HMI tree path in a JS array, so that we can use it for multiple purpose :
Edouard Tisserant
parents:
3129
diff
changeset
|
34 |
|
62753288be74
SVGHMI: Add list of HMI tree path in a JS array, so that we can use it for multiple purpose :
Edouard Tisserant
parents:
3129
diff
changeset
|
35 |
foreach "$indexed_hmitree/*" |
3381
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
36 |
| "«@hmipath»"`if "position()!=last()" > ,` |
2941
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
37 |
|
3097
a098b2dd9dff
SVGHMI: Added parsing of min and max value that can be given as @path,min,max in widget description
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3060
diff
changeset
|
38 |
| ]; |
2941
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
39 |
| |
3381
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
40 |
| var hmitree_nodes = { |
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
41 |
|
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
42 |
foreach "$indexed_hmitree/*[local-name() = 'HMI_NODE']" |
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
43 |
| "«@hmipath»" : [«@index», "«@class»"]`if "position()!=last()" > ,` |
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
44 |
| }; |
3a0908b0319d
SVGHMI: add CURRENT_PAGE_{location} global variable to reflect currently visible page. If PLC wites some valid page reference in that variable, it triggers page switch. Additionally, fixed /HEARTBEAT being subscribed systematically by JS code even when wtchdog is not enabled.
Edouard Tisserant
parents:
3221
diff
changeset
|
45 |
| |
2941
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
46 |
} |
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
47 |
|
2873
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
48 |
template "*", mode="index" { |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
49 |
param "index", "0"; |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
50 |
param "parentpath", "''"; |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
51 |
const "content" { |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
52 |
const "path" |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
53 |
choose { |
2890
ae8063127e95
SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2886
diff
changeset
|
54 |
when "count(ancestor::*)=0" > / |
ae8063127e95
SVGHMI: make root HMI tree node a HMI_NODE, droped HMI_ROOT node type
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2886
diff
changeset
|
55 |
when "count(ancestor::*)=1" > /«@name» |
2873
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
56 |
otherwise > «$parentpath»/«@name» |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
57 |
} |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
58 |
choose { |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
59 |
when "not(local-name() = $categories/noindex)" { |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
60 |
xsl:copy { |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
61 |
attrib "index" > «$index» |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
62 |
attrib "hmipath" > «$path» |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
63 |
foreach "@*" xsl:copy; |
2791
d022523cb621
SVGHMI: now generating JS object describing widgets and pointing to SVG elements
Edouard Tisserant
parents:
2790
diff
changeset
|
64 |
} |
2873
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
65 |
apply "*[1]", mode="index"{ |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
66 |
with "index", "$index + 1"; |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
67 |
with "parentpath" > «$path» |
2854
c7d5f46cc306
SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents:
2853
diff
changeset
|
68 |
} |
c7d5f46cc306
SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents:
2853
diff
changeset
|
69 |
} |
c7d5f46cc306
SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents:
2853
diff
changeset
|
70 |
otherwise { |
2873
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
71 |
apply "*[1]", mode="index"{ |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
72 |
with "index", "$index"; |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
73 |
with "parentpath" > «$path» |
2854
c7d5f46cc306
SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents:
2853
diff
changeset
|
74 |
} |
c7d5f46cc306
SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents:
2853
diff
changeset
|
75 |
} |
c7d5f46cc306
SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents:
2853
diff
changeset
|
76 |
} |
c7d5f46cc306
SVGHMI: unlink clones (i.e. deep copy elements refered by svg:use) inside widget.
Edouard Tisserant
parents:
2853
diff
changeset
|
77 |
} |
2842
2f73f001955a
SVGHMI: attempt to optimize for webkit, because of really slow style recompute in svg:use : "unlink clones" (as in inkscape) but stop deep-copy when meeting a widget, and create a new clone instead.
Edouard Tisserant
parents:
2841
diff
changeset
|
78 |
|
2873
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
79 |
copy "$content"; |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
80 |
apply "following-sibling::*[1]", mode="index" { |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
81 |
with "index", "$index + count(exsl:node-set($content)/*)"; |
022db76c3bff
SVGHMI : create hmi_tree.ysl2, rename bbox_intersect.ysl2 into geometry.ysl2 and move more code into. Add per included ysl2 file debug output.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2872
diff
changeset
|
82 |
with "parentpath" > «$parentpath» |
2808
dc78ffa5253d
SVGHMI: SVG viewport now defined so that HMI take scales and fit to the view. Implemented page switch through viewport change, no hiding of widget for now.
Edouard Tisserant
parents:
2807
diff
changeset
|
83 |
} |
2753
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
84 |
} |
2874
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
85 |
|
3221
3d307ad803ea
SVGHMI: Widget Library Picker now transforms SVG widget before allowing DnD. Transform is just identity forn now, but label parsing have already been included. To be continued.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3205
diff
changeset
|
86 |
include parse_labels.ysl2 |
2877
682bce953795
SVGHMI: detachable_elements.ysl2 becomes detachable_pages.ysl2, and includes logic to process pages elements. Other minor code moves.
Edouard Tisserant
parents:
2874
diff
changeset
|
87 |
|
3129
f2709923c82c
SVGHMI: Add "lang" permament persistent HMI_LOCAL variable to reflect selected language, apply stored language choice at startup and make it always subscribed to a pseudo widget (as for hearbeat) that apply language choice when it changes.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3127
diff
changeset
|
88 |
const "_parsed_widgets" { |
f2709923c82c
SVGHMI: Add "lang" permament persistent HMI_LOCAL variable to reflect selected language, apply stored language choice at startup and make it always subscribed to a pseudo widget (as for hearbeat) that apply language choice when it changes.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3127
diff
changeset
|
89 |
widget type="VarInitPersistent" { |
f2709923c82c
SVGHMI: Add "lang" permament persistent HMI_LOCAL variable to reflect selected language, apply stored language choice at startup and make it always subscribed to a pseudo widget (as for hearbeat) that apply language choice when it changes.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3127
diff
changeset
|
90 |
arg value="0"; |
f2709923c82c
SVGHMI: Add "lang" permament persistent HMI_LOCAL variable to reflect selected language, apply stored language choice at startup and make it always subscribed to a pseudo widget (as for hearbeat) that apply language choice when it changes.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3127
diff
changeset
|
91 |
path value="lang"; |
f2709923c82c
SVGHMI: Add "lang" permament persistent HMI_LOCAL variable to reflect selected language, apply stored language choice at startup and make it always subscribed to a pseudo widget (as for hearbeat) that apply language choice when it changes.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3127
diff
changeset
|
92 |
} |
f2709923c82c
SVGHMI: Add "lang" permament persistent HMI_LOCAL variable to reflect selected language, apply stored language choice at startup and make it always subscribed to a pseudo widget (as for hearbeat) that apply language choice when it changes.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3127
diff
changeset
|
93 |
apply "$hmi_elements", mode="parselabel"; |
f2709923c82c
SVGHMI: Add "lang" permament persistent HMI_LOCAL variable to reflect selected language, apply stored language choice at startup and make it always subscribed to a pseudo widget (as for hearbeat) that apply language choice when it changes.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3127
diff
changeset
|
94 |
} |
f2709923c82c
SVGHMI: Add "lang" permament persistent HMI_LOCAL variable to reflect selected language, apply stored language choice at startup and make it always subscribed to a pseudo widget (as for hearbeat) that apply language choice when it changes.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3127
diff
changeset
|
95 |
|
2886
6c82fad8be65
SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2885
diff
changeset
|
96 |
const "parsed_widgets","exsl:node-set($_parsed_widgets)"; |
6c82fad8be65
SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2885
diff
changeset
|
97 |
|
6c82fad8be65
SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2885
diff
changeset
|
98 |
def "func:widget" { |
6c82fad8be65
SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2885
diff
changeset
|
99 |
param "id"; |
6c82fad8be65
SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2885
diff
changeset
|
100 |
result "$parsed_widgets/widget[@id = $id]"; |
2885
f398896b7ebf
SVGHMI: intermediate untested state. Excluded ForEach widget from pages handled widgets.
Edouard Tisserant
parents:
2882
diff
changeset
|
101 |
} |
f398896b7ebf
SVGHMI: intermediate untested state. Excluded ForEach widget from pages handled widgets.
Edouard Tisserant
parents:
2882
diff
changeset
|
102 |
|
2894
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
103 |
def "func:is_descendant_path" { |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
104 |
param "descend"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
105 |
param "ancest"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
106 |
// TODO : use HMI tree to answer more accurately |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
107 |
result "string-length($ancest) > 0 and starts-with($descend,$ancest)"; |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
108 |
} |
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
109 |
|
2900
3ef217f525ff
SVGHMI: Check that explicit relative page jump path is consistant with destination page reference path.
Edouard Tisserant
parents:
2894
diff
changeset
|
110 |
def "func:same_class_paths" { |
3ef217f525ff
SVGHMI: Check that explicit relative page jump path is consistant with destination page reference path.
Edouard Tisserant
parents:
2894
diff
changeset
|
111 |
param "a"; |
3ef217f525ff
SVGHMI: Check that explicit relative page jump path is consistant with destination page reference path.
Edouard Tisserant
parents:
2894
diff
changeset
|
112 |
param "b"; |
3ef217f525ff
SVGHMI: Check that explicit relative page jump path is consistant with destination page reference path.
Edouard Tisserant
parents:
2894
diff
changeset
|
113 |
const "class_a", "$indexed_hmitree/*[@hmipath = $a]/@class"; |
3ef217f525ff
SVGHMI: Check that explicit relative page jump path is consistant with destination page reference path.
Edouard Tisserant
parents:
2894
diff
changeset
|
114 |
const "class_b", "$indexed_hmitree/*[@hmipath = $b]/@class"; |
3ef217f525ff
SVGHMI: Check that explicit relative page jump path is consistant with destination page reference path.
Edouard Tisserant
parents:
2894
diff
changeset
|
115 |
result "$class_a and $class_b and $class_a = $class_b"; |
3ef217f525ff
SVGHMI: Check that explicit relative page jump path is consistant with destination page reference path.
Edouard Tisserant
parents:
2894
diff
changeset
|
116 |
} |
2894
4cf9ad35e6d0
SVGHMI: Easier way to match HMI tree elements to paths. ForEach widget now looks for paths and indexes of all items, and enforce path to be consistent with ForEach items sub widgets
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2893
diff
changeset
|
117 |
|
2874
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
118 |
// Debug data |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
119 |
template "*", mode="testtree"{ |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
120 |
param "indent", "''"; |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
121 |
> «$indent» «local-name()» |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
122 |
foreach "@*" > «local-name()»="«.»" |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
123 |
> \n |
3579
c5070b6973ba
SVGHMI: add support for multiline widget declaration using svg:desc.
Edouard Tisserant
parents:
3381
diff
changeset
|
124 |
if "text()" > «text()»\n |
2874
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
125 |
apply "*", mode="testtree" { |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
126 |
with "indent" value "concat($indent,'>')" |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
127 |
}; |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
128 |
} |
2941
ef13a4007538
SVGHMI: spread JS code from svghmi/scripts.ysl2 in other .ysl2 files, using dedicated preamble and epilogue namespaces
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2940
diff
changeset
|
129 |
|
2940
034b6ce4f885
SVGHMI: Introduced "emit" to simplify producing per-topic code and content from anywhere in code. Applied to debug output, next to JS.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2939
diff
changeset
|
130 |
emit "debug:hmi-tree" { |
2874
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
131 |
| Raw HMI tree |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
132 |
apply "$hmitree", mode="testtree"; |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
133 |
| |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
134 |
| Indexed HMI tree |
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
135 |
apply "$indexed_hmitree", mode="testtree"; |
2886
6c82fad8be65
SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2885
diff
changeset
|
136 |
| |
6c82fad8be65
SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2885
diff
changeset
|
137 |
| Parsed Widgets |
6c82fad8be65
SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2885
diff
changeset
|
138 |
copy "_parsed_widgets"; |
6c82fad8be65
SVGHMI: Simplification and optimization. func:parselabel becomes a template.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2885
diff
changeset
|
139 |
apply "$parsed_widgets", mode="testtree"; |
2874
b67af0b8dc72
SVGHMI: more debug code moved to hmi_tree.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2873
diff
changeset
|
140 |
} |