2007-08-29 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_GrampsDBDir.py: fast unserialize() * src/Editors/_EditPerson.py: fast unserialize() * src/RelLib/_SourceBase.py: fast unserialize() * src/RelLib/_Source.py: fast unserialize() * src/RelLib/_MediaObject.py: fast unserialize() * src/RelLib/_Person.py: fast unserialize() * src/RelLib/_DateBase.py: fast unserialize() * src/RelLib/_ChildRef.py: fast unserialize() * src/RelLib/_Name.py: fast unserialize() * src/RelLib/_Family.py: fast unserialize() * src/RelLib/_Place.py: fast unserialize() * src/RelLib/_RepoRef.py: fast unserialize() * src/RelLib/_Note.py: fast unserialize() * src/RelLib/_EventRef.py: fast unserialize() * src/RelLib/_Repository.py: fast unserialize() * src/RelLib/_Event.py: fast unserialize() * src/Utils.py: all callgraph to profile svn: r8890
This commit is contained in:
parent
9ce50cee93
commit
5588a61f03
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
2007-08-29 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsDb/_GrampsDBDir.py: fast unserialize()
|
||||
* src/Editors/_EditPerson.py: fast unserialize()
|
||||
* src/RelLib/_SourceBase.py: fast unserialize()
|
||||
* src/RelLib/_Source.py: fast unserialize()
|
||||
* src/RelLib/_MediaObject.py: fast unserialize()
|
||||
* src/RelLib/_Person.py: fast unserialize()
|
||||
* src/RelLib/_DateBase.py: fast unserialize()
|
||||
* src/RelLib/_ChildRef.py: fast unserialize()
|
||||
* src/RelLib/_Name.py: fast unserialize()
|
||||
* src/RelLib/_Family.py: fast unserialize()
|
||||
* src/RelLib/_Place.py: fast unserialize()
|
||||
* src/RelLib/_RepoRef.py: fast unserialize()
|
||||
* src/RelLib/_Note.py: fast unserialize()
|
||||
* src/RelLib/_EventRef.py: fast unserialize()
|
||||
* src/RelLib/_Repository.py: fast unserialize()
|
||||
* src/RelLib/_Event.py: fast unserialize()
|
||||
* src/Utils.py: all callgraph to profile
|
||||
|
||||
2007-08-29 Benny Malengier <benny.malengier@gramps-project.org>
|
||||
* src/ReportBase/_Constants.py: quick reports constants
|
||||
* src/PluginUtils/__init__.py : add quick reports
|
||||
|
@ -92,6 +92,7 @@ class EditPerson(EditPrimary):
|
||||
"""
|
||||
Creates an EditPerson window. Associates a person with the window.
|
||||
"""
|
||||
print person, person.serialize()
|
||||
EditPrimary.__init__(self, state, uistate, track, person,
|
||||
state.db.get_person_from_handle, callback)
|
||||
|
||||
|
@ -34,6 +34,7 @@ import os
|
||||
import shutil
|
||||
import re
|
||||
import time
|
||||
import new
|
||||
|
||||
from gettext import gettext as _
|
||||
from bsddb import dbshelve, db
|
||||
@ -1094,7 +1095,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
||||
class_func = primary_tables[primary_table_name]['class_func']
|
||||
while data:
|
||||
found_handle,val = data
|
||||
obj = class_func()
|
||||
obj = new.instance(class_func,None)
|
||||
obj.unserialize(val)
|
||||
|
||||
if self.UseTXN:
|
||||
@ -1529,7 +1530,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
||||
if data_map:
|
||||
log.error("Failed to get from handle",exc_info=True)
|
||||
if data:
|
||||
newobj = class_type()
|
||||
newobj = new.instance(class_type, None)
|
||||
newobj.unserialize(data)
|
||||
return newobj
|
||||
return None
|
||||
|
@ -26,6 +26,8 @@ Child Reference class for GRAMPS.
|
||||
|
||||
__revision__ = "$Revision$"
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -84,7 +86,9 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
|
||||
SourceBase.unserialize(self, source_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
RefBase.unserialize(self, ref)
|
||||
self.frel = new.instance(ChildRefType,None)
|
||||
self.frel.unserialize(frel)
|
||||
self.mrel = new.instance(ChildRefType,None)
|
||||
self.mrel.unserialize(mrel)
|
||||
return self
|
||||
|
||||
|
@ -26,6 +26,8 @@ DateBase class for GRAMPS
|
||||
|
||||
__revision__ = "$Revision$"
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -72,7 +74,8 @@ class DateBase:
|
||||
if data == None:
|
||||
self.date = Date()
|
||||
else:
|
||||
self.date = Date().unserialize(data)
|
||||
self.date = new.instance(Date,None)
|
||||
self.date.unserialize(data)
|
||||
|
||||
def get_date_object(self):
|
||||
"""
|
||||
|
@ -39,6 +39,9 @@ from _AttributeBase import AttributeBase
|
||||
from _DateBase import DateBase
|
||||
from _PlaceBase import PlaceBase
|
||||
from _EventType import EventType
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -117,7 +120,9 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
|
||||
source_list, note_list, media_list, attribute_list,
|
||||
self.change, marker, self.private) = data
|
||||
|
||||
self.marker = new.instance(MarkerType, None)
|
||||
self.marker.unserialize(marker)
|
||||
self.type = new.instance(EventType,None)
|
||||
self.type.unserialize(the_type)
|
||||
DateBase.unserialize(self, date)
|
||||
MediaBase.unserialize(self, media_list)
|
||||
|
@ -26,6 +26,8 @@ Event Reference class for GRAMPS
|
||||
|
||||
__revision__ = "$Revision$"
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -85,6 +87,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
|
||||
NoteBase.unserialize(self, note_list)
|
||||
AttributeBase.unserialize(self, attribute_list)
|
||||
RefBase.unserialize(self, ref)
|
||||
self.role = new.instance(EventRoleType,None)
|
||||
self.role.unserialize(role)
|
||||
return self
|
||||
|
||||
|
@ -32,6 +32,7 @@ __revision__ = "$Revision$"
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from warnings import warn
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -47,6 +48,7 @@ from _EventRef import EventRef
|
||||
from _LdsOrdBase import LdsOrdBase
|
||||
from _ChildRef import ChildRef
|
||||
from _FamilyRelType import FamilyRelType
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -133,11 +135,13 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
|
||||
attribute_list, lds_seal_list, source_list, note_list,
|
||||
self.change, marker, self.private) = data
|
||||
|
||||
self.marker = new.instance(MarkerType, None)
|
||||
self.marker.unserialize(marker)
|
||||
self.type = new.instance(FamilyRelType, None)
|
||||
self.type.unserialize(the_type)
|
||||
self.event_ref_list = [EventRef().unserialize(er)
|
||||
self.event_ref_list = [new.instance(EventRef,None).unserialize(er)
|
||||
for er in event_ref_list]
|
||||
self.child_ref_list = [ChildRef().unserialize(cr)
|
||||
self.child_ref_list = [new.instance(ChildRef,None).unserialize(cr)
|
||||
for cr in child_ref_list]
|
||||
MediaBase.unserialize(self, media_list)
|
||||
AttributeBase.unserialize(self, attribute_list)
|
||||
|
@ -32,6 +32,7 @@ __revision__ = "$Revision$"
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -43,6 +44,7 @@ from _SourceBase import SourceBase
|
||||
from _NoteBase import NoteBase
|
||||
from _DateBase import DateBase
|
||||
from _AttributeBase import AttributeBase
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -117,7 +119,7 @@ class MediaObject(SourceBase,NoteBase,DateBase,AttributeBase,PrimaryObject):
|
||||
attribute_list, source_list, note_list, self.change,
|
||||
date, marker, self.private) = data
|
||||
|
||||
self.marker.unserialize(marker)
|
||||
self.marker = new.instance(MarkerType, None).unserialize(marker)
|
||||
AttributeBase.unserialize(self, attribute_list)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
|
@ -125,7 +125,7 @@ class Name(SecondaryObject, PrivacyBase, SourceBase, NoteBase, DateBase):
|
||||
self.first_name, self.surname, self.suffix, self.title,
|
||||
name_type, self.prefix, self.patronymic,
|
||||
self.group_as, self.sort_as, self.display_as, self.call) = data
|
||||
self.type.unserialize(name_type)
|
||||
self.type = NameType(name_type)
|
||||
PrivacyBase.unserialize(self, privacy)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
|
@ -32,6 +32,7 @@ __revision__ = "$Revision$"
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import re
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -41,6 +42,7 @@ import re
|
||||
from _BasicPrimaryObject import BasicPrimaryObject
|
||||
from _NoteType import NoteType
|
||||
from MarkupText import ROOT_START_TAG, LEN_ROOT_START_TAG
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -83,7 +85,9 @@ class Note(BasicPrimaryObject):
|
||||
(self.handle, self.gramps_id, self.text, self.format,
|
||||
the_type, self.change, the_marker, self.private) = data
|
||||
|
||||
self.marker = new.instance(MarkerType, None)
|
||||
self.marker.unserialize(the_marker)
|
||||
self.type = new.instance(NoteType, None)
|
||||
self.type.unserialize(the_type)
|
||||
|
||||
def get_text_data_list(self):
|
||||
|
@ -26,6 +26,8 @@ Person object for GRAMPS
|
||||
|
||||
__revision__ = "$Revision$"
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -44,6 +46,7 @@ from _EventRef import EventRef
|
||||
from _PersonRef import PersonRef
|
||||
from _AttributeType import AttributeType
|
||||
from _EventRoleType import EventRoleType
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -93,6 +96,7 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
UrlBase.__init__(self)
|
||||
LdsOrdBase.__init__(self)
|
||||
self.primary_name = Name()
|
||||
self.marker = MarkerType()
|
||||
self.event_ref_list = []
|
||||
self.family_list = []
|
||||
self.parent_family_list = []
|
||||
@ -180,13 +184,15 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
|
||||
person_ref_list, # 20
|
||||
) = data
|
||||
|
||||
self.marker = new.instance(MarkerType,None)
|
||||
self.marker.unserialize(marker)
|
||||
self.primary_name = new.instance(Name, None)
|
||||
self.primary_name.unserialize(primary_name)
|
||||
self.alternate_names = [Name().unserialize(name)
|
||||
self.alternate_names = [new.instance(Name, None).unserialize(name)
|
||||
for name in alternate_names]
|
||||
self.event_ref_list = [EventRef().unserialize(er)
|
||||
self.event_ref_list = [new.instance(EventRef, None).unserialize(er)
|
||||
for er in event_ref_list]
|
||||
self.person_ref_list = [PersonRef().unserialize(pr)
|
||||
self.person_ref_list = [new.instance(PersonRef, None).unserialize(pr)
|
||||
for pr in person_ref_list]
|
||||
MediaBase.unserialize(self, media_list)
|
||||
LdsOrdBase.unserialize(self, lds_ord_list)
|
||||
|
@ -26,6 +26,8 @@ Place object for GRAMPS
|
||||
|
||||
__revision__ = "$Revision$"
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -37,6 +39,7 @@ from _NoteBase import NoteBase
|
||||
from _MediaBase import MediaBase
|
||||
from _UrlBase import UrlBase
|
||||
from _Location import Location
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
_EMPTY_LOC = Location().serialize()
|
||||
|
||||
@ -123,9 +126,10 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
|
||||
if main_loc == None:
|
||||
self.main_loc = None
|
||||
else:
|
||||
self.main_loc = Location().unserialize(main_loc)
|
||||
self.alt_loc = [Location().unserialize(al) for al in alt_loc]
|
||||
self.marker.unserialize(marker)
|
||||
self.main_loc = new.instance(Location, None).unserialize(main_loc)
|
||||
self.alt_loc = [new.instance(Location, None).unserialize(al)
|
||||
for al in alt_loc]
|
||||
self.marker = new.instance(MarkerType, None).unserialize(marker)
|
||||
UrlBase.unserialize(self, urls)
|
||||
MediaBase.unserialize(self, media_list)
|
||||
SourceBase.unserialize(self, source_list)
|
||||
|
@ -26,6 +26,8 @@ Repository Reference class for GRAMPS
|
||||
|
||||
__revision__ = "$Revision$"
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -74,6 +76,7 @@ class RepoRef(SecondaryObject, PrivacyBase, NoteBase, RefBase):
|
||||
Converts a serialized tuple of data to an object
|
||||
"""
|
||||
(note_list, ref, self.call_number, media_type, privacy) = data
|
||||
self.media_type = new.instance(SourceMediaType, None)
|
||||
self.media_type.unserialize(media_type)
|
||||
PrivacyBase.unserialize(self, privacy)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
|
@ -26,6 +26,8 @@ Repository object for GRAMPS
|
||||
|
||||
__revision__ = "$Revision$"
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -36,6 +38,7 @@ from _NoteBase import NoteBase
|
||||
from _AddressBase import AddressBase
|
||||
from _UrlBase import UrlBase
|
||||
from _RepositoryType import RepositoryType
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -73,7 +76,9 @@ class Repository(NoteBase, AddressBase, UrlBase, PrimaryObject):
|
||||
(self.handle, self.gramps_id, the_type, self.name, note_list,
|
||||
address_list, urls, self.change, marker, self.private) = data
|
||||
|
||||
self.marker = new.instance(MarkerType, None)
|
||||
self.marker.unserialize(marker)
|
||||
self.type = new.instance(RepositoryType, None)
|
||||
self.type.unserialize(the_type)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
AddressBase.unserialize(self, address_list)
|
||||
|
@ -26,6 +26,8 @@ Source object for GRAMPS
|
||||
|
||||
__revision__ = "$Revision$"
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -35,6 +37,7 @@ from _PrimaryObject import PrimaryObject
|
||||
from _MediaBase import MediaBase
|
||||
from _NoteBase import NoteBase
|
||||
from _RepoRef import RepoRef
|
||||
from _MarkerType import MarkerType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -78,10 +81,11 @@ class Source(MediaBase, NoteBase, PrimaryObject):
|
||||
self.abbrev, self.change, self.datamap, reporef_list,
|
||||
marker, self.private) = data
|
||||
|
||||
self.marker.unserialize(marker)
|
||||
self.marker = new.instance(MarkerType, None).unserialize(marker)
|
||||
NoteBase.unserialize(self, note_list)
|
||||
MediaBase.unserialize(self, media_list)
|
||||
self.reporef_list = [RepoRef().unserialize(rr) for rr in reporef_list]
|
||||
self.reporef_list = [new.instance(RepoRef, None).unserialize(rr)
|
||||
for rr in reporef_list]
|
||||
|
||||
def _has_handle_reference(self, classname, handle):
|
||||
"""
|
||||
|
@ -26,6 +26,8 @@ SourceBase class for GRAMPS
|
||||
|
||||
__revision__ = "$Revision$"
|
||||
|
||||
import new
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
@ -65,7 +67,8 @@ class SourceBase:
|
||||
"""
|
||||
Converts a serialized tuple of data to an object
|
||||
"""
|
||||
self.source_list = [SourceRef().unserialize(item) for item in data]
|
||||
self.source_list = [new.instance(SourceRef, None).unserialize(item)
|
||||
for item in data]
|
||||
|
||||
def add_source_reference(self, src_ref) :
|
||||
"""
|
||||
|
@ -1028,4 +1028,5 @@ def profile(func,*args):
|
||||
stats.strip_dirs()
|
||||
stats.sort_stats('time','calls')
|
||||
stats.print_stats(100)
|
||||
stats.print_callers(100)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user