Show current recipe name in window title
This commit is contained in:
parent
33615d54fa
commit
09ce159d36
1 changed files with 13 additions and 0 deletions
13
init.py
13
init.py
|
@ -22,8 +22,21 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.b_cancel.clicked.connect(self.close)
|
||||
self.ma_close.triggered.connect(self.close)
|
||||
|
||||
# Conncect recipe name typing
|
||||
self.e_recipe_name.textChanged.connect(self.updateTitle)
|
||||
|
||||
self.show()
|
||||
|
||||
def updateTitle(self):
|
||||
"""
|
||||
Update the window title so it contains the name of the current recipe.
|
||||
"""
|
||||
current_recipe_name = self.e_recipe_name.text()
|
||||
if current_recipe_name:
|
||||
self.setWindowTitle(f"{current_recipe_name} - WikiCookBook")
|
||||
else:
|
||||
self.setWindowTitle("WikiCookBook")
|
||||
|
||||
def close(self):
|
||||
"""
|
||||
Close the application. A warning is shown before.
|
||||
|
|
Reference in a new issue