* src/FamilyView.py: provide hyper links
svn: r5664
This commit is contained in:
parent
9d7c265bf3
commit
e3f27ec68c
@ -1,3 +1,6 @@
|
||||
2006-01-03 Don Allingham <don@gramps-project.org>
|
||||
* src/FamilyView.py: provide hyper links
|
||||
|
||||
2006-01-03 Alex Roitman <shura@gramps-project.org>
|
||||
* src/DisplayState.py (push): Typo.
|
||||
|
||||
|
@ -25,6 +25,8 @@ import RelLib
|
||||
import PageView
|
||||
import DisplayTrace
|
||||
import NameDisplay
|
||||
import Utils
|
||||
import DateHandler
|
||||
|
||||
class FamilyView(PageView.PageView):
|
||||
|
||||
@ -42,10 +44,14 @@ class FamilyView(PageView.PageView):
|
||||
return 'gramps-family'
|
||||
|
||||
def build_widget(self):
|
||||
self.scroll = gtk.ScrolledWindow()
|
||||
self.scroll.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
|
||||
self.scroll.show()
|
||||
self.vbox = gtk.VBox()
|
||||
self.vbox.show()
|
||||
self.child = None
|
||||
return self.vbox
|
||||
self.scroll.add_with_viewport(self.vbox)
|
||||
return self.scroll
|
||||
|
||||
def navigation_type(self):
|
||||
return PageView.NAVIGATION_PERSON
|
||||
@ -74,7 +80,7 @@ class FamilyView(PageView.PageView):
|
||||
def change_person(self,obj):
|
||||
if self.child:
|
||||
self.vbox.remove(self.child)
|
||||
self.child = gtk.Table(10,8)
|
||||
self.child = gtk.Table(20,5)
|
||||
self.child.set_border_width(12)
|
||||
self.child.set_col_spacings(12)
|
||||
self.child.set_row_spacings(6)
|
||||
@ -95,38 +101,53 @@ class FamilyView(PageView.PageView):
|
||||
self.write_family(family_handle)
|
||||
|
||||
self.child.show()
|
||||
self.vbox.pack_start(self.child,expand=False,fill=False)
|
||||
self.vbox.pack_start(self.child,False)
|
||||
|
||||
def make_button(self,handle,icon,func):
|
||||
image = gtk.Image()
|
||||
image.set_from_stock(icon,gtk.ICON_SIZE_MENU)
|
||||
image.show()
|
||||
button = gtk.Button()
|
||||
button.add(image)
|
||||
button.connect('clicked',func,handle)
|
||||
button.show()
|
||||
return button
|
||||
eventbox = gtk.EventBox()
|
||||
eventbox.add(image)
|
||||
eventbox.show()
|
||||
eventbox.connect('button-press-event',self.edit_button_press,handle)
|
||||
return eventbox
|
||||
|
||||
def edit_button_press(self, obj, event, handle):
|
||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
|
||||
import EditPerson
|
||||
person = self.dbstate.db.get_person_from_handle(handle)
|
||||
EditPerson.EditPerson(self.dbstate, self.uistate, [], person)
|
||||
|
||||
def make_edit_button(self,handle):
|
||||
return self.make_button(handle,gtk.STOCK_EDIT,self.edit_person)
|
||||
|
||||
def write_title(self,person):
|
||||
def write_title(self,person):
|
||||
label = gtk.Label('<span size="larger" weight="bold">%s</span>'
|
||||
% NameDisplay.displayer.display(person))
|
||||
label.set_use_markup(True)
|
||||
label.set_alignment(0,0.5)
|
||||
label.show()
|
||||
self.child.attach(label,0,6,0,1)
|
||||
self.child.attach(label,0,4,0,1)
|
||||
button = self.make_edit_button(person.handle)
|
||||
self.child.attach(button,7,8,0,1,xoptions=0)
|
||||
self.row = 1
|
||||
self.child.attach(button,4,5,0,1,xoptions=0)
|
||||
self.child.attach(gtk.HSeparator(),0,5,1,2)
|
||||
self.row = 2
|
||||
|
||||
def write_data(self,title):
|
||||
label = gtk.Label(title)
|
||||
label.set_alignment(0,0.5)
|
||||
label.show()
|
||||
self.child.attach(label,3,5,self.row,self.row+1,
|
||||
xoptions=gtk.EXPAND|gtk.FILL)
|
||||
self.row += 1
|
||||
|
||||
def write_label(self,title):
|
||||
label = gtk.Label('<span weight="bold">%s</span>' % title)
|
||||
label = gtk.Label('<span style="oblique" weight="bold">%s</span>' % title)
|
||||
label.set_use_markup(True)
|
||||
label.set_alignment(0,0.5)
|
||||
label.show()
|
||||
self.child.attach(label,1,6,self.row,self.row+1)
|
||||
self.child.attach(label,1,5,self.row,self.row+1)
|
||||
self.row += 1
|
||||
|
||||
def write_person(self,title,handle):
|
||||
@ -134,11 +155,12 @@ class FamilyView(PageView.PageView):
|
||||
format = '<span weight="bold">%s: </span>'
|
||||
else:
|
||||
format = "%s"
|
||||
|
||||
label = gtk.Label(format % title)
|
||||
label.set_use_markup(True)
|
||||
label.set_alignment(1.0,0.5)
|
||||
label.set_alignment(0,0.5)
|
||||
label.show()
|
||||
self.child.attach(label,2,3,self.row,self.row+1,xoptions=0)
|
||||
self.child.attach(label,2,3,self.row,self.row+1,xoptions=gtk.FILL)
|
||||
|
||||
label = gtk.Label('<span underline="single">%s</span>' %
|
||||
self.get_name(handle))
|
||||
@ -152,11 +174,16 @@ class FamilyView(PageView.PageView):
|
||||
eventbox.connect('enter-notify-event',self.enter_text,handle)
|
||||
eventbox.connect('leave-notify-event',self.leave_text,handle)
|
||||
eventbox.show()
|
||||
|
||||
self.child.attach(eventbox,3,4,self.row,self.row+1,
|
||||
xoptions=gtk.EXPAND|gtk.FILL)
|
||||
|
||||
button = self.make_edit_button(handle)
|
||||
self.child.attach(button,7,8,self.row,self.row+1,xoptions=0)
|
||||
|
||||
box = gtk.HBox()
|
||||
box.set_spacing(6)
|
||||
box.pack_start(eventbox,False)
|
||||
box.pack_start(button,False)
|
||||
box.show()
|
||||
self.child.attach(box,3,4,self.row,self.row+1,
|
||||
xoptions=gtk.EXPAND|gtk.FILL)
|
||||
self.row += 1
|
||||
|
||||
def button_press(self,obj,event,handle):
|
||||
@ -183,6 +210,35 @@ class FamilyView(PageView.PageView):
|
||||
self.write_person(_('Father'),family.get_father_handle())
|
||||
self.write_person(_('Mother'),family.get_mother_handle())
|
||||
|
||||
def write_relationship(self,family):
|
||||
rtype = family.get_relationship()
|
||||
if type(rtype) == tuple:
|
||||
if rtype[0] == RelLib.Family.CUSTOM:
|
||||
rel_text = rtype[1]
|
||||
else:
|
||||
rel_text = Utils.family_relations[rtype[0]]
|
||||
else:
|
||||
rel_text = Utils.family_relations[rtype]
|
||||
self.write_data(_('Relationship type: %s') % rel_text)
|
||||
|
||||
def place_name(self,handle):
|
||||
p = self.dbstate.db.get_place_from_handle(handle)
|
||||
return p.get_title()
|
||||
|
||||
def write_marriage(self,family):
|
||||
for event_ref in family.get_event_ref_list():
|
||||
handle = event_ref.ref
|
||||
event = self.dbstate.db.get_event_from_handle(handle)
|
||||
etype = event.get_type()
|
||||
if etype[0] == RelLib.Event.MARRIAGE:
|
||||
dobj = event.get_date_object()
|
||||
pname = self.place_name(event.get_place_handle())
|
||||
value = {
|
||||
'date' : DateHandler.displayer.display(dobj),
|
||||
'place' : pname,
|
||||
}
|
||||
self.write_data(_('Married: %(date)s in %(place)s') % value)
|
||||
|
||||
def write_family(self,family_handle):
|
||||
family = self.dbstate.db.get_family_from_handle(family_handle)
|
||||
father_handle = family.get_father_handle()
|
||||
@ -191,6 +247,10 @@ class FamilyView(PageView.PageView):
|
||||
self.write_person(_('Spouse'),mother_handle)
|
||||
else:
|
||||
self.write_person(_('Spouse'),father_handle)
|
||||
|
||||
self.write_relationship(family)
|
||||
self.write_marriage(family)
|
||||
|
||||
child_list = family.get_child_handle_list()
|
||||
label = _("Children")
|
||||
if child_list:
|
||||
|
Loading…
Reference in New Issue
Block a user