Close without crashing
This commit is contained in:
parent
dec5ccd7a8
commit
02f912928f
1 changed files with 4 additions and 4 deletions
|
@ -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__":
|
||||||
|
|
Reference in a new issue