Fixed Beremiz_service not closing on Windows
authorLaurent Bessard
Fri, 10 May 2013 15:17:33 +0200
changeset 1121 d3838e8f1b90
parent 1120 35d772ec1a76
child 1122 84de51ab40d2
Fixed Beremiz_service not closing on Windows
Beremiz_service.py
runtime/PLCObject.py
--- a/Beremiz_service.py	Fri May 10 13:15:18 2013 +0200
+++ b/Beremiz_service.py	Fri May 10 15:17:33 2013 +0200
@@ -306,8 +306,10 @@
                 InspectionTool().Show(wnd, True)
             
             def OnTaskBarQuit(self, evt):
+                if wx.Platform == '__WXMSW__':
+                    Thread(target=self.pyroserver.Quit).start()
                 self.RemoveIcon()
-                wx.CallAfter(wx.GetApp().Exit)
+                wx.CallAfter(wx.GetApp().ExitMainLoop)
             
             def UpdateIcon(self, plcstatus):
                 if plcstatus is "Started" :
@@ -381,7 +383,6 @@
             self.servicepublisher.RegisterService(self.servicename, self.ip_addr, self.port)
         
         if self.autostart and self.plcobj.GetPLCstatus()[0] != "Empty":
-            self.plcobj.LoadPLC()
             self.plcobj.StartPLC()
         
         sys.stdout.flush()
--- a/runtime/PLCObject.py	Fri May 10 13:15:18 2013 +0200
+++ b/runtime/PLCObject.py	Fri May 10 15:17:33 2013 +0200
@@ -74,6 +74,7 @@
             self.CurrentPLCFilename=open(
                              self._GetMD5FileName(),
                              "r").read().strip() + lib_ext
+            self.LoadPLC()
         except Exception, e:
             self.PLCStatus = "Empty"
             self.CurrentPLCFilename=None