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

* src/RelLib/_Repository.py: Repo has address which can have source, so
		backref of source to repo must be allowed and added!
	* src/DisplayTabs/_BackRefModel.py: Repo can be backref, add
	* src/DisplayTabs/_BackRefList.py: Repo can be backref, add



svn: r9505
This commit is contained in:
Benny Malengier 2007-12-14 14:06:18 +00:00
parent 0bad0de909
commit 65c99d23b5
4 changed files with 46 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2007-12-14 Benny Malengier <benny.malengier@gramps-project.org>
* src/RelLib/_Repository.py: Repo has address which can have source, so
backref of source to repo must be allowed and added!
* src/DisplayTabs/_BackRefModel.py: Repo can be backref, add
* src/DisplayTabs/_BackRefList.py: Repo can be backref, add
2007-12-11 Benny Malengier <benny.malengier@gramps-project.org> 2007-12-11 Benny Malengier <benny.malengier@gramps-project.org>
* src/plugins/IndivComplete.py: bug on buglist, wrong parameter * src/plugins/IndivComplete.py: bug on buglist, wrong parameter

View File

@ -160,3 +160,11 @@ class BackRefList(EmbeddedList):
EditEvent(self.dbstate, self.uistate, [], event) EditEvent(self.dbstate, self.uistate, [], event)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass
elif reftype == 'Repository':
try:
from Editors import EditRepository
repo = self.dbstate.db.get_repository_from_handle(ref)
EditRepository(self.dbstate, self.uistate, [], repo)
except Errors.WindowActiveError:
pass

View File

@ -87,6 +87,11 @@ class BackRefModel(gtk.ListStore):
name = p.get_title() name = p.get_title()
gid = p.gramps_id gid = p.gramps_id
handle = p.handle handle = p.handle
elif dtype == 'Repository':
p = self.db.get_repository_from_handle(ref[1])
name = p.get_name()
gid = p.gramps_id
handle = p.handle
else: else:
p = self.db.get_object_from_handle(ref[1]) p = self.db.get_object_from_handle(ref[1])
name = p.get_description() name = p.get_description()

View File

@ -100,6 +100,25 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
check_list.append(self.note) check_list.append(self.note)
return check_list return check_list
def get_sourcref_child_list(self):
"""
Returns the list of child secondary objects that may refer sources.
@return: Returns the list of child secondary child objects that may refer sources.
@rtype: list
"""
return self.address_list
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.address_list
def has_source_reference(self, src_handle) : def has_source_reference(self, src_handle) :
""" """
Returns True if any of the child objects has reference Returns True if any of the child objects has reference
@ -110,6 +129,10 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
@return: Returns whether any of it's child objects has reference to this source handle. @return: Returns whether any of it's child objects has reference to this source handle.
@rtype: bool @rtype: bool
""" """
for item in self.get_sourcref_child_list():
if item.has_source_reference(src_handle):
return True
return False return False
def remove_source_references(self, src_handle_list): def remove_source_references(self, src_handle_list):
@ -120,7 +143,8 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
@param src_handle_list: The list of source handles to be removed. @param src_handle_list: The list of source handles to be removed.
@type src_handle_list: list @type src_handle_list: list
""" """
pass for item in self.get_sourcref_child_list():
item.remove_source_references(src_handle_list)
def replace_source_references(self, old_handle, new_handle): def replace_source_references(self, old_handle, new_handle):
""" """
@ -132,7 +156,8 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
@param new_handle: The source handle to replace the old one with. @param new_handle: The source handle to replace the old one with.
@type new_handle: str @type new_handle: str
""" """
pass for item in self.get_sourcref_child_list():
item.replace_source_references(old_handle, new_handle)
def set_type(self, the_type): def set_type(self, the_type):
""" """