# HG changeset patch
# User Edouard Tisserant
# Date 1570694084 -7200
# Node ID c0cf62bb9aa7fe435adc6699494396f54c679583
# Parent c10069a02ed0bf653b9d58c286113762fc02f8a5
SVGHMI compute default page
diff -r c10069a02ed0 -r c0cf62bb9aa7 svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt Wed Oct 09 11:15:14 2019 +0200
+++ b/svghmi/gen_index_xhtml.xslt Thu Oct 10 09:54:44 2019 +0200
@@ -6,6 +6,27 @@
+
+
+
+
+
+
+ Home
+
+
+ No Home page defined!
+
+
+
+
+ No page defined!
+
+
+
+
+
+
HMI_ROOT
@@ -209,13 +230,13 @@
id: "
- "
+ ",
widgets: [
-
+
"
"
@@ -230,6 +251,12 @@
}
+
+
+ var default_page = "
+
+ ";
+
// svghmi.js
diff -r c10069a02ed0 -r c0cf62bb9aa7 svghmi/gen_index_xhtml.ysl2
--- a/svghmi/gen_index_xhtml.ysl2 Wed Oct 09 11:15:14 2019 +0200
+++ b/svghmi/gen_index_xhtml.ysl2 Thu Oct 10 09:54:44 2019 +0200
@@ -29,6 +29,23 @@
const "hmi_pages", "$hmi_elements[func:parselabel(@inkscape:label)/widget/@type = 'Page']";
+ const "default_page" choose {
+ when "count($hmi_pages) > 1" {
+ const "Home_page",
+ "$hmi_pages[func:parselabel(@inkscape:label)/widget/arg[1]/@value = 'Home']";
+ choose {
+ when "$Home_page" > Home
+ otherwise {
+ error "No Home page defined!";
+ }
+ }
+ }
+ when "count($hmi_pages) = 0" {
+ error "No page defined!";
+ }
+ otherwise > «func:parselabel($hmi_pages/@inkscape:label)/widget/arg[1]/@value»
+ }
+
const "_categories" {
noindex > HMI_ROOT
noindex > HMI_LABEL
@@ -37,7 +54,6 @@
noindex > HMI_CURRENT_PAGE
}
const "categories", "exsl:node-set($_categories)";
- //const "indexed_hmitree", "$hmitree[not(local-name() = $categories/noindex/text())]";
const "_indexed_hmitree" apply "$hmitree", mode="index";
const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
@@ -196,7 +212,7 @@
foreach "$hmi_pages" {
const "desc", "func:parselabel(@inkscape:label)/widget";
| "«$desc/arg[1]/@value»": {
- | id: "«@id»"
+ | id: "«@id»",
| widgets: [
const "page", ".";
const "p", "$hmi_geometry[@Id = $page/@id]";
@@ -209,6 +225,9 @@
}
| }
+ |
+ | var default_page = "«$default_page»";
+
include text svghmi.js
}