svghmi/widget_list.ysl2
author Edouard Tisserant
Fri, 12 Mar 2021 15:12:38 +0100
branchsvghmi
changeset 3187 ba8ff21fd82b
parent 3175 b2ba6eeb61ec
child 3185 9038655c1b18
permissions -rw-r--r--
SVGHMI: change default values for JsonTable, leading to scrollbar initialized at annoying non-zero position
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
}