def __rename_database(self, path, new_text): """ Renames the database by writing the new value to the name.txt file """ new_text = new_text.strip() node = self.model.get_iter(path) filename = self.model.get_value(node, FILE_COL) if self.existing_name(new_text, skippath=path): DbManager.ERROR(_("Could not rename the Family Tree."), _("Family Tree already exists, choose a unique name.")) return old_text, new_text = self.rename_database(filename, new_text) if not (old_text is None): rename_filename(old_text, new_text) self.model.set_value(node, NAME_COL, new_text) #scroll to new position store, node = self.selection.get_selected() tree_path = store.get_path(node) self.dblist.scroll_to_cell(tree_path, None, False, 0.5, 0.5)
def __rename_database(self, path, new_text): """ Renames the database by writing the new value to the name.txt file """ new_text = new_text.strip() node = self.model.get_iter(path) filename = self.model.get_value(node, FILE_COL) if self.existing_name(new_text, skippath=path): DbManager.ERROR( _("Could not rename the Family Tree."), _("Family Tree already exists, choose a unique name.")) return old_text, new_text = self.rename_database(filename, new_text) if not (old_text is None): rename_filename(old_text, new_text) self.model.set_value(node, NAME_COL, new_text) #scroll to new position store, node = self.selection.get_selected() tree_path = store.get_path(node) self.dblist.scroll_to_cell(tree_path, None, False, 0.5, 0.5)