Handle categories

This commit is contained in:
Marcel Kapfer 2020-04-30 21:34:58 +02:00
parent 0dd70e8461
commit 07ee4e3737
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09

12
init.py
View file

@ -25,6 +25,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# Conncect recipe name typing # Conncect recipe name typing
self.e_recipe_name.textChanged.connect(self.updateTitle) self.e_recipe_name.textChanged.connect(self.updateTitle)
# Handle category buttons
self.b_category_add.clicked.connect(self.category_add)
self.e_category.returnPressed.connect(self.category_add)
self.b_category_remove.clicked.connect(self.category_remove)
self.show() self.show()
def updateTitle(self): def updateTitle(self):
@ -37,6 +42,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
else: else:
self.setWindowTitle("WikiCookBook") self.setWindowTitle("WikiCookBook")
def category_add(self):
if self.e_category.text():
self.v_categories.addItem(f"Kategorie{self.e_category.text()}")
def category_remove(self):
self.v_categories.takeItem(self.v_categories.currentRow())
def close(self): def close(self):
""" """
Close the application. A warning is shown before. Close the application. A warning is shown before.