Skip to content

Commit 900b1a4

Browse files
committed
Fix info lines in status display being drawn continuously
1 parent b279c36 commit 900b1a4

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

V-Link.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ def clear_screen():
315315

316316
_display_initialized = False
317317
_app_started = False
318+
_prev_display_snapshot = None
318319

319320
LOG_CAPACITY = 20
320321

@@ -367,8 +368,26 @@ def display_starting():
367368
sys.stdout.flush()
368369

369370

371+
def _get_display_snapshot():
372+
thread_states = tuple(
373+
(key, isinstance(thread, threading.Thread) and thread.is_alive())
374+
for key, thread in shared_state.THREADS.items()
375+
)
376+
return (
377+
thread_states,
378+
shared_state.rtiStatus,
379+
shared_state.ignStatus.is_set(),
380+
tuple(_log_handler.buffer),
381+
)
382+
383+
370384
def display_thread_states():
371-
global _display_initialized
385+
global _display_initialized, _prev_display_snapshot
386+
387+
snapshot = _get_display_snapshot()
388+
if _display_initialized and snapshot == _prev_display_snapshot:
389+
return
390+
_prev_display_snapshot = snapshot
372391

373392
lines = [
374393
'',

0 commit comments

Comments
 (0)