--- a/ProjectController.py Wed Aug 10 16:44:58 2022 +0200
+++ b/ProjectController.py Thu Aug 11 17:39:12 2022 +0200
@@ -1578,12 +1578,16 @@
return debug_status, ticks, buffers
RegisterDebugVariableErrorCodes = {
+ # Connector only can return None
+ None : _("Debug: connection problem.\n"),
# TRACE_LIST_OVERFLOW
1 : _("Debug: Too many variables traced. Max 1024.\n"),
# FORCE_LIST_OVERFLOW
2 : _("Debug: Too many variables forced. Max 256.\n"),
# FORCE_BUFFER_OVERFLOW
- 3 : _("Debug: Cumulated forced variables size too large. Max 1KB.\n")
+ 3 : _("Debug: Cumulated forced variables size too large. Max 1KB.\n"),
+ # DEBUG_SUSPENDED
+ 4 : _("Debug: suspended.\n")
}
def RegisterDebugVarToConnector(self):
@@ -1626,7 +1630,8 @@
self.DebugToken = None
self.logger.write_warning(
self.RegisterDebugVariableErrorCodes.get(
- -res, _("Debug: Unknown error")))
+ -res if res is not None else None,
+ _("Debug: Unknown error")))
else:
self.TracedIECPath = []
self._connector.SetTraceVariablesList([])
--- a/runtime/PLCObject.py Wed Aug 10 16:44:58 2022 +0200
+++ b/runtime/PLCObject.py Thu Aug 11 17:39:12 2022 +0200
@@ -466,7 +466,7 @@
self.PythonThreadAcknowledge(cmd)
self.PythonRuntimeCall("start")
self.LogMessage("Python extensions started")
- self.PostStartPLC()
+ self._PostStartPLC()
self.PythonThreadLoop()
self.PythonRuntimeCall("stop", reverse_order=True)
elif cmd == "Finish":
@@ -504,6 +504,13 @@
"""
pass
+ def _PostStartPLC(self):
+ try:
+ self.PostStartPLC()
+ except Exception:
+ self.LogMessage(0, 'Post Start Exception'+'\n'.join(
+ traceback.format_exception(*sys.exc_info())))
+
def PostStartPLC(self):
"""
Here goes actions to be taken after PLC is started,
@@ -730,7 +737,7 @@
return self.DebugToken
else:
self._suspendDebug(True)
- return None
+ return 4 # DEBUG_SUSPENDED
def _TracesSwap(self):
self.LastSwapTrace = time()
--- a/svghmi/hmi_tree.ysl2 Wed Aug 10 16:44:58 2022 +0200
+++ b/svghmi/hmi_tree.ysl2 Thu Aug 11 17:39:12 2022 +0200
@@ -121,6 +121,7 @@
> «$indent» «local-name()»
foreach "@*" > «local-name()»="«.»"
> \n
+ if "text()" > «text()»\n
apply "*", mode="testtree" {
with "indent" value "concat($indent,'>')"
};
--- a/svghmi/parse_labels.ysl2 Wed Aug 10 16:44:58 2022 +0200
+++ b/svghmi/parse_labels.ysl2 Thu Aug 11 17:39:12 2022 +0200
@@ -15,9 +15,29 @@
//
const "pathregex",!"'^([^\[,]+)(\[[^\]]+\])?([-.\d,]*)$'"!;
+const "newline" |
+const "twonewlines", "concat($newline,$newline)";
+
template "*", mode="parselabel"
{
- const "label","@inkscape:label";
+ const "part","@inkscape:label";
+ const "desc", "svg:desc";
+
+ // add svg:desc field if continuation "\" marker is found at the end of label
+ const "len","string-length($part)";
+ const "has_continuation", "substring($part,$len,1)='\\'";
+ const "label" choose{
+ when "$has_continuation" {
+ const "_continuation", "substring-before($desc, $twonewlines)";
+ const "continuation" choose {
+ when "$_continuation" value "$_continuation";
+ otherwise value "$desc";
+ }
+ value "concat(substring($part,1,$len - 1),translate($continuation,$newline,''))";
+ }
+ otherwise value "$part";
+ }
+
const "id","@id";
const "description", "substring-after($label,'HMI:')";
@@ -100,7 +120,15 @@
}
}
}
- if "svg:desc" desc value "svg:desc/text()";
+ choose{
+ when "$has_continuation" {
+ const "_continuation", "substring-after($desc, $twonewlines)";
+ if "$_continuation"
+ desc value "$_continuation";
+ }
+ otherwise
+ if "$desc" desc value "$desc/text()";
+ }
}
}
--- a/svghmi/widget_jump.ysl2 Wed Aug 10 16:44:58 2022 +0200
+++ b/svghmi/widget_jump.ysl2 Thu Aug 11 17:39:12 2022 +0200
@@ -84,6 +84,9 @@
dispatch(value) {
this.disabled = !Number(value);
+
+ // TODO : use RequestAnimate and animate()
+
this.update_state();
}
||
@@ -142,6 +145,7 @@
}
}
+/* TODO: move to detachable pages ysl2 */
emit "cssdefs:jump"
||
.fade-out-page {
--- a/svghmi/widget_multistate.ysl2 Wed Aug 10 16:44:58 2022 +0200
+++ b/svghmi/widget_multistate.ysl2 Thu Aug 11 17:39:12 2022 +0200
@@ -36,6 +36,7 @@
choice.elt.setAttribute("style", choice.style);
}
}
+ // TODO : use RequestAnimate and animate()
}
on_click(evt) {
--- a/targets/plc_debug.c Wed Aug 10 16:44:58 2022 +0200
+++ b/targets/plc_debug.c Thu Aug 11 17:39:12 2022 +0200
@@ -140,7 +140,7 @@
InitRetain();
/* Iterate over all variables to fill debug buffer */
if(CheckRetainBuffer()){
- static unsigned int retain_offset = 0;
+ unsigned int retain_offset = 0;
retain_list_collect_cursor = 0;
/* iterate over retain list */
@@ -322,7 +322,7 @@
LeaveDebugSection();
}
#endif
- static unsigned int retain_offset = 0;
+ unsigned int retain_offset = 0;
/* when not debugging, do only retain */
retain_list_collect_cursor = 0;
--- a/tests/projects/svghmi/plc.xml Wed Aug 10 16:44:58 2022 +0200
+++ b/tests/projects/svghmi/plc.xml Thu Aug 11 17:39:12 2022 +0200
@@ -1,7 +1,7 @@
<?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="2022-01-18T11:38:21">
+ <contentHeader name="Unnamed" modificationDateTime="2022-07-21T11:39:43">
<coordinateInfo>
<fbd>
<scaling x="5" y="5"/>
@@ -25,11 +25,20 @@
<derived name="HMI_INT"/>
</type>
</variable>
+ </localVars>
+ <localVars retain="true">
<variable name="selection">
<type>
<derived name="HMI_INT"/>
</type>
</variable>
+ <variable name="selection0">
+ <type>
+ <INT/>
+ </type>
+ </variable>
+ </localVars>
+ <localVars>
<variable name="Pump0">
<type>
<derived name="PumpControl"/>
--- a/tests/projects/svghmi_scrollbar/svghmi_0@svghmi/svghmi.svg Wed Aug 10 16:44:58 2022 +0200
+++ b/tests/projects/svghmi_scrollbar/svghmi_0@svghmi/svghmi.svg Thu Aug 11 17:39:12 2022 +0200
@@ -60,12 +60,12 @@
showgrid="false"
units="px"
inkscape:zoom="0.64"
- inkscape:cx="-438.80601"
- inkscape:cy="183.59799"
- inkscape:window-width="3200"
- inkscape:window-height="1672"
+ inkscape:cx="476.03774"
+ inkscape:cy="444.53549"
+ inkscape:window-width="1600"
+ inkscape:window-height="836"
inkscape:window-x="0"
- inkscape:window-y="54"
+ inkscape:window-y="27"
inkscape:window-maximized="1"
showguides="true"
inkscape:guide-bbox="true"
@@ -745,8 +745,14 @@
</g>
<g
id="g4507"
- inkscape:label="HMI:ScrollBar@.range@.position@.size"
+ inkscape:label="HMI:ScrollBar\"
transform="translate(-202)">
+ <desc
+ id="desc150">@.range
+@.position
+@.size
+
+my tailor is rich</desc>
<rect
y="84"
x="960"
@@ -857,6 +863,9 @@
inkscape:label="HMI:ScrollBar@.range@.position@.size"
id="g156"
style="stroke-width:2">
+ <desc
+ id="desc149">deedewesfsdf
+cedwee</desc>
<rect
inkscape:label="range"
style="opacity:1;vector-effect:none;fill:#ff35ff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"