2007-01-24 Alex Roitman <shura@gramps-project.org>
* src/RelLib/_Event.py (Event): Change inheritance order. * src/RelLib/_Family.py (Family): Change inheritance order. * src/RelLib/_MediaObject.py (MediaObject): Change inheritance order. * src/RelLib/_Place.py (Place): Change inheritance order. * src/RelLib/_Repository.py (Repository): Change inheritance order. * src/RelLib/_Person.py (Person): Change inheritance order. * src/RelLib/_Source.py (Source): Change inheritance order. (_has_handle_reference, _remove_handle_references, _replace_handle_reference): Add methods to report correct repository references. * src/DisplayTabs/_BackRefModel.py (__init__): Remove extra statement. svn: r7979
This commit is contained in:
parent
12779769fa
commit
45bf6c0f23
@ -1,3 +1,16 @@
|
|||||||
|
2007-01-24 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/RelLib/_Event.py (Event): Change inheritance order.
|
||||||
|
* src/RelLib/_Family.py (Family): Change inheritance order.
|
||||||
|
* src/RelLib/_MediaObject.py (MediaObject): Change inheritance order.
|
||||||
|
* src/RelLib/_Place.py (Place): Change inheritance order.
|
||||||
|
* src/RelLib/_Repository.py (Repository): Change inheritance order.
|
||||||
|
* src/RelLib/_Person.py (Person): Change inheritance order.
|
||||||
|
* src/RelLib/_Source.py (Source): Change inheritance order.
|
||||||
|
(_has_handle_reference, _remove_handle_references,
|
||||||
|
_replace_handle_reference): Add methods to report correct
|
||||||
|
repository references.
|
||||||
|
* src/DisplayTabs/_BackRefModel.py (__init__): Remove extra statement.
|
||||||
|
|
||||||
2007-01-24 Brian Matherly <brian@gramps-project.org>
|
2007-01-24 Brian Matherly <brian@gramps-project.org>
|
||||||
* src/docgen/ODFDoc.py: Add "open with" option for book reports
|
* src/docgen/ODFDoc.py: Add "open with" option for book reports
|
||||||
* src/docgen/OpenOfficeDoc.py: Add "open with" option for book reports
|
* src/docgen/OpenOfficeDoc.py: Add "open with" option for book reports
|
||||||
|
@ -49,7 +49,6 @@ class BackRefModel(gtk.ListStore):
|
|||||||
gtk.ListStore.__init__(self, str, str, str, str, str)
|
gtk.ListStore.__init__(self, str, str, str, str, str)
|
||||||
self.db = db
|
self.db = db
|
||||||
self.sref_list = sref_list
|
self.sref_list = sref_list
|
||||||
self.idle = 0
|
|
||||||
self.count = 0
|
self.count = 0
|
||||||
self.idle = gobject.idle_add(self.load_model().next)
|
self.idle = gobject.idle_add(self.load_model().next)
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ from _EventType import EventType
|
|||||||
# Event class
|
# Event class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Event(PrimaryObject, SourceBase, NoteBase, MediaBase, AttributeBase,
|
class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
|
||||||
DateBase, PlaceBase):
|
DateBase, PlaceBase, PrimaryObject):
|
||||||
"""
|
"""
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
|
@ -53,8 +53,8 @@ from _FamilyRelType import FamilyRelType
|
|||||||
# Family class
|
# Family class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Family(PrimaryObject, SourceBase, NoteBase, MediaBase, AttributeBase,
|
class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||||
LdsOrdBase):
|
PrimaryObject):
|
||||||
"""
|
"""
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
|
@ -49,7 +49,7 @@ from _AttributeBase import AttributeBase
|
|||||||
# MediaObject class
|
# MediaObject class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class MediaObject(PrimaryObject, SourceBase, NoteBase, DateBase, AttributeBase):
|
class MediaObject(SourceBase,NoteBase,DateBase,AttributeBase,PrimaryObject):
|
||||||
"""
|
"""
|
||||||
Containter for information about an image file, including location,
|
Containter for information about an image file, including location,
|
||||||
description and privacy
|
description and privacy
|
||||||
|
@ -50,8 +50,8 @@ from _EventRoleType import EventRoleType
|
|||||||
# Person class
|
# Person class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Person(PrimaryObject, SourceBase, NoteBase, MediaBase,
|
class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||||
AttributeBase, AddressBase, UrlBase, LdsOrdBase):
|
AddressBase, UrlBase, LdsOrdBase, PrimaryObject):
|
||||||
"""
|
"""
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
|
@ -45,7 +45,7 @@ _EMPTY_LOC = Location().serialize()
|
|||||||
# Place class
|
# Place class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Place(PrimaryObject, SourceBase, NoteBase, MediaBase, UrlBase):
|
class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||||
"""
|
"""
|
||||||
Contains information related to a place, including multiple address
|
Contains information related to a place, including multiple address
|
||||||
information (since place names can change with time), longitude, latitude,
|
information (since place names can change with time), longitude, latitude,
|
||||||
|
@ -42,7 +42,7 @@ from _RepositoryType import RepositoryType
|
|||||||
# Repository class
|
# Repository class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Repository(PrimaryObject, NoteBase, AddressBase, UrlBase):
|
class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
|
||||||
"""A location where collections of Sources are found"""
|
"""A location where collections of Sources are found"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -42,7 +42,7 @@ from _RepoRef import RepoRef
|
|||||||
# Source class
|
# Source class
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class Source(PrimaryObject, MediaBase, NoteBase):
|
class Source(MediaBase, NoteBase, PrimaryObject):
|
||||||
"""A record of a source of information"""
|
"""A record of a source of information"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -85,6 +85,54 @@ class Source(PrimaryObject, MediaBase, NoteBase):
|
|||||||
MediaBase.unserialize(self, media_list)
|
MediaBase.unserialize(self, media_list)
|
||||||
self.reporef_list = [RepoRef().unserialize(rr) for rr in reporef_list]
|
self.reporef_list = [RepoRef().unserialize(rr) for rr in reporef_list]
|
||||||
|
|
||||||
|
def _has_handle_reference(self, classname, handle):
|
||||||
|
"""
|
||||||
|
Returns True if the object has reference to a given handle
|
||||||
|
of given primary object type.
|
||||||
|
|
||||||
|
@param classname: The name of the primary object class.
|
||||||
|
@type classname: str
|
||||||
|
@param handle: The handle to be checked.
|
||||||
|
@type handle: str
|
||||||
|
@return: Returns whether the object has reference to this handle of this object type.
|
||||||
|
@rtype: bool
|
||||||
|
"""
|
||||||
|
if classname == 'Repository':
|
||||||
|
return handle in [ref.ref for ref in self.reporef_list]
|
||||||
|
return False
|
||||||
|
|
||||||
|
def _remove_handle_references(self, classname, handle_list):
|
||||||
|
"""
|
||||||
|
Removes all references in this object to object handles in the list.
|
||||||
|
|
||||||
|
@param classname: The name of the primary object class.
|
||||||
|
@type classname: str
|
||||||
|
@param handle_list: The list of handles to be removed.
|
||||||
|
@type handle_list: str
|
||||||
|
"""
|
||||||
|
if classname == 'Repository':
|
||||||
|
new_list = [ ref for ref in self.reporef_list \
|
||||||
|
if ref.ref not in handle_list ]
|
||||||
|
self.reporef_list = new_list
|
||||||
|
|
||||||
|
def _replace_handle_reference(self, classname, old_handle, new_handle):
|
||||||
|
"""
|
||||||
|
Replaces all references to old handle with those to the new handle.
|
||||||
|
|
||||||
|
@param classname: The name of the primary object class.
|
||||||
|
@type classname: str
|
||||||
|
@param old_handle: The handle to be replaced.
|
||||||
|
@type old_handle: str
|
||||||
|
@param new_handle: The handle to replace the old one with.
|
||||||
|
@type new_handle: str
|
||||||
|
"""
|
||||||
|
if classname == 'Repository':
|
||||||
|
handle_list = [ref.ref for ref in self.reporef_list]
|
||||||
|
while old_handle in handle_list:
|
||||||
|
ix = handle_list.index(old_handle)
|
||||||
|
self.reporef_list[ix].ref = new_handle
|
||||||
|
handle_list[ix] = ''
|
||||||
|
|
||||||
def get_text_data_list(self):
|
def get_text_data_list(self):
|
||||||
"""
|
"""
|
||||||
Returns the list of all textual attributes of the object.
|
Returns the list of all textual attributes of the object.
|
||||||
|
Loading…
Reference in New Issue
Block a user