Skip to content

Commit

Permalink
ENH: changes to prevent flicker in 'QtReConsoleMonitor'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmgav committed Mar 14, 2024
1 parent a363bca commit ce0f489
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions bluesky_widgets/qt/run_engine_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit ce0f489

Please sign in to comment.