equal
deleted
inserted
replaced
58 |
58 |
59 include detachable_pages.ysl2 |
59 include detachable_pages.ysl2 |
60 |
60 |
61 include inline_svg.ysl2 |
61 include inline_svg.ysl2 |
62 |
62 |
|
63 include widget_common.ysl2 |
|
64 |
63 template "/" { |
65 template "/" { |
64 comment > Made with SVGHMI. https://beremiz.org |
66 comment > Made with SVGHMI. https://beremiz.org |
65 |
67 |
66 // use python to call all debug output from included definitions |
68 // use python to call all debug output from included definitions |
67 python gen_debug_calls; |
69 python gen_debug_calls; |
118 } |
120 } |
119 || |
121 || |
120 */ |
122 */ |
121 |
123 |
122 | var hmi_widgets = { |
124 | var hmi_widgets = { |
123 foreach "$hmi_elements" { |
125 apply "$hmi_elements", mode="hmi_elements"; |
124 const "widget", "func:parselabel(@inkscape:label)/widget"; |
|
125 const "eltid","@id"; |
|
126 | "«@id»": { |
|
127 | type: "«$widget/@type»", |
|
128 | args: [ |
|
129 foreach "$widget/arg" |
|
130 | "«@value»"`if "position()!=last()" > ,` |
|
131 | ], |
|
132 | indexes: [ |
|
133 foreach "$widget/path" { |
|
134 choose { |
|
135 when "not(@index)" { |
|
136 warning > Widget «$widget/@type» id="«$eltid»" : No match for path "«@value»" in HMI tree |
|
137 } |
|
138 otherwise { |
|
139 | «@index»`if "position()!=last()" > ,` |
|
140 } |
|
141 } |
|
142 } |
|
143 | ], |
|
144 | element: id("«@id»"), |
|
145 apply "$widget", mode="widget_defs" with "hmi_element","."; |
|
146 | }`if "position()!=last()" > ,` |
|
147 } |
|
148 | } |
126 | } |
149 | |
127 | |
150 | var heartbeat_index = «$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index»; |
128 | var heartbeat_index = «$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index»; |
151 | |
129 | |
152 | var hmitree_types = [ |
130 | var hmitree_types = [ |
203 // priv:priv |
181 // priv:priv |
204 // }) |
182 // }) |
205 // } |
183 // } |
206 // || |
184 // || |
207 // } |
185 // } |
208 |
|
209 |
|
210 |
|
211 function "defs_by_labels" { |
|
212 param "labels","''"; |
|
213 param "mandatory","'yes'"; |
|
214 param "hmi_element"; |
|
215 const "widget_type","@type"; |
|
216 foreach "str:split($labels)" { |
|
217 const "name","."; |
|
218 const "elt_id","$result_svg_ns//*[@id = $hmi_element/@id]//*[@inkscape:label=$name][1]/@id"; |
|
219 choose { |
|
220 when "not($elt_id)" { |
|
221 if "$mandatory='yes'" { |
|
222 // TODO FIXME error > «$widget_type» widget must have a «$name» element |
|
223 warning > «$widget_type» widget must have a «$name» element |
|
224 } |
|
225 // otherwise produce nothing |
|
226 } |
|
227 otherwise { |
|
228 | «$name»_elt: id("«$elt_id»"), |
|
229 } |
|
230 } |
|
231 } |
|
232 } |
|
233 |
186 |
234 |
187 |
235 template "widget[@type='Display']", mode="widget_defs" { |
188 template "widget[@type='Display']", mode="widget_defs" { |
236 param "hmi_element"; |
189 param "hmi_element"; |
237 | frequency: 5, |
190 | frequency: 5, |