IDE/windows: Avoid exception on quit caused by runtime being killed without disconnecting.
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Fri, 10 Sep 2021 14:44:20 +0200
changeset 3348 cfac764413dd
parent 3347 f31f062703a2
child 3349 e7bd3ee40a64
IDE/windows: Avoid exception on quit caused by runtime being killed without disconnecting.
BeremizIDE.py
svghmi/svghmi.py
--- a/BeremizIDE.py	Fri Sep 10 14:42:46 2021 +0200
+++ b/BeremizIDE.py	Fri Sep 10 14:44:20 2021 +0200
@@ -625,6 +625,7 @@
         if self.CTR is None or self.CheckSaveBeforeClosing(_("Close Application")):
             if self.CTR is not None:
                 self.CTR.KillDebugThread()
+                self.CTR._Disconnect()
             self.KillLocalRuntime()
 
             self.SaveLastState()
--- a/svghmi/svghmi.py	Fri Sep 10 14:42:46 2021 +0200
+++ b/svghmi/svghmi.py	Fri Sep 10 14:44:20 2021 +0200
@@ -294,14 +294,19 @@
 
         return ret
 
+if wx.Platform == '__WXMSW__':
+    browser_launch_cmd="cmd.exe /c 'start msedge {url}'"
+else:
+    browser_launch_cmd="chromium {url}"
+
 class SVGHMI(object):
     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="chromium {url}"/>
-          <xsd:attribute name="OnStop" type="xsd:string" use="optional" default="echo 'please close chromium window at {url}'"/>
-          <xsd:attribute name="OnWatchdog" type="xsd:string" use="optional" default="echo 'Watchdog for {name} !'"/>
+          <xsd:attribute name="OnStart" type="xsd:string" use="optional" default="%s"/>
+          <xsd:attribute name="OnStop" type="xsd:string" use="optional" default=""/>
+          <xsd:attribute name="OnWatchdog" type="xsd:string" use="optional" default=""/>
           <xsd:attribute name="EnableWatchdog" type="xsd:boolean" use="optional" default="false"/>
           <xsd:attribute name="WatchdogInitial" use="optional" default="30">
             <xsd:simpleType>
@@ -333,7 +338,7 @@
         </xsd:complexType>
       </xsd:element>
     </xsd:schema>
-    """
+    """%browser_launch_cmd
 
     EditorType = SVGHMIEditor