svghmi/widget_list.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 05 Mar 2021 00:02:52 +0100
branchsvghmi
changeset 3176 81136a097012
parent 3175 b2ba6eeb61ec
child 3185 9038655c1b18
permissions -rw-r--r--
SVGHMI: Systematically save HMI Tree in build directory as hmitree.xml when building, so that HMI Tree can be displayed when re-opening project, without having to build
// 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»",
    }
    |     },
}