2006-05-23 Don Allingham <don@gramps-project.org>
* src/DataViews/_RelationView.py: finish shading * src/GrampsDb/_DbUtils.py: add birth/death index set funcion * src/Editors/_EditPerson.py: birth/death index fixes * src/DisplayTabs/_PersonEventEmbedList.py: birth/death index fixes * src/GrampsWidgets.py: shading fixes * src/DisplayModels/_PeopleModel.py: birth/death index fixes svn: r6764
This commit is contained in:
parent
d1d1c2fb5b
commit
74b55ce32a
@ -1,3 +1,11 @@
|
||||
2006-05-23 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_RelationView.py: finish shading
|
||||
* src/GrampsDb/_DbUtils.py: add birth/death index set funcion
|
||||
* src/Editors/_EditPerson.py: birth/death index fixes
|
||||
* src/DisplayTabs/_PersonEventEmbedList.py: birth/death index fixes
|
||||
* src/GrampsWidgets.py: shading fixes
|
||||
* src/DisplayModels/_PeopleModel.py: birth/death index fixes
|
||||
|
||||
2006-05-23 Alex Roitman <shura@gramps-project.org>
|
||||
* src/Utils.py (probably_alive): Adapt to new birth/death refs.
|
||||
|
||||
|
@ -566,6 +566,7 @@ class RelationshipView(PageView.PersonNavView):
|
||||
|
||||
label = GrampsWidgets.MarkupLabel(format % cgi.escape(title))
|
||||
label.set_alignment(0,0)
|
||||
label.set_padding(0,3)
|
||||
self.attach.attach(label, _PLABEL_START, _PLABEL_STOP, self.row,
|
||||
self.row+1, xoptions=gtk.FILL|gtk.SHRINK,
|
||||
yoptions=gtk.FILL|gtk.SHRINK)
|
||||
@ -610,13 +611,16 @@ class RelationshipView(PageView.PersonNavView):
|
||||
link_label = GrampsWidgets.LinkLabel(self.get_name(handle, True),
|
||||
self.button_press, handle)
|
||||
link_label.modify_bg(gtk.STATE_NORMAL, self.color)
|
||||
link_label.set_padding(3, 0)
|
||||
button = GrampsWidgets.IconButton(self.edit_button_press, handle)
|
||||
vbox.pack_start(GrampsWidgets.LinkBox(link_label, button))
|
||||
|
||||
if self.show_details:
|
||||
value = self.info_string(handle)
|
||||
if value:
|
||||
vbox.add(GrampsWidgets.BasicLabel(value))
|
||||
l = GrampsWidgets.BasicLabel(value)
|
||||
l.set_padding(3, 0)
|
||||
vbox.add(l)
|
||||
|
||||
def write_data(self, box, title, start_col=_SDATA_START,
|
||||
stop_col=_SDATA_STOP):
|
||||
@ -710,7 +714,6 @@ class RelationshipView(PageView.PersonNavView):
|
||||
if handle:
|
||||
box = self.write_person(_('Spouse'), handle)
|
||||
|
||||
print family
|
||||
if not self.write_marriage(box, family):
|
||||
self.write_relationship(box, family)
|
||||
|
||||
|
@ -431,13 +431,18 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
return PeopleModel._GENDER[data[PeopleModel._GENDER_COL]]
|
||||
|
||||
def column_birth_day(self, data, node):
|
||||
if data[PeopleModel._BIRTH_COL]:
|
||||
b = EventRef()
|
||||
b.unserialize(data[PeopleModel._BIRTH_COL])
|
||||
birth = self.db.get_event_from_handle(b.ref)
|
||||
date_str = DateHandler.get_date(birth)
|
||||
if date_str != "":
|
||||
return cgi.escape(date_str)
|
||||
index = data[PeopleModel._BIRTH_COL]
|
||||
if index != -1:
|
||||
try:
|
||||
local = data[PeopleModel._EVENT_COL][index]
|
||||
b = EventRef()
|
||||
b.unserialize(local)
|
||||
birth = self.db.get_event_from_handle(b.ref)
|
||||
date_str = DateHandler.get_date(birth)
|
||||
if date_str != "":
|
||||
return cgi.escape(date_str)
|
||||
except:
|
||||
return u''
|
||||
|
||||
for event_ref in data[PeopleModel._EVENT_COL]:
|
||||
er = EventRef()
|
||||
@ -452,13 +457,18 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
return u""
|
||||
|
||||
def column_death_day(self, data, node):
|
||||
if data[PeopleModel._DEATH_COL]:
|
||||
dr = EventRef()
|
||||
dr.unserialize(data[PeopleModel._DEATH_COL])
|
||||
death = self.db.get_event_from_handle(dr.ref)
|
||||
date_str = DateHandler.get_date(death)
|
||||
if date_str != "":
|
||||
return cgi.escape(date_str)
|
||||
index = data[PeopleModel._DEATH_COL]
|
||||
if index != -1:
|
||||
try:
|
||||
local = data[PeopleModel._EVENT_COL][index]
|
||||
ref = EventRef()
|
||||
ref.unserialize(local)
|
||||
event = self.db.get_event_from_handle(ref.ref)
|
||||
date_str = DateHandler.get_date(event)
|
||||
if date_str != "":
|
||||
return cgi.escape(date_str)
|
||||
except:
|
||||
return u''
|
||||
|
||||
for event_ref in data[PeopleModel._EVENT_COL]:
|
||||
er = EventRef()
|
||||
@ -473,25 +483,35 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
return u""
|
||||
|
||||
def column_cause_of_death(self, data, node):
|
||||
if data[PeopleModel._DEATH_COL]:
|
||||
dr = EventRef()
|
||||
dr.unserialize(data[PeopleModel._DEATH_COL])
|
||||
return self.db.get_event_from_handle(dr.ref).get_cause()
|
||||
index = data[PeopleModel._DEATH_COL]
|
||||
if index != -1:
|
||||
try:
|
||||
local = data[PeopleModel._EVENT_COL][index]
|
||||
dr = EventRef()
|
||||
dr.unserialize(local)
|
||||
return self.db.get_event_from_handle(dr.ref).get_cause()
|
||||
except:
|
||||
return u''
|
||||
else:
|
||||
return u""
|
||||
|
||||
def column_birth_place(self, data, node):
|
||||
if data[PeopleModel._BIRTH_COL]:
|
||||
br = EventRef()
|
||||
br.unserialize(data[PeopleModel._BIRTH_COL])
|
||||
event = self.db.get_event_from_handle(br.ref)
|
||||
if event:
|
||||
place_handle = event.get_place_handle()
|
||||
if place_handle:
|
||||
place = self.db.get_place_from_handle(place_handle)
|
||||
place_title = place.get_title()
|
||||
if place_title != "":
|
||||
return cgi.escape(place_title)
|
||||
index = data[PeopleModel._BIRTH_COL]
|
||||
if index != -1:
|
||||
try:
|
||||
local = data[PeopleModel._EVENT_COL][index]
|
||||
br = EventRef()
|
||||
br.unserialize(local)
|
||||
event = self.db.get_event_from_handle(br.ref)
|
||||
if event:
|
||||
place_handle = event.get_place_handle()
|
||||
if place_handle:
|
||||
place = self.db.get_place_from_handle(place_handle)
|
||||
place_title = place.get_title()
|
||||
if place_title != "":
|
||||
return cgi.escape(place_title)
|
||||
except:
|
||||
return u''
|
||||
|
||||
for event_ref in data[PeopleModel._EVENT_COL]:
|
||||
er = EventRef()
|
||||
@ -509,17 +529,22 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
return u""
|
||||
|
||||
def column_death_place(self, data, node):
|
||||
if data[PeopleModel._DEATH_COL]:
|
||||
dr = EventRef()
|
||||
dr.unserialize(data[PeopleModel._DEATH_COL])
|
||||
event = self.db.get_event_from_handle(dr.ref)
|
||||
if event:
|
||||
place_handle = event.get_place_handle()
|
||||
if place_handle:
|
||||
place = self.db.get_place_from_handle(place_handle)
|
||||
place_title = place.get_title()
|
||||
if place_title != "":
|
||||
return cgi.escape(place_title)
|
||||
index = data[PeopleModel._DEATH_COL]
|
||||
if index != -1:
|
||||
try:
|
||||
local = data[PeopleModel._EVENT_COL][index]
|
||||
dr = EventRef()
|
||||
dr.unserialize(local)
|
||||
event = self.db.get_event_from_handle(dr.ref)
|
||||
if event:
|
||||
place_handle = event.get_place_handle()
|
||||
if place_handle:
|
||||
place = self.db.get_place_from_handle(place_handle)
|
||||
place_title = place.get_title()
|
||||
if place_title != "":
|
||||
return cgi.escape(place_title)
|
||||
except:
|
||||
return u''
|
||||
|
||||
for event_ref in data[PeopleModel._EVENT_COL]:
|
||||
er = EventRef()
|
||||
|
@ -50,14 +50,10 @@ _std_types = [
|
||||
class PersonEventEmbedList(EventEmbedList):
|
||||
|
||||
def __init__(self, dbstate, uistate, track, obj):
|
||||
self.orig_data = [ data for data in [ obj.get_birth_ref(), \
|
||||
obj.get_death_ref()] + \
|
||||
obj.get_event_ref_list() \
|
||||
if data ]
|
||||
EventEmbedList.__init__(self, dbstate, uistate, track, obj)
|
||||
|
||||
def get_data(self):
|
||||
return self.orig_data
|
||||
return self.obj.get_event_ref_list()
|
||||
|
||||
def default_role(self):
|
||||
return RelLib.EventRoleType(RelLib.EventRoleType.PRIMARY)
|
||||
@ -66,12 +62,9 @@ class PersonEventEmbedList(EventEmbedList):
|
||||
type_list = []
|
||||
|
||||
# combine return info into a single flat sequence
|
||||
ri = self.return_info()
|
||||
ri = ri[0:2] + tuple(ri[2])
|
||||
ref_list = [ ref for ref in ri if ref]
|
||||
|
||||
|
||||
event = None
|
||||
for event_ref in ref_list:
|
||||
for event_ref in self.get_data():
|
||||
event = self.dbstate.db.get_event_from_handle(event_ref.ref)
|
||||
type_list.append(event.get_type())
|
||||
|
||||
@ -84,17 +77,3 @@ class PersonEventEmbedList(EventEmbedList):
|
||||
from Editors import EditEventRef
|
||||
return EditEventRef
|
||||
|
||||
def return_info(self):
|
||||
new_list = []
|
||||
birth_ref = None
|
||||
death_ref = None
|
||||
|
||||
for ref in self.orig_data:
|
||||
event = self.dbstate.db.get_event_from_handle(ref.ref)
|
||||
if birth_ref == None and event.get_type() == RelLib.EventType.BIRTH:
|
||||
birth_ref = ref
|
||||
elif death_ref == None and event.get_type() == RelLib.EventType.DEATH:
|
||||
death_ref = ref
|
||||
else:
|
||||
new_list.append(ref)
|
||||
return (birth_ref, death_ref, new_list)
|
||||
|
@ -62,6 +62,8 @@ import RelLib
|
||||
import GrampsWidgets
|
||||
import Config
|
||||
|
||||
from GrampsDb import set_birth_death_index
|
||||
|
||||
from _EditPrimary import EditPrimary
|
||||
from QuestionDialog import *
|
||||
from DisplayTabs import \
|
||||
@ -537,11 +539,7 @@ class EditPerson(EditPrimary):
|
||||
if self._check_for_unknown_gender():
|
||||
return
|
||||
|
||||
(birth_ref, death_ref, event_list) = self.event_list.return_info()
|
||||
self.obj.set_birth_ref(birth_ref)
|
||||
self.obj.set_death_ref(death_ref)
|
||||
self.obj.set_event_ref_list(event_list)
|
||||
|
||||
set_birth_death_index(self.db, self.obj)
|
||||
self.window.hide()
|
||||
|
||||
trans = self.db.transaction_begin()
|
||||
|
@ -272,3 +272,17 @@ def update_secondary_empty(sec_table,handle,data):
|
||||
|
||||
def update_secondary_inmem(sec_table,handle,data):
|
||||
sec_table[str(data[1])] = str(handle)
|
||||
|
||||
def set_birth_death_index(db, person):
|
||||
birth = -1
|
||||
death = -1
|
||||
index = 0
|
||||
for ref in person.get_event_ref_list():
|
||||
event = db.get_event_from_handle(ref.ref)
|
||||
if int(event.get_type()) == RelLib.EventType.BIRTH and birth == -1:
|
||||
birth = index
|
||||
elif int(event.get_type()) == RelLib.EventType.DEATH and death == -1:
|
||||
death = index
|
||||
person.birth_ref_index = birth
|
||||
person.death_ref_index = death
|
||||
|
||||
|
@ -65,6 +65,9 @@ class LinkLabel(gtk.EventBox):
|
||||
self.connect('enter-notify-event', self.enter_text, handle)
|
||||
self.connect('leave-notify-event', self.leave_text, handle)
|
||||
self.connect('realize', realize_cb)
|
||||
|
||||
def set_padding(self, x, y):
|
||||
self.label.set_padding(x, y)
|
||||
|
||||
def enter_text(self, obj, event, handle):
|
||||
text = '<span foreground="blue" underline="single">%s</span>' % self.orig_text
|
||||
|
Loading…
Reference in New Issue
Block a user