Skip to content

Commit

Permalink
Merge pull request #89 from shilorigins/devagr/main-window-close-chil…
Browse files Browse the repository at this point in the history
…dren

BUG: close tabs in tab widget when main window is closed
  • Loading branch information
shilorigins authored Sep 27, 2024
2 parents cdda3a5 + a6d74d1 commit df16e55
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/source/upcoming_release_notes/89-tab_widget_cleanup.rst
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions superscore/widgets/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit df16e55

Please sign in to comment.