From 84018c3ebcde73a378cb0d34916e580c21aa51bb Mon Sep 17 00:00:00 2001 From: atse Date: Fri, 7 Jul 2023 16:09:03 +0800 Subject: [PATCH] Start running only when task is running --- pytec/tec_qt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 07aa5ac..b417319 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -36,7 +36,7 @@ class ClientWatcher(QObject): def __init__(self, parent, client, update_s): self.update_s = update_s - self.running = True + self.running = False self.client = client self.watch_task = None super().__init__(parent) @@ -52,6 +52,7 @@ class ClientWatcher(QObject): self.fan_update.emit(await self.client.fan()) def start_watching(self): + self.running = True self.watch_task = asyncio.create_task(self.run()) @pyqtSlot()