(func: Callable, capture_outputs: bool = False)
| 47 | |
| 48 | |
| 49 | def move_to_separate_thread(func: Callable, capture_outputs: bool = False): |
| 50 | thread = QtCore.QThread() |
| 51 | if capture_outputs: |
| 52 | worker = CaptureWorker(func) |
| 53 | else: |
| 54 | worker = Worker(func) |
| 55 | |
| 56 | worker.finished.connect(worker.deleteLater) |
| 57 | worker.moveToThread(thread) |
| 58 | thread.started.connect(worker.run) |
| 59 | |
| 60 | def stop_thread(): |
| 61 | thread.quit() |
| 62 | thread.wait() |
| 63 | |
| 64 | worker.finished.connect(stop_thread) |
| 65 | return worker, thread |
| 66 | |
| 67 | |
| 68 | def parse_version(version: str) -> tuple[int, int, int]: |
no test coverage detected