From b4cdee2c62ff167b7377cfd52097b5937f6c7fc7 Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Fri, 1 May 2020 21:31:50 +0200 Subject: [PATCH] Handle utensils --- init.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/init.py b/init.py index a8e2c48..2f2a03b 100644 --- a/init.py +++ b/init.py @@ -34,6 +34,11 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.b_ingredient_add.clicked.connect(self.ingredient_add) self.b_ingredient_remove.clicked.connect(self.ingredient_remove) + # Handle utensils + self.b_utensil_add.clicked.connect(self.utensil_add) + self.e_utensil.returnPressed.connect(self.utensil_add) + self.b_utensil_remove.clicked.connect(self.utensil_remove) + self.show() def updateTitle(self): @@ -68,6 +73,13 @@ class MainWindow(QMainWindow, Ui_MainWindow): def ingredient_remove(self): self.v_ingredients.removeRow(self.v_ingredients.currentRow()) + def utensil_add(self): + if self.e_utensil.text(): + self.v_utensils.addItem(self.e_utensil.text()) + + def utensil_remove(self): + self.v_utensils.takeItem(self.v_utensils.currentRow()) + def close(self): """ Close the application. A warning is shown before.