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:14:46 +00:00
parent 80924b9db0
commit 18308f9a32

View File

@ -362,7 +362,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):
@ -373,6 +373,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)
@ -392,7 +393,7 @@ class ArgHandler(object):
@param: climan: the manager of a CLI session
@type: CLIManager object
"""
# Handle the "-l" List Family Trees option.
if self.list:
print(_('List of known Family Trees in your database path\n'))
@ -403,6 +404,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()
@ -414,25 +416,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()