2007-12-19 Benny Malengier <benny.malengier@gramps-project.org>

* src/gen/lib/person.py: sources in attributes of eventref are not seen
		 in ref tables
	* src/gen/lib/eventref.py: can contain sources, add methods for that
	* src/gen/lib/notebase.py: whitespace
	* src/plugins/Check.py: low level check of repo table, add check to 
		clean up referenced but not existing repos


svn: r9532
This commit is contained in:
Benny Malengier 2007-12-19 09:47:17 +00:00
parent 21b0612e84
commit 886e3299e4
4 changed files with 65 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2007-12-19 Benny Malengier <benny.malengier@gramps-project.org>
* src/gen/lib/person.py: sources in attributes of eventref are not seen
in ref tables
* src/gen/lib/eventref.py: can contain sources, add methods for that
* src/gen/lib/notebase.py: whitespace
* src/plugins/Check.py: low level check of repo table, add check to
clean up referenced but not existing repos
2007-12-18 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/Editors/_EditFamily.py: doubleclick now edits; fixed share popup
* src/DisplayTabs/_EmbeddedList.py: fixed share popup

View File

@ -107,7 +107,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
@return: Returns the list of child objects that may carry textual data.
@rtype: list
"""
return self.attribute_list[:]
return self.attribute_list
def get_sourcref_child_list(self):
"""
@ -116,7 +116,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
@return: Returns the list of child secondary child objects that may refer sources.
@rtype: list
"""
return self.attribute_list[:]
return self.attribute_list
def get_note_child_list(self):
"""
@ -125,7 +125,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
@return: Returns the list of child secondary child objects that may refer notes.
@rtype: list
"""
return self.attribute_list[:]
return self.attribute_list
def get_referenced_handles(self):
"""
@ -140,6 +140,56 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
ret += [('Event', self.ref)]
return ret
def get_handle_referents(self):
"""
Returns the list of child objects which may, directly or through
their children, reference primary objects..
@return: Returns the list of objects refereincing primary objects.
@rtype: list
"""
return self.get_sourcref_child_list()
def has_source_reference(self, src_handle) :
"""
Returns True if any of the child objects has reference
to this source handle.
@param src_handle: The source handle to be checked.
@type src_handle: str
@return: Returns whether any of it's child objects has reference to this source handle.
@rtype: bool
"""
for item in self.get_sourcref_child_list():
if item.has_source_reference(src_handle):
return True
return False
def remove_source_references(self, src_handle_list):
"""
Removes references to all source handles in the list
in all child objects.
@param src_handle_list: The list of source handles to be removed.
@type src_handle_list: list
"""
for item in self.get_sourcref_child_list():
item.remove_source_references(src_handle_list)
def replace_source_references(self, old_handle, new_handle):
"""
Replaces references to source handles in the list
in this object and all child objects.
@param old_handle: The source handle to be replaced.
@type old_handle: str
@param new_handle: The source handle to replace the old one with.
@type new_handle: str
"""
for item in self.get_sourcref_child_list():
item.replace_source_references(old_handle, new_handle)
def get_role(self):
"""
Returns the tuple corresponding to the preset role.

View File

@ -90,7 +90,6 @@ class NoteBase:
"""
if handle in self.note_list:
self.note_list.remove(handle)
for item in self.get_note_child_list():
item.remove_note(handle)

View File

@ -328,7 +328,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
return [self.primary_name] + self.media_list + \
self.alternate_names + self.address_list + \
self.attribute_list + self.lds_ord_list + \
self.person_ref_list
self.person_ref_list + self.event_ref_list
def get_note_child_list(self):
"""
@ -340,7 +340,8 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
return [self.primary_name] + self.media_list + \
self.alternate_names + self.address_list + \
self.attribute_list + self.lds_ord_list + \
self.person_ref_list + self.source_list
self.person_ref_list + self.source_list + \
self.event_ref_list
def get_referenced_handles(self):
"""
@ -363,8 +364,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
@rtype: list
"""
#don't count double, notes can be found in sourcref
return self.get_sourcref_child_list() + self.source_list \
+ self.event_ref_list
return self.get_sourcref_child_list() + self.source_list
def set_primary_name(self, name):
"""