intermediate commit, work in progress svghmi
authorEdouard Tisserant
Wed, 07 Aug 2019 14:18:22 +0200
branchsvghmi
changeset 2750 2694170cd88e
parent 2749 2769b3aed34d
child 2751 eab6161e603d
intermediate commit, work in progress
svghmi/default.svg
svghmi/pous.xml
svghmi/svghmi.c
svghmi/svghmi.py
tests/svghmi/beremiz.xml
tests/svghmi/plc.xml
tests/svghmi/svghmi_0@svghmi/baseconfnode.xml
tests/svghmi/svghmi_0@svghmi/confnode.xml
tests/svghmi/svghmi_0@svghmi/gui.svg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/svghmi/default.svg	Wed Aug 07 14:18:22 2019 +0200
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="1280"
+   height="720"
+   viewBox="0 0 1280 720"
+   version="1.1"
+   id="hmi0"
+   sodipodi:docname="default.svg"
+   inkscape:version="0.92.3 (2405546, 2018-03-11)">
+  <metadata
+     id="metadata4542">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:document-units="px"
+     inkscape:current-layer="hmi0"
+     showgrid="false"
+     units="px"
+     inkscape:zoom="0.7"
+     inkscape:cx="576.80864"
+     inkscape:cy="330.28432"
+     inkscape:window-width="1600"
+     inkscape:window-height="886"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1" />
+  <rect
+     style="color:#000000"
+     id="page0"
+     width="1280"
+     height="720"
+     x="0"
+     y="0">
+    <desc
+       id="desc_page0">This is description for page 0
+
+all lines in the form &quot;name: value&quot; 
+are used as js object definition initializer
+
+role: &quot;page&quot;
+name: &quot;Home&quot;
+
+after triple opening braces is global JavaScript code
+
+{{{
+/* JS style Comment */
+alert(&quot;Hello World&quot;);
+}}}
+
+after triple closing braces is back to description
+</desc>
+  </rect>
+  <text
+     xml:space="preserve"
+     style="font-style:normal;font-weight:normal;font-size:160px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     x="436.32812"
+     y="418.24219"
+     id="text5151"
+     inkscape:label="count"><desc
+       id="desc5153">path: &quot;count&quot;
+format: &quot;%4.4d&quot;</desc><tspan
+       sodipodi:role="line"
+       id="tspan5149"
+       x="436.32812"
+       y="418.24219"
+       style="stroke-width:1px">8888</tspan></text>
+</svg>
--- a/svghmi/pous.xml	Thu Jul 18 14:09:33 2019 +0200
+++ b/svghmi/pous.xml	Wed Aug 07 14:18:22 2019 +0200
@@ -1,7 +1,7 @@
 <?xml version='1.0' encoding='utf-8'?>
 <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201">
   <fileHeader companyName="Beremiz" productName="Beremiz" productVersion="0.0" creationDateTime="2008-12-14T16:53:26"/>
-  <contentHeader name="Beremiz non-standard POUs library" modificationDateTime="2019-07-09T11:05:01">
+  <contentHeader name="Beremiz non-standard POUs library" modificationDateTime="2019-08-06T14:08:26">
     <coordinateInfo>
       <fbd>
         <scaling x="0" y="0"/>
@@ -28,7 +28,7 @@
       </dataType>
       <dataType name="HMI_STRING">
         <baseType>
-          <STRING/>
+          <string/>
         </baseType>
       </dataType>
       <dataType name="HMI_BOOL">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/svghmi/svghmi.c	Wed Aug 07 14:18:22 2019 +0200
@@ -0,0 +1,6 @@
+
+void test_me(void){
+    /*
+    %(hmi_tree)
+    */
+}
--- a/svghmi/svghmi.py	Thu Jul 18 14:09:33 2019 +0200
+++ b/svghmi/svghmi.py	Wed Aug 07 14:18:22 2019 +0200
@@ -28,7 +28,7 @@
 
 class SVGHMILibrary(POULibrary):
     def GetLibraryPath(self):
