From b8b97924a6e67e3f7b633ee65174b35882657e23 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Mon, 5 Jan 2009 22:39:40 +0000 Subject: [PATCH] Added ellipses if the birth/death lines are too long svn: r11575 --- src/DataViews/RelationView.py | 10 ++++++---- src/widgets/labels.py | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/DataViews/RelationView.py b/src/DataViews/RelationView.py index affb8fbc9..8f19a85f4 100644 --- a/src/DataViews/RelationView.py +++ b/src/DataViews/RelationView.py @@ -37,6 +37,7 @@ import cgi # #------------------------------------------------------------------------- import gtk +import pango #------------------------------------------------------------------------- # @@ -578,8 +579,8 @@ class RelationshipView(PageView.PersonNavView): subtbl.attach(widgets.BasicLabel("%s:" % death_title), 1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0) subtbl.attach(widgets.BasicLabel("%s (%s)" % - (self.format_event(death), - age)), + (self.format_event(death), age), + pango.ELLIPSIZE_END), 2, 3, 2, 3, yoptions=0) showed_death = True if not showed_death: @@ -587,12 +588,13 @@ class RelationshipView(PageView.PersonNavView): if probably_alive(person, self.dbstate.db): subtbl.attach(widgets.BasicLabel("%s:" % _("Alive")), 1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0) - subtbl.attach(widgets.BasicLabel("(%s)" % age), + subtbl.attach(widgets.BasicLabel("(%s)" % age, pango.ELLIPSIZE_END), 2, 3, 2, 3, yoptions=0) else: subtbl.attach(widgets.BasicLabel("%s:" % _("Death")), 1, 2, 2, 3, xoptions=gtk.FILL, yoptions=0) - subtbl.attach(widgets.BasicLabel("%s (%s)" % (_("unknown"), age)), + subtbl.attach(widgets.BasicLabel("%s (%s)" % (_("unknown"), age), + pango.ELLIPSIZE_END), 2, 3, 2, 3, yoptions=0) showed_death = True diff --git a/src/widgets/labels.py b/src/widgets/labels.py index dace9fa07..c63e08853 100644 --- a/src/widgets/labels.py +++ b/src/widgets/labels.py @@ -154,9 +154,10 @@ class EditLabel(gtk.HBox): #------------------------------------------------------------------------- class BasicLabel(gtk.Label): - def __init__(self, text): + def __init__(self, text, ellipsize=pango.ELLIPSIZE_NONE): gtk.Label.__init__(self, text) self.set_alignment(0, 0.5) + self.set_ellipsize(ellipsize) self.show() #-------------------------------------------------------------------------