svghmi/widget_list.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 05 Mar 2021 09:24:45 +0100
branchsvghmi
changeset 3177 5a8abd549aa8
parent 3175 b2ba6eeb61ec
child 3185 9038655c1b18
permissions -rw-r--r--
SVGHMI: Lighter display of HMI Tree, no more icons and use buttons. Auto expand root. Fix loading of HMI tree XML backup (hmiclass attribute wasn't kept).
// widget_list.ysl2

template "widget[@type='List']", mode="widget_defs" {
    param "hmi_element";
    |     items: {
    foreach "$hmi_element/*[@inkscape:label]" {
    |         «@inkscape:label»: "«@id»",
    }
    |     },
}

template "widget[@type='TextStyleList']", mode="widget_defs" {
    param "hmi_element";
    |     styles: {
    foreach "$hmi_element/*[@inkscape:label]" {
        const "text", "func:refered_elements(.)[self::svg:text][1]";
        const "tspan", "$text/svg:tspan[1]";
        const "style" choose {
            when "$text/@style and $tspan/@style" > «$text/@style»;«$tspan/@style»
            otherwise > «$text/@style»«$tspan/@style»

        }
    |         «@inkscape:label»: "«$style»",
    }
    |     },
}