equal
deleted
inserted
replaced
1538 |
1538 |
1539 ############# Real PLC object access ############# |
1539 ############# Real PLC object access ############# |
1540 def UpdateMethodsFromPLCStatus(self): |
1540 def UpdateMethodsFromPLCStatus(self): |
1541 # Get PLC state : Running or Stopped |
1541 # Get PLC state : Running or Stopped |
1542 # TODO : use explicit status instead of boolean |
1542 # TODO : use explicit status instead of boolean |
|
1543 status = None |
1543 if self._connector is not None: |
1544 if self._connector is not None: |
1544 status = self._connector.GetPLCstatus() |
1545 status = self._connector.GetPLCstatus() |
1545 else: |
1546 if status is None: |
1546 status = "Disconnected" |
1547 status = "Disconnected" |
1547 if(self.previous_plcstate != status): |
1548 if(self.previous_plcstate != status): |
1548 for args in { |
1549 for args in { |
1549 "Started" : [("_Run", False), |
1550 "Started" : [("_Run", False), |
1550 ("_Stop", True)], |
1551 ("_Stop", True)], |
1566 |
1567 |
1567 def PullPLCStatusProc(self, event): |
1568 def PullPLCStatusProc(self, event): |
1568 if self._connector is None: |
1569 if self._connector is None: |
1569 self.StatusTimer.Stop() |
1570 self.StatusTimer.Stop() |
1570 if self.UpdateMethodsFromPLCStatus(): |
1571 if self.UpdateMethodsFromPLCStatus(): |
|
1572 |
1571 status = _(self.previous_plcstate) |
1573 status = _(self.previous_plcstate) |
1572 {"Broken": self.logger.write_error, |
1574 {"Broken": self.logger.write_error, |
1573 None: lambda x: None}.get( |
1575 None: lambda x: None}.get( |
1574 self.previous_plcstate, self.logger.write)(_("PLC is %s\n")%status) |
1576 self.previous_plcstate, self.logger.write)(_("PLC is %s\n")%status) |
1575 self.AppFrame.RefreshAll() |
1577 self.AppFrame.RefreshAll() |