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
3451ed3e5e
commit
37b246608a
13
ChangeLog
13
ChangeLog
@ -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>
|
||||
* src/docgen/ODFDoc.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)
|
||||
self.db = db
|
||||
self.sref_list = sref_list
|
||||
self.idle = 0
|
||||
self.count = 0
|
||||
self.idle = gobject.idle_add(self.load_model().next)
|
||||
|
||||
|
@ -45,8 +45,8 @@ from _EventType import EventType
|
||||
# Event class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Event(PrimaryObject, SourceBase, NoteBase, MediaBase, AttributeBase,
|
||||
DateBase, PlaceBase):
|
||||
class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
|
||||
DateBase, PlaceBase, PrimaryObject):
|
||||
"""
|
||||
Introduction
|
||||
============
|
||||
|
@ -53,8 +53,8 @@ from _FamilyRelType import FamilyRelType
|
||||
# Family class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Family(PrimaryObject, SourceBase, NoteBase, MediaBase, AttributeBase,
|
||||
LdsOrdBase):
|
||||
class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
PrimaryObject):
|
||||
"""
|
||||
Introduction
|
||||
============
|
||||
|
@ -49,7 +49,7 @@ from _AttributeBase import AttributeBase
|
||||
# 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,
|
||||
description and privacy
|
||||
|
@ -50,8 +50,8 @@ from _EventRoleType import EventRoleType
|
||||
# Person class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Person(PrimaryObject, SourceBase, NoteBase, MediaBase,
|
||||
AttributeBase, AddressBase, UrlBase, LdsOrdBase):
|
||||
class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
AddressBase, UrlBase, LdsOrdBase, PrimaryObject):
|
||||
"""
|
||||
Introduction
|
||||
============
|
||||
|
@ -45,7 +45,7 @@ _EMPTY_LOC = Location().serialize()
|
||||
# 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
|
||||
information (since place names can change with time), longitude, latitude,
|
||||
|
@ -42,7 +42,7 @@ from _RepositoryType import RepositoryType
|
||||
# Repository class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Repository(PrimaryObject, NoteBase, AddressBase, UrlBase):
|
||||
class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
|
||||
"""A location where collections of Sources are found"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -42,7 +42,7 @@ from _RepoRef import RepoRef
|
||||
# Source class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Source(PrimaryObject, MediaBase, NoteBase):
|
||||
class Source(MediaBase, NoteBase, PrimaryObject):
|
||||
"""A record of a source of information"""
|
||||
|
||||
def __init__(self):
|
||||
@ -85,6 +85,54 @@ class Source(PrimaryObject, MediaBase, NoteBase):
|
||||
MediaBase.unserialize(self, media_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):
|
||||
"""
|
||||
Returns the list of all textual attributes of the object.
|
||||
|
Loading…
Reference in New Issue
Block a user