lpcmanager

Parents 896d7199fe45
Children e2cf1657db32
Overrides Beremiz' SVGHMI extension's XSD to set default values so that COG browser is managed by SVGHMI.
--- a/LPCExtension.py Mon Nov 18 15:44:56 2019 +0100
+++ b/LPCExtension.py Wed Jan 15 14:37:10 2020 +0100
@@ -26,12 +26,10 @@
if product in WX_GOT_modules:
features.libraries += [('GOT', SimplePOULibraryFactory(_poulibpath("GOT")), True)]
if product in SVG_GOT_modules:
- features.libraries += [('SVGHMI', 'svghmi.SVGHMILibrary', True)]
+ features.libraries += [('SVGHMI', 'LPCSVGHMI.SVGHMILibrary', True)]
else: # MC8 ?
features.libraries += [('LPC', SimplePOULibraryFactory(_poulibpath("LPC")), True)]
-if product in SVG_GOT_modules:
- wanted_features_names.extend(["svghmi"])
if product in WX_GOT_modules:
wanted_features_names.extend(["wxglade_hmi"])
@@ -50,6 +48,8 @@
('LPCBus', _('LPC bus'), _('Support for Smarteh modules'), 'LPCBus.LPCBus'),
('CanOpen', _('CANOpen'), _('Support for CANopen'), 'LPCCanFestival.LPCCanOpen')]
+if product in SVG_GOT_modules:
+ features.catalog += [ catalog_index['svghmi'][:3]+('LPCSVGHMI.SVGHMI',) ]
#
# --------- Connectors Extension ------------
#
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LPCSVGHMI.py Wed Jan 15 14:37:10 2020 +0100
@@ -0,0 +1,15 @@
+
+from svghmi.svghmi import SVGHMI, SVGHMILibrary
+
+# set default values so that COG browser is managed by SVGHMI
+SVGHMI.XSD = """<?xml version="1.0" encoding="utf-8" ?>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="SVGHMI">
+ <xsd:complexType>
+ <xsd:attribute name="OnStart" type="xsd:string" use="optional" default="cog --platform=fdo http://127.0.0.1:{port}/{name}"/>
+ <xsd:attribute name="OnStop" type="xsd:string" use="optional" default="killall cog"/>
+ <xsd:attribute name="OnWatchdog" type="xsd:string" use="optional" default="sh -c 'killall cog; sleep 1; cog --platform=fdo http://127.0.0.1:{port}/{name}'"/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ """