From beb337201c4e463975ea40760e83f7ea12e60756 Mon Sep 17 00:00:00 2001 From: David Perl Date: Wed, 21 Jan 2026 09:28:25 +0100 Subject: [PATCH] feat: attach config cancellation to closeEvent --- .../device_manager_display_widget.py | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/bec_widgets/applications/views/device_manager_view/device_manager_display_widget.py b/bec_widgets/applications/views/device_manager_view/device_manager_display_widget.py index 640f6b20..92d036e2 100644 --- a/bec_widgets/applications/views/device_manager_view/device_manager_display_widget.py +++ b/bec_widgets/applications/views/device_manager_view/device_manager_display_widget.py @@ -226,9 +226,9 @@ class DeviceManagerDisplayWidget(DockAreaWidget): # Build dock layout using shared helpers self._build_docks() - # TODO Implement once issue #1012 is solved - # logger.info("Connecting application about to quit signal to device manager view...") - # QApplication.instance().aboutToQuit.connect(self._about_to_quit_handler) + def closeEvent(self, event): + self._about_to_quit_handler() + return super().closeEvent(event) ############################## ### Custom set busy widget ### @@ -244,17 +244,15 @@ class DeviceManagerDisplayWidget(DockAreaWidget): ### Application quit handler ### ################################ - # TODO Implement once issue #1012 is solved - # @SafeSlot() - # def _about_to_quit_handler(self): - # """Handle application about to quit event. If config upload is active, cancel it.""" - # logger.info("Application is quitting, checking for active config upload...") - # if self._config_upload_active: - # logger.info("Application is quitting, cancelling active config upload...") - # self._config_helper.send_config_request( - # action="cancel", config=None, wait_for_response=True, timeout_s=10 - # ) - # logger.info("Config upload cancelled.") + def _about_to_quit_handler(self): + """Handle application about to quit event. If config upload is active, cancel it.""" + logger.info("Application is quitting, checking for active config upload...") + if self._config_upload_active: + logger.info("Application is quitting, cancelling active config upload...") + self._config_helper.send_config_request( + action="cancel", config=None, wait_for_response=True, timeout_s=10 + ) + logger.info("Config upload cancelled.") def _set_busy_wrapper(self, enabled: bool): """Thin wrapper around set_busy to flip the state variable."""