svghmi/widget_list.ysl2
author Edouard Tisserant
Thu, 11 Mar 2021 20:46:05 +0100
branchsvghmi
changeset 3186 1e9b9d7451cd
parent 3175 b2ba6eeb61ec
child 3185 9038655c1b18
permissions -rw-r--r--
SVGHMI: Ensure that when a HMI:List is refered, none of its refered elements are discarded.
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
// widget_list.ysl2
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
     3
template "widget[@type='List']", mode="widget_defs" {
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
    param "hmi_element";
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
    |     items: {
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
    foreach "$hmi_element/*[@inkscape:label]" {
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
     7
    |         «@inkscape:label»: "«@id»",
2997
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
    }
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     9
    |     },
2f298089e32e SVGHMI: JsonTable now picks items from HMI:List, and update texts, all according to Json data. Still miss scrolling.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
}
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
    11
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
    12
template "widget[@type='TextStyleList']", mode="widget_defs" {
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
    13
    param "hmi_element";
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
    14
    |     styles: {
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
    15
    foreach "$hmi_element/*[@inkscape:label]" {
3175
b2ba6eeb61ec SVGHMI: attempt to prevent crazy styling with HMI:TextStyleList when inkscape store style in tspan instead of text element.
Edouard Tisserant
parents: 3031
diff changeset
    16
        const "text", "func:refered_elements(.)[self::svg:text][1]";
b2ba6eeb61ec SVGHMI: attempt to prevent crazy styling with HMI:TextStyleList when inkscape store style in tspan instead of text element.
Edouard Tisserant
parents: 3031
diff changeset
    17
        const "tspan", "$text/svg:tspan[1]";
b2ba6eeb61ec SVGHMI: attempt to prevent crazy styling with HMI:TextStyleList when inkscape store style in tspan instead of text element.
Edouard Tisserant
parents: 3031
diff changeset
    18
        const "style" choose {
b2ba6eeb61ec SVGHMI: attempt to prevent crazy styling with HMI:TextStyleList when inkscape store style in tspan instead of text element.
Edouard Tisserant
parents: 3031
diff changeset
    19
            when "$text/@style and $tspan/@style" > «$text/@style»;«$tspan/@style»
b2ba6eeb61ec SVGHMI: attempt to prevent crazy styling with HMI:TextStyleList when inkscape store style in tspan instead of text element.
Edouard Tisserant
parents: 3031
diff changeset
    20
            otherwise > «$text/@style»«$tspan/@style»
b2ba6eeb61ec SVGHMI: attempt to prevent crazy styling with HMI:TextStyleList when inkscape store style in tspan instead of text element.
Edouard Tisserant
parents: 3031
diff changeset
    21
b2ba6eeb61ec SVGHMI: attempt to prevent crazy styling with HMI:TextStyleList when inkscape store style in tspan instead of text element.
Edouard Tisserant
parents: 3031
diff changeset
    22
        }
3031
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
    23
    |         «@inkscape:label»: "«$style»",
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
    24
    }
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
    25
    |     },
440d74319a74 SVGHMI: Refactor the way JsonTable generate javascript code to access json data. Now support multiple assignments, used in the case of text to change both content and style on the same element.
Edouard Tisserant
parents: 3028
diff changeset
    26
}