forked from masonhuang/cluster4npu
Three related fixes to the QObject::connect / QTextCursor warning that appeared when stopping inference: 1. StdoutCapture: replace signal emission with queue.Queue.put_nowait() so non-Qt SDK threads (Kneron shutdown) never touch Qt signal machinery. DeploymentWorker.stdout_captured signal removed; worker now accepts a stdout_queue and passes it to StdoutCapture. 2. start_deployment: create QTimer (100 ms) on main thread to drain the stdout queue via _drain_stdout_queue(). Connect worker.finished to _on_worker_finished to stop the timer and flush remaining output. 3. stop_deployment / wait_for_stop: the background thread was calling QTextEdit.append() and other widget methods directly, which internally creates QTextCursor queued connections — the real trigger of the warning. Fixed by having wait_for_stop emit _stop_done signal only; all UI updates moved to _on_stop_done slot (main thread). Also adds QTextCursor import in main.py to pre-register the type with Qt's meta-type system as a belt-and-suspenders measure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>