From e54ed1254a4696f24738c75f6ee36fb617853c38 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Tue, 2 Feb 2016 10:34:52 +0100 Subject: [PATCH] 7852: Rename family tree does not update the title of the parent window. --- gramps/gui/dbman.py | 9 +++++++++ gramps/gui/viewmanager.py | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/gramps/gui/dbman.py b/gramps/gui/dbman.py index b4d67c64d..12e580000 100644 --- a/gramps/gui/dbman.py +++ b/gramps/gui/dbman.py @@ -179,6 +179,8 @@ class DbManager(CLIDbManager): self.__connect_signals() self.__build_interface() self._populate_model() + self.before_change = "" + self.after_change = "" def __connect_signals(self): """ @@ -474,6 +476,13 @@ class DbManager(CLIDbManager): if len(new_text) > 0: node = self.model.get_iter(path) old_text = self.model.get_value(node, NAME_COL) + if self.model.get_value(node, ICON_COL) != None: + # this database is loaded. We must change the title + # in case we change the name several times before quitting, + # we save the first old name. + if self.before_change == "": + self.before_change = old_text + self.after_change = new_text if not old_text.strip() == new_text.strip(): if len(path.get_indices()) > 1 : self.__rename_revision(path, new_text) diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index 21cfdf1f7..51cec5c73 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -1097,6 +1097,20 @@ class ViewManager(CLIManager): (filename, title) = value self.db_loader.read_file(filename) self._post_load_newdb(filename, 'x-directory/normal', title) + else: + if dialog.after_change != "": + # We change the title of the main window. + old_title = self.uistate.window.get_title() + delim = old_title.find(' - ') + tit1 = old_title[:delim] + tit2 = old_title[delim:] + if '<=' in tit2: + delim2 = tit2.find('<=') + 3 + tit3 = tit2[delim2:-1] + new_title = dialog.after_change + tit2.replace(']', '') + ' => ' + tit1 + ']' + else: + new_title = dialog.after_change + tit2 + ' <= [' + tit1 + ']' + self.uistate.window.set_title(new_title) def __post_load(self): """