merge svghmi
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Thu, 25 Mar 2021 13:08:19 +0100
branchsvghmi
changeset 3202 5d379934d5c9
parent 3201 6dadc1690284 (current diff)
parent 3200 75cb73b4a606 (diff)
child 3203 debd5014ce21
merge
--- a/svghmi/detachable_pages.ysl2	Thu Mar 25 13:07:52 2021 +0100
+++ b/svghmi/detachable_pages.ysl2	Thu Mar 25 13:08:19 2021 +0100
@@ -93,10 +93,7 @@
 
 const "required_list_elements", "func:refered_elements($hmi_lists[@id = $required_page_elements/@id])";
 
-const "required_elements",
-    """//svg:defs/descendant-or-self::svg:*
-       | $required_list_elements
-       | $required_page_elements""";
+const "required_elements", "$defs | $required_list_elements | $required_page_elements";
 
 const "discardable_elements", "//svg:*[not(@id = $required_elements/@id)]";
 
--- a/svghmi/gen_index_xhtml.xslt	Thu Mar 25 13:07:52 2021 +0100
+++ b/svghmi/gen_index_xhtml.xslt	Thu Mar 25 13:08:19 2021 +0100
@@ -303,7 +303,9 @@
     <xsl:text>
 </xsl:text>
   </xsl:template>
-  <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
+  <xsl:variable name="all_geometry" select="ns:GetSVGGeometry()"/>
+  <xsl:variable name="defs" select="//svg:defs/descendant-or-self::svg:*"/>
+  <xsl:variable name="geometry" select="$all_geometry[not(@Id = $defs/@id)]"/>
   <debug:geometry/>
   <xsl:template match="debug:geometry">
     <xsl:text>
@@ -476,7 +478,7 @@
   <xsl:variable name="hmi_lists_descs" select="$parsed_widgets/widget[@type = 'List']"/>
   <xsl:variable name="hmi_lists" select="$hmi_elements[@id = $hmi_lists_descs/@id]"/>
   <xsl:variable name="required_list_elements" select="func:refered_elements($hmi_lists[@id = $required_page_elements/@id])"/>
-  <xsl:variable name="required_elements" select="//svg:defs/descendant-or-self::svg:*&#10;       | $required_list_elements&#10;       | $required_page_elements"/>
+  <xsl:variable name="required_elements" select="$defs | $required_list_elements | $required_page_elements"/>
   <xsl:variable name="discardable_elements" select="//svg:*[not(@id = $required_elements/@id)]"/>
   <func:function name="func:sumarized_elements">
     <xsl:param name="elements"/>
--- a/svghmi/geometry.ysl2	Thu Mar 25 13:07:52 2021 +0100
+++ b/svghmi/geometry.ysl2	Thu Mar 25 13:08:19 2021 +0100
@@ -5,7 +5,9 @@
 // This retrieves geometry obtained through "inkscape -S"
 // already parsed by python and presented as a list of
 // <bbox x="0" y="0" w="42" h="42">
-const "geometry", "ns:GetSVGGeometry()";
+const "all_geometry", "ns:GetSVGGeometry()";
+const "defs", "//svg:defs/descendant-or-self::svg:*";
+const "geometry", "$all_geometry[not(@Id = $defs/@id)]";
 
 // Debug data
 emit "debug:geometry" {
--- a/svghmi/i18n.py	Thu Mar 25 13:07:52 2021 +0100
+++ b/svghmi/i18n.py	Thu Mar 25 13:08:19 2021 +0100
@@ -96,7 +96,7 @@
             msg = translation.pop(msgid, None)
             if msg is None:
                 broken_lang.add(langcode)
-                errcallback(_('{}: Missing translation for "{}" (label:{}, id:{})\n').format(lang,msgid,label,svgid))
+                errcallback(_('{}: Missing translation for "{}" (label:{}, id:{})\n').format(langcode,msgid,label,svgid))
                 translated_message.append(msgid)
             else:
                 translated_message.append(msg)
@@ -121,7 +121,7 @@
             broken = True
             errcallback(_('{}: Unused translation "{}":"{}"\n').format(langcode,msgid,msg))
         if broken or langcode in broken_lang:
-            errcallback(_('Translation for {} is outdated, please edit {}.po, click "Catalog -> Update from POT File..." and select messages.pot.\n').format(lang,lang))
+            errcallback(_('Translation for {} is outdated, please edit {}.po, click "Catalog -> Update from POT File..." and select messages.pot.\n').format(langcode,langcode))
 
 
     return langs,translated_messages
--- a/svghmi/svghmi_server.py	Thu Mar 25 13:07:52 2021 +0100
+++ b/svghmi/svghmi_server.py	Thu Mar 25 13:08:19 2021 +0100
@@ -173,7 +173,7 @@
     svghmi_root = Resource()
     svghmi_root.putChild("ws", WebSocketResource(HMIWebSocketServerFactory()))
 
-    svghmi_listener = reactor.listenTCP(8008, Site(svghmi_root))
+    svghmi_listener = reactor.listenTCP(8008, Site(svghmi_root), interface='localhost')
 
     # start a thread that call the C part of SVGHMI
     svghmi_send_thread = Thread(target=SendThreadProc, name="SVGHMI Send")