Added ellipses if the birth/death lines are too long

svn: r11575
This commit is contained in:
Doug Blank 2009-01-05 22:39:40 +00:00
parent cc67aac37b
commit b8b97924a6
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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()
#-------------------------------------------------------------------------