@@ -202,6 +202,7 @@ def _numba_probe(x):
202202 DEFAULT_TEXT_LINES , MAX_TEXT_LINES , MAX_ROWS ,
203203 DEBUGKEYINPUT , DEBUG_LEVEL , DEBUGRECEIVER , DEBUGCHART ,
204204 ENCODING , BACKGROUNDCOLOR , BACKGROUNDCOLOR_LOG , BACKGROUNDCOLOR_TABS ,
205+ BLESCAN_SHORT ,
205206 EOL_DICT , EOL_DICT_INV , EOL_DEFAULT_LABEL , EOL_DEFAULT_BYTES , DEFAULT_LINETERMINATOR ,
206207 PARSE_OPTIONS , PARSE_OPTIONS_INV , PARSE_DEFAULT_LABEL , PARSE_DEFAULT_NAME ,
207208 LOG_OPTIONS , LOG_OPTIONS_INV , LOG_DEFAULT_LABEL , LOG_DEFAULT_NAME ,
@@ -252,7 +253,7 @@ def _numba_probe(x):
252253 QTextEdit , QTabWidget , QWidget ,
253254 QPlainTextEdit , QApplication ,
254255 )
255- from PyQt6 .QtGui import QIcon , QShortcut , QTextCursor , QTextOption , QKeySequence , QGuiApplication , QPixmap
256+ from PyQt6 .QtGui import QIcon , QShortcut , QTextCursor , QTextOption , QKeySequence , QGuiApplication , QPixmap , QFontDatabase
256257 WindowType = Qt .WindowType
257258 ConnectionType = Qt .ConnectionType
258259 NO_WRAP = QPlainTextEdit .LineWrapMode .NoWrap
@@ -274,7 +275,7 @@ def _numba_probe(x):
274275 QPlainTextEdit , QApplication ,
275276 )
276277 from PyQt5 .QtGui import (
277- QIcon , QTextCursor , QTextOption , QKeySequence , QGuiApplication , QPixmap
278+ QIcon , QTextCursor , QTextOption , QKeySequence , QGuiApplication , QPixmap , QFontDatabase
278279 )
279280 WindowType = Qt
280281 ConnectionType = Qt
@@ -414,6 +415,7 @@ def __init__(self, parent=None, logger=None):
414415
415416 self .isMonitoring = False
416417 self .isPlotting = False # chart receiver status request
418+ self .startup_work_scheduled = False
417419 self .lineSendHistory = [] # previously sent text (e.g. commands)
418420 self .lineSendHistoryIndx = - 1
419421 self .textLineTerminator = DEFAULT_LINETERMINATOR
@@ -430,6 +432,11 @@ def __init__(self, parent=None, logger=None):
430432
431433 self .log_widget = self .ui .plainTextEdit_Log
432434 self .log_widget .setStyleSheet (f"background-color: { BACKGROUNDCOLOR_LOG } ;" )
435+ if hasQt6 :
436+ log_font = QFontDatabase .systemFont (QFontDatabase .SystemFont .FixedFont )
437+ else :
438+ log_font = QFontDatabase .systemFont (QFontDatabase .FixedFont )
439+ self .log_widget .setFont (log_font )
433440
434441 # Modify LOG display window on serial text display
435442 self .log_widget .setVerticalScrollBarPolicy (Qt .ScrollBarPolicy .ScrollBarAlwaysOn )
@@ -1096,8 +1103,16 @@ def on_tab_change(self, index: int) -> None:
10961103 self .text_scroll_bar .setValue (self .text_scroll_bar .maximum ())
10971104 self .log_scroll_bar .setValue (self .log_scroll_bar .maximum ())
10981105
1106+ elif tab_name == "Log" :
1107+ self .log_scroll_bar .setValue (self .log_scroll_bar .maximum ())
1108+
10991109 elif tab_name == "Plotter" :
1100- pass
1110+ if USE_FASTPLOTLIB :
1111+ if not self .chart .chartFPLInitialized :
1112+ QTimer .singleShot (0 , self .chart .fpl_figure_init )
1113+ else :
1114+ if not self .chart .chartPGInitialized :
1115+ QTimer .singleShot (0 , self .chart .pg_figure_init )
11011116
11021117 elif tab_name == "Indicator" :
11031118 pass
@@ -1131,6 +1146,14 @@ def on_pushButton_toBLE(self) -> None:
11311146 return
11321147
11331148 self .ui .stackedWidget_BLE_Serial .setCurrentIndex (1 )
1149+ if not self .ble .device_scan_requested :
1150+ self .ble .device_scan_requested = True
1151+ self .ble .scanDevicesRequest .emit (float (BLESCAN_SHORT ))
1152+ self .ble .ui .pushButton_BLEScan .setEnabled (False )
1153+ self .ble .ui .pushButton_BLEConnect .setEnabled (False )
1154+ self .handle_log (logging .INFO ,
1155+ f"[{ self .instance_name [:15 ]:<15} ]: BLE device auto-scan requested ({ BLESCAN_SHORT :.1f} s)."
1156+ )
11341157 self .handle_log (logging .INFO ,
11351158 f"[{ self .instance_name [:15 ]:<15} ]: BLE."
11361159 )
@@ -1140,13 +1163,13 @@ def on_pushButton_toBLE(self) -> None:
11401163 def showEvent (self , event ):
11411164 """Qt calls this when the User Interface window is shown."""
11421165 super ().showEvent (event )
1143- if USE_FASTPLOTLIB :
1144- QTimer . singleShot ( 200 , self . chart . fpl_figure_init )
1145- else :
1146- QTimer . singleShot ( 200 , self .chart . pg_figure_init )
1147-
1148- # Start the Monitoring by default
1149- QTimer .singleShot (0 , lambda : self .runMonitoringRequest .emit (True ))
1166+ if self . startup_work_scheduled :
1167+ return
1168+
1169+ self .startup_work_scheduled = True
1170+
1171+ # Give the UI time to paint and accept input before auto-start work begins.
1172+ QTimer .singleShot (750 , lambda : self .runMonitoringRequest .emit (True ))
11501173
11511174 @pyqtSlot ()
11521175 def closeEvent (self , event ):
0 commit comments