diff --git a/bec_widgets/utils/bec_connector.py b/bec_widgets/utils/bec_connector.py index 0e8b642b..f167feb6 100644 --- a/bec_widgets/utils/bec_connector.py +++ b/bec_widgets/utils/bec_connector.py @@ -289,6 +289,8 @@ class BECConnector(BECWidget): print("No more connections. Shutting down GUI BEC client.") self.bec_dispatcher.disconnect_all() self.client.shutdown() + if hasattr(super(), "cleanup"): + super().cleanup() # def closeEvent(self, event): # self.cleanup() diff --git a/bec_widgets/utils/bec_widget.py b/bec_widgets/utils/bec_widget.py index e5b57a0f..462d94a1 100644 --- a/bec_widgets/utils/bec_widget.py +++ b/bec_widgets/utils/bec_widget.py @@ -4,4 +4,5 @@ class BECWidget: def closeEvent(self, event): if hasattr(self, "cleanup"): self.cleanup() - event.accept() + if hasattr(super(), "closeEvent"): + super().closeEvent(event) diff --git a/bec_widgets/widgets/figure/figure.py b/bec_widgets/widgets/figure/figure.py index 00eb8baa..3954fcb7 100644 --- a/bec_widgets/widgets/figure/figure.py +++ b/bec_widgets/widgets/figure/figure.py @@ -830,6 +830,6 @@ class BECFigure(BECConnector, pg.GraphicsLayoutWidget): widget_class=self.__class__.__name__, gui_id=self.gui_id, theme=theme ) - def cleanup(self): - self.clear_all() - super().cleanup() + # def cleanup(self): + # self.clear_all() + # super().cleanup() diff --git a/bec_widgets/widgets/vscode/vscode.py b/bec_widgets/widgets/vscode/vscode.py index a9c97052..d68cd25d 100644 --- a/bec_widgets/widgets/vscode/vscode.py +++ b/bec_widgets/widgets/vscode/vscode.py @@ -49,13 +49,6 @@ class VSCodeEditor(WebsiteWidget): break self.set_url(self._url) - def closeEvent(self, event): - """ - Hook for the close event to terminate the server. - """ - self.cleanup_vscode() - super().closeEvent(event) - def cleanup_vscode(self): """ Cleanup the VSCode editor. @@ -72,13 +65,6 @@ class VSCodeEditor(WebsiteWidget): self.cleanup_vscode() return super().cleanup() - def close(self): - """ - Close the widget. - """ - self.cleanup_vscode() - return super().close() - if __name__ == "__main__": # pragma: no cover import sys