* src/ReadGedcom.py: emit proper signals to notify of a database
rebuild, handle parent/child relationships better - eliminate string types * src/ReadXML.py: emit proper signals to notify of a database rebuild * src/Sources.py: select just added handle after an addition svn: r4286
This commit is contained in:
parent
306606d53c
commit
bfc4b88cda
@ -1,4 +1,9 @@
|
|||||||
2005-04-02 Don Allingham <don@gramps-project.org>
|
2005-04-02 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/ReadGedcom.py: emit proper signals to notify of a database
|
||||||
|
rebuild, handle parent/child relationships better - eliminate
|
||||||
|
string types
|
||||||
|
* src/ReadXML.py: emit proper signals to notify of a database rebuild
|
||||||
|
* src/Sources.py: select just added handle after an addition
|
||||||
* src/SourceView.py: fix multiple selection problem.
|
* src/SourceView.py: fix multiple selection problem.
|
||||||
|
|
||||||
2005-04-02 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
2005-04-02 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
|
@ -87,6 +87,12 @@ rel_types = (RelLib.Person.CHILD_REL_BIRTH,
|
|||||||
RelLib.Person.CHILD_REL_UNKWN,
|
RelLib.Person.CHILD_REL_UNKWN,
|
||||||
RelLib.Person.CHILD_REL_NONE)
|
RelLib.Person.CHILD_REL_NONE)
|
||||||
|
|
||||||
|
pedi_type = {
|
||||||
|
'birth' : RelLib.Person.CHILD_REL_BIRTH,
|
||||||
|
'adopted': RelLib.Person.CHILD_REL_ADOPT,
|
||||||
|
'foster' : RelLib.Person.CHILD_REL_FOST,
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GEDCOM events to GRAMPS events conversion
|
# GEDCOM events to GRAMPS events conversion
|
||||||
@ -492,8 +498,10 @@ class GedcomParser:
|
|||||||
if use_trans:
|
if use_trans:
|
||||||
self.db.transaction_commit(self.trans,_("GEDCOM import"))
|
self.db.transaction_commit(self.trans,_("GEDCOM import"))
|
||||||
else:
|
else:
|
||||||
self.db.run_person_rebuild_callbacks()
|
self.db.emit('person-rebuild')
|
||||||
self.db.run_family_rebuild_callbacks()
|
self.db.emit('family-rebuild')
|
||||||
|
self.db.emit('place-rebuild')
|
||||||
|
self.db.emit('source-rebuild')
|
||||||
|
|
||||||
if self.window:
|
if self.window:
|
||||||
self.infomsg("\n%s" % msg)
|
self.infomsg("\n%s" % msg)
|
||||||
@ -819,6 +827,8 @@ class GedcomParser:
|
|||||||
|
|
||||||
for f in child.get_parent_family_handle_list():
|
for f in child.get_parent_family_handle_list():
|
||||||
if f[0] == self.family.get_handle():
|
if f[0] == self.family.get_handle():
|
||||||
|
child.change_parent_family_handle(self.family.get_handle(),
|
||||||
|
mrel, frel)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if mrel in rel_types and frel in reltypes:
|
if mrel in rel_types and frel in reltypes:
|
||||||
@ -826,8 +836,7 @@ class GedcomParser:
|
|||||||
else:
|
else:
|
||||||
if child.get_main_parents_family_handle() == self.family:
|
if child.get_main_parents_family_handle() == self.family:
|
||||||
child.set_main_parent_family_handle(None)
|
child.set_main_parent_family_handle(None)
|
||||||
child.add_parent_family_handle(self.family.get_handle(),mrel,frel)
|
self.db.commit_person(child, self.trans)
|
||||||
self.db.commit_person(child, self.trans)
|
|
||||||
elif matches[1] == "NCHI":
|
elif matches[1] == "NCHI":
|
||||||
a = RelLib.Attribute()
|
a = RelLib.Attribute()
|
||||||
a.set_type("Number of Children")
|
a.set_type("Number of Children")
|
||||||
@ -974,10 +983,9 @@ class GedcomParser:
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if ftype in rel_types:
|
if ftype in rel_types:
|
||||||
if self.person.get_main_parents_family_handle() == None:
|
self.person.add_parent_family_handle(handle,
|
||||||
self.person.set_main_parent_family_handle(handle)
|
RelLib.Person.CHILD_REL_BIRTH,
|
||||||
else:
|
RelLib.Person.CHILD_REL_BIRTH)
|
||||||
self.person.add_parent_family_handle(handle,RelLib.Person.CHILD_REL_UNKWN,RelLib.Person.CHILD_REL_UNKWN)
|
|
||||||
else:
|
else:
|
||||||
if self.person.get_main_parents_family_handle() == handle:
|
if self.person.get_main_parents_family_handle() == handle:
|
||||||
self.person.set_main_parent_family_handle(None)
|
self.person.set_main_parent_family_handle(None)
|
||||||
@ -1098,16 +1106,16 @@ class GedcomParser:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def parse_famc_type(self,level):
|
def parse_famc_type(self,level):
|
||||||
ftype = ""
|
ftype = RelLib.Person.CHILD_REL_BIRTH
|
||||||
note = ""
|
note = ""
|
||||||
while 1:
|
while 1:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
|
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return (ftype.capitalize(),note)
|
return (ftype,note)
|
||||||
elif matches[1] == "PEDI":
|
elif matches[1] == "PEDI":
|
||||||
ftype = matches[2]
|
ftype = pedi_type.get(matches[2],RelLib.Person.UNKNOWN)
|
||||||
elif matches[1] == "SOUR":
|
elif matches[1] == "SOUR":
|
||||||
source_ref = self.handle_source(matches,level+1)
|
source_ref = self.handle_source(matches,level+1)
|
||||||
self.person.get_primary_name().add_source_reference(source_ref)
|
self.person.get_primary_name().add_source_reference(source_ref)
|
||||||
|
@ -562,8 +562,10 @@ class GrampsParser:
|
|||||||
if use_trans:
|
if use_trans:
|
||||||
self.db.transaction_commit(self.trans,_("GRAMPS XML import"))
|
self.db.transaction_commit(self.trans,_("GRAMPS XML import"))
|
||||||
else:
|
else:
|
||||||
self.db.run_person_rebuild_callbacks()
|
self.db.emit('person-rebuild')
|
||||||
self.db.run_family_rebuild_callbacks()
|
self.db.emit('family-rebuild')
|
||||||
|
self.db.emit('place-rebuild')
|
||||||
|
self.db.emit('source-rebuild')
|
||||||
|
|
||||||
def start_lds_ord(self,attrs):
|
def start_lds_ord(self,attrs):
|
||||||
atype = attrs['type']
|
atype = attrs['type']
|
||||||
|
@ -432,7 +432,7 @@ class SourceEditor:
|
|||||||
self.sourceDisplay.show()
|
self.sourceDisplay.show()
|
||||||
|
|
||||||
def rebuild_menu(self,handle_list):
|
def rebuild_menu(self,handle_list):
|
||||||
self.build_source_menu()
|
self.build_source_menu(handle_list[0])
|
||||||
|
|
||||||
def on_delete_event(self,obj,b):
|
def on_delete_event(self,obj,b):
|
||||||
self.close_child_windows()
|
self.close_child_windows()
|
||||||
@ -510,9 +510,12 @@ class SourceEditor:
|
|||||||
self.author_field.set_text("")
|
self.author_field.set_text("")
|
||||||
self.pub_field.set_text("")
|
self.pub_field.set_text("")
|
||||||
self.active_source = sel
|
self.active_source = sel
|
||||||
self.build_source_menu()
|
if sel:
|
||||||
|
self.build_source_menu(sel.get_handle())
|
||||||
|
else:
|
||||||
|
self.build_source_menu(None)
|
||||||
|
|
||||||
def build_source_menu(self):
|
def build_source_menu(self,selected_handle):
|
||||||
keys = self.db.get_source_handles()
|
keys = self.db.get_source_handles()
|
||||||
keys.sort(self.db._sortbysource)
|
keys.sort(self.db._sortbysource)
|
||||||
|
|
||||||
@ -526,10 +529,9 @@ class SourceEditor:
|
|||||||
src = self.db.get_source_from_handle(src_id)
|
src = self.db.get_source_from_handle(src_id)
|
||||||
title = src.get_title()
|
title = src.get_title()
|
||||||
gid = src.get_gramps_id()
|
gid = src.get_gramps_id()
|
||||||
handle = src.get_handle()
|
|
||||||
store.append(row=["%s [%s]" % (title,gid)])
|
store.append(row=["%s [%s]" % (title,gid)])
|
||||||
self.handle_list.append(handle)
|
self.handle_list.append(src_id)
|
||||||
if self.active_source and self.active_source.get_handle() == src_id:
|
if selected_handle == src_id:
|
||||||
sel_index = index
|
sel_index = index
|
||||||
index += 1
|
index += 1
|
||||||
self.title_menu.set_model(store)
|
self.title_menu.set_model(store)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user