From a0876223712e1f9d94aea8cbe203de29fdc97803 Mon Sep 17 00:00:00 2001 From: atse Date: Fri, 23 Aug 2024 15:42:42 +0800 Subject: [PATCH] task -> _connecting_task --- pytec/pytec/gui/model/thermostat.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 96abbeb..7689a2f 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -34,23 +34,23 @@ class Thermostat(QObject, metaclass=PropertyMeta): self._watch_task = None self._report_mode_task = None self._poll_for_report = True - self.task = None + self._update_params_task = None super().__init__(parent) async def run(self): - self.task = asyncio.create_task(self.update_params()) + self._update_params_task = asyncio.create_task(self.update_params()) while True: - if self.task.done(): + if self._update_params_task.done(): if self.task.exception() is not None: try: - raise self.task.exception() + raise self._update_params_task.exception() except asyncio.TimeoutError: logging.error( "Encountered an error while polling for information from Thermostat.", exc_info=True, ) _ = self.task.result() - self.task = asyncio.create_task(self.update_params()) + self._update_params_task = asyncio.create_task(self.update_params()) await asyncio.sleep(self._update_s) async def get_hw_rev(self): @@ -84,8 +84,8 @@ class Thermostat(QObject, metaclass=PropertyMeta): await self.set_report_mode(False) self._watch_task.cancel() self._watch_task = None - self.task.cancel() - self.task = None + self._update_params_task.cancel() + self._update_params_task = None async def set_report_mode(self, enabled: bool): self._poll_for_report = not enabled