astrodatagui: ask before closing in all occasions

This commit is contained in:
2024-03-04 13:01:25 +01:00
parent 05367dc1de
commit db4f579ac0
+9 -1
View File
@@ -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()
self.close()