Skip to content

Commit 769b0b4

Browse files
tried fixing issue with live plotter
1 parent 052e9bc commit 769b0b4

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Utilities/PlotterUtil_GUI_v3.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,26 @@ def append_file_data(self):
845845
finally:
846846
# Always restart the watcher after an append operation.
847847
self.start_file_watcher()
848+
def _read_new_lines(self, filepath, file_info):
849+
"""Reads new lines from a file since the last known size."""
850+
try:
851+
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
852+
f.seek(file_info.get('size', 0))
853+
new_text = f.read()
854+
855+
if not new_text:
856+
return []
857+
858+
# Process lines, stripping whitespace and filtering comments/empty lines
859+
new_lines = [
860+
line for line in new_text.strip().splitlines()
861+
if line.strip() and not line.strip().startswith('#')
862+
]
863+
return new_lines
864+
except Exception as e:
865+
self.log(f"Error reading new lines from file: {e}")
866+
return []
867+
848868
def _parse_and_append_new_data(self, new_lines, file_info):
849869
"""Parses new lines and appends them to the data cache."""
850870
if not new_lines:

0 commit comments

Comments
 (0)