Handle clear fields menu entry

This commit is contained in:
Marcel Kapfer 2020-09-09 23:44:27 +02:00
parent ba3a575ba2
commit 371ff3fa9f
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09

View file

@ -63,8 +63,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.b_cancel.clicked.connect(self.close) self.b_cancel.clicked.connect(self.close)
self.ma_close.triggered.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_information.triggered.connect(self.about)
self.ma_clear_fields.triggered.connect(self.clear_fields)
# Conncect recipe name typing # Conncect recipe name typing
self.e_recipe_name.textChanged.connect(self.updateTitle) self.e_recipe_name.textChanged.connect(self.updateTitle)
@ -320,6 +321,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# Tab: Ratings # Tab: Ratings
self.e_rating.setText("") self.e_rating.setText("")
self.v_ratings.clear() self.v_ratings.clear()
def clear_fields(self):
"""
Show the clear fields dialog.
"""
dialog = ClearDialog()
dialog.accepted.connect(self.clear)
dialog.exec_() dialog.exec_()
def about(self): def about(self):
@ -339,6 +347,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if reply == QMessageBox.Yes: if reply == QMessageBox.Yes:
super.close() super.close()
if __name__ == "__main__": if __name__ == "__main__":
app = QApplication([]) app = QApplication([])
app.setApplicationName("WikiCookBook") app.setApplicationName("WikiCookBook")