runtime: make standard output more silent.
--- a/Beremiz_service.py Wed Dec 11 09:30:07 2024 +0100
+++ b/Beremiz_service.py Thu Dec 12 11:33:08 2024 +0100
@@ -226,6 +226,7 @@
import wx.adv
app = wx.App(redirect=False)
+ app.GTKSuppressDiagnostics()
app.SetTopWindow(wx.Frame(None, -1))
default_locale = None
--- a/svghmi/svghmi.py Wed Dec 11 09:30:07 2024 +0100
+++ b/svghmi/svghmi.py Thu Dec 12 11:33:08 2024 +0100
@@ -326,6 +326,7 @@
<xsd:attribute name="OnStart" type="xsd:string" use="optional" default="%(launch)s"/>
<xsd:attribute name="OnStop" type="xsd:string" use="optional" default=""/>
<xsd:attribute name="OnWatchdog" type="xsd:string" use="optional" default="%(watchdog)s"/>
+ <xsd:attribute name="SuppressBrowserOutput" type="xsd:boolean" use="optional" default="true"/>
<xsd:attribute name="EnableWatchdog" type="xsd:boolean" use="optional" default="false"/>
<xsd:attribute name="WatchdogInitial" use="optional" default="30">
<xsd:simpleType>
@@ -641,13 +642,13 @@
res += ((target_fname, open(target_path, "rb")),)
svghmi_cmds = {}
+ suppress_output = not(self.GetParamsAttributes("SVGHMI.SuppressBrowserOutput")["value"])
+ stdstream = "subprocess.DEVNULL" if suppress_output else "None"
for thing in ["Start", "Stop", "Watchdog"]:
given_command = self.GetParamsAttributes("SVGHMI.On"+thing)["value"]
args = shlex.split(given_command.format(**svghmi_options))
- svghmi_cmds[thing] = (
- "Popen(" +
- repr(args) +
- ")") if args else "None # no command given"
+ svghmi_cmds[thing] = f"Popen({repr(args)}, stdout={stdstream},stderr={stdstream})" \
+ if args else "None # no command given"
runtimefile_path = os.path.join(buildpath, "runtime_%s_svghmi_.py" % location_str)
runtimefile = open(runtimefile_path, 'w')
@@ -657,6 +658,8 @@
# generated by beremiz/svghmi/svghmi.py
+import subprocess
+
browser_proc = None
def svghmi_{location}_watchdog_trigger():