Handle utensils

This commit is contained in:
Marcel Kapfer 2020-05-01 21:31:50 +02:00
parent 6f208d9bc8
commit b4cdee2c62
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09

12
init.py
View file

@ -34,6 +34,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.b_ingredient_add.clicked.connect(self.ingredient_add) self.b_ingredient_add.clicked.connect(self.ingredient_add)
self.b_ingredient_remove.clicked.connect(self.ingredient_remove) 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() self.show()
def updateTitle(self): def updateTitle(self):
@ -68,6 +73,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def ingredient_remove(self): def ingredient_remove(self):
self.v_ingredients.removeRow(self.v_ingredients.currentRow()) 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): def close(self):
""" """
Close the application. A warning is shown before. Close the application. A warning is shown before.