Handle categories
This commit is contained in:
parent
0dd70e8461
commit
07ee4e3737
1 changed files with 12 additions and 0 deletions
12
init.py
12
init.py
|
@ -25,6 +25,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
# Conncect recipe name typing
|
||||
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()
|
||||
|
||||
def updateTitle(self):
|
||||
|
@ -37,6 +42,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
else:
|
||||
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):
|
||||
"""
|
||||
Close the application. A warning is shown before.
|
||||
|
|
Reference in a new issue