From 7710544936dc7c217e6d3e772b09339dbcce0daa Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 13 Dec 2015 10:49:47 -0500 Subject: [PATCH] gramps -L prints as it goes Gramps -l now lists details as it goes, rather than after collecting details from all databases. --- gramps/cli/arghandler.py | 12 +----------- gramps/cli/clidbman.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/gramps/cli/arghandler.py b/gramps/cli/arghandler.py index 960cbcbde..669417a1a 100644 --- a/gramps/cli/arghandler.py +++ b/gramps/cli/arghandler.py @@ -402,17 +402,7 @@ class ArgHandler(object): # Handle the "-L" List Family Trees in detail option. if self.list_more: - print(_('Gramps Family Trees:')) - summary_list = self.dbman.family_tree_summary() - for summary in sorted(summary_list, - key=lambda sum: sum[_("Family Tree")].lower()): - print(_("Family Tree \"%s\":") % summary[_("Family Tree")]) - for item in sorted(summary): - if item != "Family Tree": - # translators: needed for French, ignore otherwise - print(_(" %(item)s: %(summary)s") % { - 'item' : item, - 'summary' : summary[item] } ) + self.dbman.print_family_tree_summaries() sys.exit(0) # Handle the "-t" List Family Trees, tab delimited option. diff --git a/gramps/cli/clidbman.py b/gramps/cli/clidbman.py index aee331a00..bd124840e 100644 --- a/gramps/cli/clidbman.py +++ b/gramps/cli/clidbman.py @@ -172,6 +172,23 @@ class CLIDbManager(object): }) return retval + def print_family_tree_summaries(self): + """ + Prints a detailed list of the known family trees. + """ + print(_('Gramps Family Trees:')) + for item in self.current_names: + (name, dirpath, path_name, last, + tval, enable, stock_id) = item + summary = self.get_dbdir_summary(dirpath, name) + print(_("Family Tree \"%s\":") % summary[_("Family Tree")]) + for item in sorted(summary): + if item != "Family Tree": + # translators: needed for French, ignore otherwise + print(_(" %(item)s: %(summary)s") % { + 'item' : item, + 'summary' : summary[item] } ) + def family_tree_summary(self): """ Return a list of dictionaries of the known family trees.