From 371ff3fa9fc7b107f94563fb1be6d4bcd666f592 Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Wed, 9 Sep 2020 23:44:27 +0200 Subject: [PATCH] Handle clear fields menu entry --- wikicookbook.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wikicookbook.py b/wikicookbook.py index 44f5590..5a9f440 100644 --- a/wikicookbook.py +++ b/wikicookbook.py @@ -63,8 +63,9 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.b_cancel.clicked.connect(self.close) self.ma_close.triggered.connect(self.close) - # Connect about action + # Connect other menu actions self.ma_information.triggered.connect(self.about) + self.ma_clear_fields.triggered.connect(self.clear_fields) # Conncect recipe name typing self.e_recipe_name.textChanged.connect(self.updateTitle) @@ -320,6 +321,13 @@ class MainWindow(QMainWindow, Ui_MainWindow): # Tab: Ratings self.e_rating.setText("") self.v_ratings.clear() + + def clear_fields(self): + """ + Show the clear fields dialog. + """ + dialog = ClearDialog() + dialog.accepted.connect(self.clear) dialog.exec_() def about(self): @@ -339,6 +347,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): if reply == QMessageBox.Yes: super.close() + if __name__ == "__main__": app = QApplication([]) app.setApplicationName("WikiCookBook")