8196: Spurious spaces in CLI List Family Trees, tab delimited output.

Print statements changed to assemble the whole line before output.
This commit is contained in:
kulath 2014-11-24 18:15:27 +00:00
parent 80be25adae
commit a9640f327f

View File

@ -365,7 +365,7 @@ class ArgHandler(object):
# Apparently it is not a database. See if it is a file that
# can be imported.
db_path, title = self.dbman.import_new_db(self.open_gui, self.user)
# Handle the "-l" List Family Trees option.
if db_path:
# Test if not locked or problematic
if not self.check_db(db_path, self.force_unlock):
@ -376,6 +376,7 @@ class ArgHandler(object):
title = db_path
recent_files(db_path, title)
self.open = db_path
# Handle the "-L" List Family Trees in detail option.
self.__open_action()
else:
sys.exit(0)
@ -395,7 +396,7 @@ class ArgHandler(object):
:param: climan: the manager of a CLI session
:type: :class:`.CLIManager` object
"""
# Handle the "-l" List Family Trees option.
if self.list:
print(_('List of known Family Trees in your database path\n'))
@ -406,6 +407,7 @@ class ArgHandler(object):
% {'full_DB_path' : dirname, 'f_t_name' : name})
sys.exit(0)
# Handle the "-L" List Family Trees in detail option.
if self.list_more:
print(_('Gramps Family Trees:'))
summary_list = self.dbman.family_tree_summary()
@ -418,25 +420,26 @@ class ArgHandler(object):
print(_(" %s: %s") % (item, summary[item]))
sys.exit(0)
# Handle the "-t" List Family Trees, tab delimited option.
if self.list_table:
print(_('Gramps Family Trees:'))
summary_list = self.dbman.family_tree_summary()
if not summary_list:
sys.exit(0)
print(_("Family Tree"), end="")
# We have to construct the line elements together, to avoid
# insertion of blank spaces when print on the same line is used
line_list = [_("Family Tree")]
for key in sorted(summary_list[0]):
if key != "Family Tree":
print("\t ", end="")
print(key, end="")
print()
if key != _("Family Tree"):
line_list += [key]
print("\t".join(line_list))
for summary in sorted(summary_list,
key=lambda sum: sum[_("Family Tree")].lower()):
print('"%s"' % summary[_("Family Tree")], end="")
line_list = [('"%s"' % summary[_("Family Tree")])]
for item in sorted(summary):
if item != _("Family Tree"):
print("\t ", end="")
print('"%s"' % summary[item], end="")
print()
line_list += [('"%s"' % summary[item])]
print("\t".join(line_list))
sys.exit(0)
self.__open_action()