From f7665ea736765ef0851b9a077bd5cf67ac247e97 Mon Sep 17 00:00:00 2001 From: atse Date: Thu, 22 Aug 2024 12:25:11 +0800 Subject: [PATCH] Compacting --- pytec/tec_qt.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index cc98c4d..329ffb3 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -259,19 +259,17 @@ class MainWindow(QtWidgets.QMainWindow): ) try: await self._connecting_task - except (OSError, asyncio.TimeoutError): + except (OSError, asyncio.TimeoutError, asyncio.CancelledError): await self.bail() return - except asyncio.CancelledError: - return else: await self._on_connection_changed(True) finally: self._connecting_task = None + elif self._connecting_task is not None: + self._connecting_task.cancel() else: - if self._connecting_task is not None: - self._connecting_task.cancel() await self.bail() @asyncSlot()