Fixed pulling of PLC status and log count
authorLaurent Bessard
Thu, 21 Mar 2013 17:33:50 +0100
changeset 992 72ee7f3e3cf3
parent 991 afc4963d8f0c
child 993 7fbde4a19ec3
Fixed pulling of PLC status and log count
ProjectController.py
--- a/ProjectController.py	Thu Mar 21 09:27:55 2013 +0900
+++ b/ProjectController.py	Thu Mar 21 17:33:50 2013 +0100
@@ -1117,8 +1117,6 @@
                 self.AppFrame.RefreshStatusToolBar()
     
     def PullPLCStatusProc(self, event):
-        if self._connector is None:
-            self.StatusTimer.Stop()
         self.UpdateMethodsFromPLCStatus()
         
     def RegisterDebugVarToConnector(self):
@@ -1353,7 +1351,13 @@
         self._connector = connector
         if self.AppFrame is not None:
             self.AppFrame.LogViewer.SetLogSource(connector)
-            
+        if connector is not None:
+            # Start the status Timer
+            self.StatusTimer.Start(milliseconds=500, oneShot=False)
+        else:
+            # Stop the status Timer
+            self.StatusTimer.Stop()
+
     def _Connect(self):
         # don't accept re-connetion if already connected
         if self._connector is not None:
@@ -1423,9 +1427,6 @@
 
             #self.logger.write(_("PLC is %s\n")%status)
             
-            # Start the status Timer
-            self.StatusTimer.Start(milliseconds=500, oneShot=False)
-            
             if self.previous_plcstate in ["Started","Stopped"]:
                 if self.DebugAvailable() and self.GetIECProgramsAndVariables():
                     self.logger.write(_("Debugger ready\n"))
@@ -1459,7 +1460,6 @@
 
     def _Disconnect(self):
         self._SetConnector(None)
-        self.StatusTimer.Stop()
         wx.CallAfter(self.UpdateMethodsFromPLCStatus)
         
     def _Transfer(self):