Exemplo n.º 1
0
 def __init__(self, thread: QThread = None, **kwargs: Any) -> None:
     super().__init__()
     if thread is None:
         thread = QThread()
     self.moveToThread(thread)
     thread.worker = self
     self._thread = thread
     self._name = kwargs.get("name", type(self).__name__)
     self._running = False
     self._thread.finished.connect(self._finished)
Exemplo n.º 2
0
    def spawn_worker_thread(self, worker, **signals):
        # Setup worker and its thread
        thread = QThread(self.parent)
        thread.setTerminationEnabled(True)
        worker.moveToThread(thread)
        thread.started.connect(worker.run)
        thread.worker = worker # TODO: needed?

        # Connect log and any extra signals
        worker.log_signal.connect(self.log_append)
        for signal_name in signals:
            getattr(worker, signal_name).connect(signals[signal_name])

        thread.start()

        self.current_worker_thread = thread
Exemplo n.º 3
0
    def __init__(self, thread: QThread = None, **kwargs: Any) -> None:
        super().__init__()
        if thread is None:
            thread = QThread()
        self.moveToThread(thread)

        thread.worker = self
        self.thread = thread

        self._name = kwargs.get("name", type(self).__name__)

        self._running = False
        self._continue = False
        self._action: Optional[Action] = None
        self.thread_id: Optional[int] = None
        self._pause = False

        self.thread.finished.connect(self._finished)
Exemplo n.º 4
0
    def __init__(self, thread: QThread = None, **kwargs: Any) -> None:
        super().__init__()
        if thread is None:
            thread = QThread()
        self.moveToThread(thread)

        thread.worker = self
        self.thread = thread

        self._name = kwargs.get("name", type(self).__name__)

        self._running = False
        self._continue = False
        self._action: Optional[Action] = None
        self.thread_id: Optional[int] = None
        self._pause = False

        self.thread.finished.connect(self._finished)