feat(ui): implement save directory browse button and pre-detection check
- Add a 'Browse...' button to the Connection Status panel in StatusTab.qml. - Check if save directory is set before wafer detection in HomePage.qml, prompting the user if empty. - Resolve QML Connections warning by renaming onLogMessageEmitted to onLogMessage. - Remove temporary debug stack traces from device_controller.py.
This commit is contained in:
@@ -90,6 +90,10 @@ class DeviceController(QObject):
|
||||
self._detectFinished.connect(self._handle_detect_finished, Qt.ConnectionType.QueuedConnection)
|
||||
self._readFinished.connect(self._handle_read_finished, Qt.ConnectionType.QueuedConnection)
|
||||
|
||||
root_logger = logging.getLogger()
|
||||
root_logger.addHandler(QmlActivityLogHandler(self))
|
||||
root_logger.setLevel(logging.INFO)
|
||||
|
||||
# ---- Properties ----
|
||||
@Property(list, notify=portsUpdated)
|
||||
def availablePorts(self) -> list[str]:
|
||||
@@ -538,3 +542,14 @@ class DeviceController(QObject):
|
||||
"runtime": info.runtime,
|
||||
"cycleCount": info.cycle_count,
|
||||
}
|
||||
|
||||
class QmlActivityLogHandler(logging.Handler):
|
||||
def __init__(self, controller: DeviceController) -> None:
|
||||
super().__init__()
|
||||
self._controller = controller
|
||||
def emit(self, record: logging.LogRecord) -> None:
|
||||
timestamp = datetime.now().strftime("%H:%M:%S")
|
||||
level = record.levelname
|
||||
message = record.getMessage()
|
||||
msg = f"[{timestamp}] {level}: {message}"
|
||||
self._controller._append_log(msg)
|
||||
|
||||
Reference in New Issue
Block a user