diff --git a/docs/source/upcoming_release_notes/89-tab_widget_cleanup.rst b/docs/source/upcoming_release_notes/89-tab_widget_cleanup.rst new file mode 100644 index 0000000..611fb45 --- /dev/null +++ b/docs/source/upcoming_release_notes/89-tab_widget_cleanup.rst @@ -0,0 +1,22 @@ +89 tab widget cleanup +################# + +API Breaks +---------- +- N/A + +Features +-------- +- N/A + +Bugfixes +-------- +- Main window closes tab widget tabs when closed, so they can do their clean up + +Maintenance +----------- +- N/A + +Contributors +------------ +- shilorigins diff --git a/superscore/widgets/window.py b/superscore/widgets/window.py index 98d13f3..62e431a 100644 --- a/superscore/widgets/window.py +++ b/superscore/widgets/window.py @@ -9,6 +9,7 @@ import qtawesome as qta from pcdsutils.qt.callbacks import WeakPartialMethodSlot from qtpy import QtCore, QtWidgets +from qtpy.QtGui import QCloseEvent from superscore.client import Client from superscore.model import Entry @@ -137,3 +138,8 @@ def open(*_, **__): open_action.triggered.connect(open) self.menu.exec_(self.tree_view.mapToGlobal(pos)) + + def closeEvent(self, a0: QCloseEvent) -> None: + while self.tab_widget.count() > 0: + self.remove_tab(0) + super().closeEvent(a0)