Close without crashing

This commit is contained in:
Marcel Kapfer 2020-09-10 23:58:09 +02:00
parent dec5ccd7a8
commit 02f912928f
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09

View file

@ -86,8 +86,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.setupUi(self) self.setupUi(self)
# Connect close actions # Connect close actions
self.b_cancel.clicked.connect(self.close) self.b_cancel.clicked.connect(self.ask_close)
self.ma_close.triggered.connect(self.close) self.ma_close.triggered.connect(self.ask_close)
# Connect other menu actions # Connect other menu actions
self.ma_information.triggered.connect(self.about) self.ma_information.triggered.connect(self.about)
@ -382,7 +382,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
dialog = AboutDialog() dialog = AboutDialog()
dialog.exec_() dialog.exec_()
def close(self): def ask_close(self):
""" """
Close the application. A warning is shown before. Close the application. A warning is shown before.
""" """
@ -390,7 +390,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
"Möchten Sie wirklich schließen?", "Möchten Sie wirklich schließen?",
QMessageBox.Yes | QMessageBox.No, QMessageBox.No) QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if reply == QMessageBox.Yes: if reply == QMessageBox.Yes:
super.close() self.close()
if __name__ == "__main__": if __name__ == "__main__":