diff --git a/astrodatagui/AstrodataGUI.py b/astrodatagui/AstrodataGUI.py index 6d9fac0..a2d5655 100644 --- a/astrodatagui/AstrodataGUI.py +++ b/astrodatagui/AstrodataGUI.py @@ -30,8 +30,16 @@ class AstrodataGUI(QtWidgets.QMainWindow): print(title) print(msg) + def closeEvent(self, event): + confirmation = QtWidgets.QMessageBox.question(self, "Confirmation", "Are you sure you want to close the application?", + QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) + if confirmation == QtWidgets.QMessageBox.Yes: + event.accept() # Close the app + else: + event.ignore() # Don't close the app + def actionExitTriggered(self): for starDB in StarDB.getAllInstances(): starDB.close() - exit() \ No newline at end of file + self.close() \ No newline at end of file