svn: r2898
This commit is contained in:
Alex Roitman 2004-02-23 05:42:19 +00:00
parent e6693e4df2
commit 0d2ee48ee0
4 changed files with 47 additions and 23 deletions

View File

@ -368,8 +368,10 @@ class DelSrcQuery:
for key in self.db.get_person_keys():
p = self.db.get_person(key)
for v in p.get_event_list() + [p.get_birth(), p.get_death()]:
self.delete_source(v)
for v_id in p.get_event_list() + [p.get_birth_id(), p.get_death_id()]:
v = self.db.find_event_from_id(v_id)
if v:
self.delete_source(v)
for v in p.get_attribute_list():
self.delete_source(v)
@ -380,17 +382,22 @@ class DelSrcQuery:
for v in p.get_address_list():
self.delete_source(v)
for p in self.db.get_family_id_map().values():
for v in p.get_event_list():
self.delete_source(v)
for p_id in self.db.get_family_keys():
p = self.db.find_family_from_id(p_id)
for v_id in p.get_event_list():
v = self.db.find_event_from_id(v_id)
if v:
self.delete_source(v)
for v in p.get_attribute_list():
self.delete_source(v)
for p in self.db.get_object_map().values():
for p_id in self.db.get_object_keys():
p = self.db.find_object_from_id(p_id)
self.delete_source(p)
for key in self.db.get_place_id_keys():
self.delete_source(self.db.get_place_id(key))
p = self.db.find_place_from_id(key)
self.delete_source(self.db.find_place_from_id(key))
self.update(0)

View File

@ -2929,9 +2929,19 @@ class GrampsDB:
return self.media_map.keys()
def sortbysource(self,f,s):
f1 = self.source_map[f].title.upper()
s1 = self.source_map[s].title.upper()
return cmp(f1,s1)
if self.source_map.get(str(f)):
f1 = Source()
f1.unserialize(self.source_map.get(str(f)))
else:
return 0
if self.source_map.get(str(s)):
s1 = Source()
s1.unserialize(self.source_map.get(str(s)))
else:
return 0
f2 = f1.get_title().upper()
s2 = s1.get_title().upper()
return cmp(f2,s2)
def set_source_keys(self):
keys = self.source_map.keys()

View File

@ -202,10 +202,12 @@ class SourceView:
return 1
for key in self.db.get_person_keys():
p = self.db.get_person(key)
for v in p.get_event_list() + [p.get_birth(), p.get_death()]:
for sref in v.get_source_references():
if sref.get_base_id() == source.get_id():
return 1
for v_id in p.get_event_list() + [p.get_birth_id(), p.get_death_id()]:
v = self.db.find_event_from_id(v_id)
if v:
for sref in v.get_source_references():
if sref.get_base_id() == source.get_id():
return 1
for v in p.get_attribute_list():
for sref in v.get_source_references():
if sref.get_base_id() == source.get_id():
@ -218,15 +220,19 @@ class SourceView:
for sref in v.get_source_references():
if sref.get_base_id() == source.get_id():
return 1
for p in self.db.get_object_map().values():
for p_id in self.db.get_object_keys():
p = self.db.find_object_from_id(p_id)
for sref in p.get_source_references():
if sref.get_base_id() == source.get_id():
return 1
for p in self.db.get_family_id_map().values():
for v in p.get_event_list():
for sref in v.get_source_references():
if sref.get_base_id() == source.get_id():
return 1
for p_id in self.db.get_family_keys():
p = self.db.find_family_from_id(p_id)
for v_id in p.get_event_list():
v = self.db.find_event_from_id(v_id)
if v:
for sref in v.get_source_references():
if sref.get_base_id() == source.get_id():
return 1
for v in p.get_attribute_list():
for sref in v.get_source_references():
if sref.get_base_id() == source.get_id():

View File

@ -410,13 +410,14 @@ class SourceEditor:
self.author_field.set_text("")
self.pub_field.set_text("")
values = self.db.source_map.values()
values.sort(by_title)
keys = self.db.get_source_keys()
keys.sort(self.db.sortbysource)
sel_child = None
self.list = []
self.active_source = sel
for src in values:
for src_id in keys:
src = self.db.find_source_from_id(src_id)
l = gtk.Label("%s [%s]" % (src.get_title(),src.get_id()))
l.show()
l.set_alignment(0,0.5)