From ce0f489de561a434b46c6a00bb71122fa07c1a3c Mon Sep 17 00:00:00 2001 From: Dmitri Gavrilov Date: Thu, 14 Mar 2024 19:23:27 -0400 Subject: [PATCH] ENH: changes to prevent flicker in 'QtReConsoleMonitor' --- bluesky_widgets/qt/run_engine_client.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bluesky_widgets/qt/run_engine_client.py b/bluesky_widgets/qt/run_engine_client.py index 0200d6c..4097943 100644 --- a/bluesky_widgets/qt/run_engine_client.py +++ b/bluesky_widgets/qt/run_engine_client.py @@ -2777,9 +2777,11 @@ def __init__(self, model, parent=None): self._start_thread() self._start_timer() + self._updating_text = False + def _start_timer(self): # Timer is used to initiate periodic updates of the QTextEdit widget - QTimer.singleShot(200, self._update_console_output) + QTimer.singleShot(195, self._update_console_output) def _finished_receiving_console_output(self): self._start_thread() @@ -2842,10 +2844,14 @@ def _process_new_console_output(self, result): def _update_console_output(self): if self._text_updated: - self._text_updated = False - self._adjust_text_list_size() - self._display_text() - + if not self._updating_text: + try: + self._updating_text = True + self._text_updated = False + self._adjust_text_list_size() + self._display_text() + finally: + self._updating_text = False self._start_timer() def _display_text(self):