-        return paths.AbsNeighbourFile(__file__, "pous.xml")
+         return paths.AbsNeighbourFile(__file__, "pous.xml")
 
     def Generate_C(self, buildpath, varlist, IECCFLAGS):
 
@@ -90,6 +90,7 @@
         if from_project_path is not None:
             shutil.copyfile(self._getSVGpath(from_project_path),
                             self._getSVGpath())
+        return True
 
     def CTNGenerate_C(self, buildpath, locations):
         """
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/svghmi/beremiz.xml	Wed Aug 07 14:18:22 2019 +0200
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='utf-8'?>
+<BeremizRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <TargetType/>
+</BeremizRoot>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/svghmi/plc.xml	Wed Aug 07 14:18:22 2019 +0200
@@ -0,0 +1,38 @@
+<?xml version='1.0' encoding='utf-8'?>
+<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
+  <fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2019-08-06T14:23:42"/>
+  <contentHeader name="Unnamed" modificationDateTime="2019-08-06T14:37:15">
+    <coordinateInfo>
+      <fbd>
+        <scaling x="0" y="0"/>
+      </fbd>
+      <ld>
+        <scaling x="0" y="0"/>
+      </ld>
+      <sfc>
+        <scaling x="0" y="0"/>
+      </sfc>
+    </coordinateInfo>
+  </contentHeader>
+  <types>
+    <dataTypes/>
+    <pous>
+      <pou name="program0" pouType="program">
+        <body>
+          <FBD/>
+        </body>
+      </pou>
+    </pous>
+  </types>
+  <instances>
+    <configurations>
+      <configuration name="config">
+        <resource name="resource1">
+          <task name="task0" priority="0" interval="T#20ms">
+            <pouInstance name="instance0" typeName="program0"/>
+          </task>
+        </resource>
+      </configuration>
+    </configurations>
+  </instances>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/svghmi/svghmi_0@svghmi/baseconfnode.xml	Wed Aug 07 14:18:22 2019 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?>
+<BaseParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" IEC_Channel="0" Name="svghmi_0"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/svghmi/svghmi_0@svghmi/confnode.xml	Wed Aug 07 14:18:22 2019 +0200
@@ -0,0 +1,2 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SVGHMI xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/svghmi/svghmi_0@svghmi/gui.svg	Wed Aug 07 14:18:22 2019 +0200
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="1280"
+   height="720"
+   viewBox="0 0 1280 720"
+   version="1.1"
+   id="hmi0"
+   sodipodi:docname="default.svg"
+   inkscape:version="0.92.3 (2405546, 2018-03-11)">
+  <metadata
+     id="metadata4542">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs2" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:document-units="px"
+     inkscape:current-layer="hmi0"
+     showgrid="false"
+     units="px"
+     inkscape:zoom="0.7"
+     inkscape:cx="576.80864"
+     inkscape:cy="330.28432"
+     inkscape:window-width="1600"
+     inkscape:window-height="886"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1" />
+  <rect
+     style="color:#000000"
+     id="page0"
+     width="1280"
+     height="720"
+     x="0"
+     y="0">
+    <desc
+       id="desc_page0">This is description for page 0
+
+all lines in the form &quot;name: value&quot; 
+are used as js object definition initializer
+
+role: &quot;page&quot;
+name: &quot;Home&quot;
+
+after triple opening braces is global JavaScript code
+
+{{{
+/* JS style Comment */
+alert(&quot;Hello World&quot;);
+}}}
+
+after triple closing braces is back to description
+</desc>
+  </rect>
+  <text
+     xml:space="preserve"
+     style="font-style:normal;font-weight:normal;font-size:160px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+     x="436.32812"
+     y="418.24219"
+     id="text5151"
+     inkscape:label="count"><desc
+       id="desc5153">path: &quot;count&quot;
+format: &quot;%4.4d&quot;</desc><tspan
+       sodipodi:role="line"
+       id="tspan5149"
+       x="436.32812"
+       y="418.24219"
+       style="stroke-width:1px">8888</tspan></text>
+</svg>