From 09ce159d36be58d74f07da5b9c04f96f1cc5ab77 Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Thu, 30 Apr 2020 19:05:44 +0200 Subject: [PATCH] Show current recipe name in window title --- init.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/init.py b/init.py index 0a6dbbf..d8c9f63 100644 --- a/init.py +++ b/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.