Skip to content

Commit

Permalink
Merge pull request #334 from JYU-IBA/macOS_fixes_5122023
Browse files Browse the repository at this point in the history
Fix closing of ToFE histogram and target widgets on MacOS
  • Loading branch information
samivout committed Dec 18, 2023
2 parents 7189e16 + edda6c4 commit eb8d452
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
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()

0 comments on commit eb8d452

Please sign in to comment.