From ba3a575ba2fd936b4d3d25622c5c63bd09e9795c Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Wed, 9 Sep 2020 23:43:40 +0200 Subject: [PATCH] Added clear function The clear function reset all input areas to their initial (mostly empty) value. --- wikicookbook.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/wikicookbook.py b/wikicookbook.py index d8b8835..44f5590 100644 --- a/wikicookbook.py +++ b/wikicookbook.py @@ -277,6 +277,49 @@ class MainWindow(QMainWindow, Ui_MainWindow): code = current_recipe.wikicode(writer) dialog = WikiCodeDialog(code) + def clear(self): + """ + Clear all fields + """ + + # Tab: Basics + self.e_recipe_name.setText("") + self.e_servings.setText("") + self.e_time.setText("") + self.e_rating_overall.setValue(3) + self.e_url.setText("") + self.e_category.setText("") + self.v_categories.clear() + + # Tab: Ingredients + self.e_ingredient.setText("") + self.e_amount.setText("") + self.c_heading.setChecked(False) + self.v_ingredients.clear() + + # Tab: Utensils + self.e_utensil.setText("") + self.v_utensils.clear() + + # Tab: Steps + self.e_step.setText("") + self.v_steps.clear() + + # Tab: Notes + self.e_note.setText("") + self.v_notes.clear() + + # Tab: Tips + self.e_tip.setText("") + self.v_tips.clear() + + # Tab: Variations + self.e_variation.setText("") + self.v_variations.clear() + + # Tab: Ratings + self.e_rating.setText("") + self.v_ratings.clear() dialog.exec_() def about(self):