Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix closing of ToFE histogram and target widgets on MacOS #334

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions widgets/measurement/tofe_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,14 @@ def __set_shortcuts(self):
self.__paste_selection = QtWidgets.QShortcut(QKeySequence(QtCore.Qt.CTRL+QtCore.Qt.Key_V), self)
self.__paste_selection.activated.connect(self.matplotlib.paste_selection)

def closeEvent(self, close_event):
"""Event which happens when the windows is closing.
Instead of closing, minimize the window. Fixes close buttons on macOS,
which for the time being cannot be disabled.

Args:
close_event: Close event
"""
close_event.ignore()
self.showMinimized()

11 changes: 11 additions & 0 deletions widgets/simulation/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,14 @@ def set_shortcuts(self):
self.del_points.setKey(QtCore.Qt.Key_Delete)
self.del_points.activated.connect(
lambda: self.recoil_distribution_widget.remove_points())

def closeEvent(self, close_event):
"""Event which happens when the windows is closing.
Instead of closing, minimize the window. Fixes close buttons on macOS,
which for the time being cannot be disabled.

Args:
close_event: Close event
"""
close_event.ignore()
self.showMinimized()