# HG changeset patch # User Andrey Skvortsov # Date 1491391022 -10800 # Node ID 9298ba0cd70a7f7e31a7aff3d0dd8295d79f183f # Parent 0dc834721d8e01a25c228446899d778656be73fe reset loaded messages counts on new PLC program trasnfer This fixes the problem that first message from newer PLC program maybe lost, if it's issued before first PLC log fetching. Closes #23 diff -r 0dc834721d8e -r 9298ba0cd70a ProjectController.py --- a/ProjectController.py Tue Apr 04 11:34:31 2017 +0300 +++ b/ProjectController.py Wed Apr 05 14:17:02 2017 +0300 @@ -1777,6 +1777,7 @@ self.AppFrame.CloseObsoleteDebugTabs() self.AppFrame.RefreshPouInstanceVariablesPanel() self.logger.write(_("Transfer completed successfully.\n")) + self.AppFrame.LogViewer.ResetLogCounters(); else: self.logger.write_error(_("Transfer failed\n")) self.HidePLCProgress() diff -r 0dc834721d8e -r 9298ba0cd70a controls/LogViewer.py --- a/controls/LogViewer.py Tue Apr 04 11:34:31 2017 +0300 +++ b/controls/LogViewer.py Wed Apr 05 14:17:02 2017 +0300 @@ -379,7 +379,7 @@ self.ScrollTimer.Stop() def ResetLogMessages(self): - self.previous_log_count = [None]*LogLevelsCount + self.ResetLogCounters() self.OldestMessages = [] self.LogMessages = [] self.LogMessagesTimestamp = numpy.array([]) @@ -401,6 +401,9 @@ return LogMessage(tv_sec, tv_nsec, level, self.LevelIcons[level], msg) return None + def ResetLogCounters(self): + self.previous_log_count = [None]*LogLevelsCount + def SetLogCounters(self, log_count): new_messages = [] for level, count, prev in zip(xrange(LogLevelsCount), log_count, self.previous_log_count):