IDE/windows: Avoid exception on quit caused by runtime being killed without disconnecting. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Fri, 10 Sep 2021 14:44:20 +0200
branchwxPython4
changeset 3312 2c0511479b18
parent 3311 d73af2eeea05
child 3313 21d37b199ede
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
@@ -292,14 +292,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>
@@ -331,7 +336,7 @@
         </xsd:complexType>
       </xsd:element>
     </xsd:schema>
-    """
+    """%browser_launch_cmd
 
     EditorType = SVGHMIEditor