* src/ViewManger.py: progressbar callbacks
* src/GrampsDb/_GrampsBSDDB.py: progressbar callbacks * src/GrampsDb/_GrampsGEDDB.py: progressbar callbacks * src/GrampsDb/_ReadXML.py: progressbar callbacks * src/GrampsDb/_ReadGedcom.py: progressbar callbacks svn: r5783
This commit is contained in:
parent
d169d9c949
commit
572a8a5724
@ -1,3 +1,10 @@
|
|||||||
|
2006-01-17 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/ViewManger.py: progressbar callbacks
|
||||||
|
* src/GrampsDb/_GrampsBSDDB.py: progressbar callbacks
|
||||||
|
* src/GrampsDb/_GrampsGEDDB.py: progressbar callbacks
|
||||||
|
* src/GrampsDb/_ReadXML.py: progressbar callbacks
|
||||||
|
* src/GrampsDb/_ReadGedcom.py: progressbar callbacks
|
||||||
|
|
||||||
2006-01-17 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
2006-01-17 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
* src/GrampsDb/_GrampsBSDDB.py: make ref update optional
|
* src/GrampsDb/_GrampsBSDDB.py: make ref update optional
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
|
|
||||||
self.readonly = mode == "r"
|
self.readonly = mode == "r"
|
||||||
|
|
||||||
callback(0.25)
|
callback(12)
|
||||||
|
|
||||||
self.env = db.DBEnv()
|
self.env = db.DBEnv()
|
||||||
self.env.set_cachesize(0,0x2000000) # 2MB
|
self.env.set_cachesize(0,0x2000000) # 2MB
|
||||||
@ -269,6 +269,8 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
self.env.open(env_name,env_flags)
|
self.env.open(env_name,env_flags)
|
||||||
self.env.txn_checkpoint()
|
self.env.txn_checkpoint()
|
||||||
|
|
||||||
|
callback(25)
|
||||||
|
|
||||||
self.full_name = os.path.abspath(name)
|
self.full_name = os.path.abspath(name)
|
||||||
self.brief_name = os.path.basename(name)
|
self.brief_name = os.path.basename(name)
|
||||||
|
|
||||||
@ -282,6 +284,8 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
self.repository_map = self.open_table(self.full_name, "repository")
|
self.repository_map = self.open_table(self.full_name, "repository")
|
||||||
self.reference_map = self.open_table(self.full_name, "reference_map")
|
self.reference_map = self.open_table(self.full_name, "reference_map")
|
||||||
|
|
||||||
|
callback(37)
|
||||||
|
|
||||||
# index tables used just for speeding up searches
|
# index tables used just for speeding up searches
|
||||||
if self.readonly:
|
if self.readonly:
|
||||||
table_flags = db.DB_RDONLY
|
table_flags = db.DB_RDONLY
|
||||||
@ -333,7 +337,8 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
self.rid_trans.open(self.full_name, "ridtrans",
|
self.rid_trans.open(self.full_name, "ridtrans",
|
||||||
db.DB_HASH, flags=table_flags)
|
db.DB_HASH, flags=table_flags)
|
||||||
|
|
||||||
|
callback(50)
|
||||||
|
|
||||||
self.eventnames = db.DB(self.env)
|
self.eventnames = db.DB(self.env)
|
||||||
self.eventnames.set_flags(db.DB_DUP)
|
self.eventnames.set_flags(db.DB_DUP)
|
||||||
self.eventnames.open(self.full_name, "eventnames",
|
self.eventnames.open(self.full_name, "eventnames",
|
||||||
@ -356,6 +361,7 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
"reference_map_referenced_map",
|
"reference_map_referenced_map",
|
||||||
db.DB_BTREE, flags=table_flags)
|
db.DB_BTREE, flags=table_flags)
|
||||||
|
|
||||||
|
callback(62)
|
||||||
if not self.readonly:
|
if not self.readonly:
|
||||||
self.person_map.associate(self.surnames, find_surname, table_flags)
|
self.person_map.associate(self.surnames, find_surname, table_flags)
|
||||||
self.person_map.associate(self.id_trans, find_idmap, table_flags)
|
self.person_map.associate(self.id_trans, find_idmap, table_flags)
|
||||||
@ -377,14 +383,14 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
|
|
||||||
self.undodb = db.DB()
|
self.undodb = db.DB()
|
||||||
self.undodb.open(self.undolog, db.DB_RECNO, db.DB_CREATE)
|
self.undodb.open(self.undolog, db.DB_RECNO, db.DB_CREATE)
|
||||||
callback(0.5)
|
|
||||||
|
|
||||||
|
callback(75)
|
||||||
self.metadata = self.open_table(self.full_name, "meta", no_txn=True)
|
self.metadata = self.open_table(self.full_name, "meta", no_txn=True)
|
||||||
self.bookmarks = self.metadata.get('bookmarks')
|
self.bookmarks = self.metadata.get('bookmarks')
|
||||||
self.family_event_names = sets.Set(self.metadata.get('fevent_names',[]))
|
self.family_event_names = set(self.metadata.get('fevent_names',[]))
|
||||||
self.individual_event_names = sets.Set(self.metadata.get('pevent_names',[]))
|
self.individual_event_names = set(self.metadata.get('pevent_names',[]))
|
||||||
self.family_attributes = sets.Set(self.metadata.get('fattr_names',[]))
|
self.family_attributes = set(self.metadata.get('fattr_names',[]))
|
||||||
self.individual_attributes = sets.Set(self.metadata.get('pattr_names',[]))
|
self.individual_attributes = set(self.metadata.get('pattr_names',[]))
|
||||||
|
|
||||||
gstats = self.metadata.get('gender_stats')
|
gstats = self.metadata.get('gender_stats')
|
||||||
|
|
||||||
@ -399,6 +405,7 @@ class GrampsBSDDB(GrampsDbBase):
|
|||||||
|
|
||||||
self.genderStats = GenderStats(gstats)
|
self.genderStats = GenderStats(gstats)
|
||||||
self.db_is_open = True
|
self.db_is_open = True
|
||||||
|
callback(87)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def rebuild_secondary(self,callback=None):
|
def rebuild_secondary(self,callback=None):
|
||||||
|
@ -48,7 +48,7 @@ class GrampsGEDDB(GrampsInMemDB):
|
|||||||
if self.db_is_open:
|
if self.db_is_open:
|
||||||
self.close()
|
self.close()
|
||||||
GrampsInMemDB.load(self,name,callback,mode)
|
GrampsInMemDB.load(self,name,callback,mode)
|
||||||
ReadGedcom.importData(self,name,use_trans=False)
|
ReadGedcom.importData(self,name,callback,use_trans=False)
|
||||||
|
|
||||||
self.bookmarks = self.metadata.get('bookmarks')
|
self.bookmarks = self.metadata.get('bookmarks')
|
||||||
if self.bookmarks == None:
|
if self.bookmarks == None:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -255,6 +255,7 @@ class GrampsParser:
|
|||||||
self.stext_list = []
|
self.stext_list = []
|
||||||
self.scomments_list = []
|
self.scomments_list = []
|
||||||
self.note_list = []
|
self.note_list = []
|
||||||
|
self.oldval = 0
|
||||||
self.tlist = []
|
self.tlist = []
|
||||||
self.conf = 2
|
self.conf = 2
|
||||||
self.gid2id = {}
|
self.gid2id = {}
|
||||||
@ -320,7 +321,6 @@ class GrampsParser:
|
|||||||
self.media_file_map = {}
|
self.media_file_map = {}
|
||||||
|
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
self.count = 0
|
|
||||||
self.increment = 100
|
self.increment = 100
|
||||||
self.event = None
|
self.event = None
|
||||||
self.name = None
|
self.name = None
|
||||||
@ -676,10 +676,8 @@ class GrampsParser:
|
|||||||
|
|
||||||
self.placeobj.set_title(title)
|
self.placeobj.set_title(title)
|
||||||
self.locations = 0
|
self.locations = 0
|
||||||
if self.callback != None and self.count % self.increment == 0:
|
|
||||||
if self.linecount:
|
self.update()
|
||||||
self.callback(float(self.p.CurrentLineNumber)/float(self.linecount))
|
|
||||||
self.count += 1
|
|
||||||
|
|
||||||
def start_location(self,attrs):
|
def start_location(self,attrs):
|
||||||
"""Bypass the function calls for this one, since it appears to
|
"""Bypass the function calls for this one, since it appears to
|
||||||
@ -788,10 +786,7 @@ class GrampsParser:
|
|||||||
self.db.bookmarks.append(person.get_handle())
|
self.db.bookmarks.append(person.get_handle())
|
||||||
|
|
||||||
def start_person(self,attrs):
|
def start_person(self,attrs):
|
||||||
if self.callback != None and self.count % self.increment == 0:
|
self.update()
|
||||||
if self.linecount:
|
|
||||||
self.callback(float(self.p.CurrentLineNumber)/float(self.linecount))
|
|
||||||
self.count += 1
|
|
||||||
new_id = self.map_gid(attrs['id'])
|
new_id = self.map_gid(attrs['id'])
|
||||||
try:
|
try:
|
||||||
self.person = self.db.find_person_from_handle(
|
self.person = self.db.find_person_from_handle(
|
||||||
@ -859,10 +854,7 @@ class GrampsParser:
|
|||||||
return
|
return
|
||||||
|
|
||||||
def start_family(self,attrs):
|
def start_family(self,attrs):
|
||||||
if self.callback != None and self.count % self.increment == 0:
|
self.update()
|
||||||
if self.linecount:
|
|
||||||
self.callback(float(self.p.CurrentLineNumber)/float(self.linecount))
|
|
||||||
self.count = self.count + 1
|
|
||||||
handle = self.map_fid(attrs["id"])
|
handle = self.map_fid(attrs["id"])
|
||||||
try:
|
try:
|
||||||
self.family = self.db.find_family_from_handle(
|
self.family = self.db.find_family_from_handle(
|
||||||
@ -987,10 +979,7 @@ class GrampsParser:
|
|||||||
self.person.add_source_reference(self.source_ref)
|
self.person.add_source_reference(self.source_ref)
|
||||||
|
|
||||||
def start_source(self,attrs):
|
def start_source(self,attrs):
|
||||||
if self.callback != None and self.count % self.increment == 0:
|
self.update()
|
||||||
if self.linecount:
|
|
||||||
self.callback(float(self.p.CurrentLineNumber)/float(self.linecount))
|
|
||||||
self.count += 1
|
|
||||||
handle = self.map_sid(attrs["id"])
|
handle = self.map_sid(attrs["id"])
|
||||||
try:
|
try:
|
||||||
self.source = self.db.find_source_from_handle(
|
self.source = self.db.find_source_from_handle(
|
||||||
@ -1044,8 +1033,7 @@ class GrampsParser:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def stop_database(self,*tag):
|
def stop_database(self,*tag):
|
||||||
if self.callback:
|
self.update()
|
||||||
self.callback(1.0)
|
|
||||||
|
|
||||||
def stop_object(self,*tag):
|
def stop_object(self,*tag):
|
||||||
self.db.commit_media_object(self.object,self.trans,self.change)
|
self.db.commit_media_object(self.object,self.trans,self.change)
|
||||||
@ -1589,7 +1577,6 @@ class GrampsParser:
|
|||||||
self.func = None
|
self.func = None
|
||||||
|
|
||||||
def endElement(self,tag):
|
def endElement(self,tag):
|
||||||
|
|
||||||
if self.func:
|
if self.func:
|
||||||
self.func(''.join(self.tlist))
|
self.func(''.join(self.tlist))
|
||||||
self.func_index = self.func_index - 1
|
self.func_index = self.func_index - 1
|
||||||
@ -1599,6 +1586,13 @@ class GrampsParser:
|
|||||||
if self.func:
|
if self.func:
|
||||||
self.tlist.append(data)
|
self.tlist.append(data)
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
line = self.p.CurrentLineNumber
|
||||||
|
newval = int(100*line/self.linecount)
|
||||||
|
if newval != self.oldval:
|
||||||
|
self.callback(newval)
|
||||||
|
self.oldval = newval
|
||||||
|
|
||||||
def append_value(orig,val):
|
def append_value(orig,val):
|
||||||
if orig:
|
if orig:
|
||||||
return "%s, %s" % (orig,val)
|
return "%s, %s" % (orig,val)
|
||||||
|
@ -855,7 +855,7 @@ class ViewManager:
|
|||||||
ScratchPad.ScratchPadWindow(self.state, self)
|
ScratchPad.ScratchPadWindow(self.state, self)
|
||||||
|
|
||||||
def pulse_progressbar(self,value):
|
def pulse_progressbar(self,value):
|
||||||
self.progress.set_fraction(value)
|
self.progress.set_fraction(value/100.0)
|
||||||
while gtk.events_pending():
|
while gtk.events_pending():
|
||||||
gtk.main_iteration()
|
gtk.main_iteration()
|
||||||
|
|
||||||
@ -933,16 +933,12 @@ class ViewManager:
|
|||||||
self.parent.import_tool_callback()
|
self.parent.import_tool_callback()
|
||||||
self.progress.hide()
|
self.progress.hide()
|
||||||
return True
|
return True
|
||||||
elif filetype == const.app_gramps_xml:
|
elif filetype == const.app_gramps_xml or filetype == const.app_gedcom:
|
||||||
choose.destroy()
|
choose.destroy()
|
||||||
self.progress.show()
|
self.progress.show()
|
||||||
GrampsDb.gramps_db_reader_factory(filetype)(self.state.db,filename,self.pulse_progressbar)
|
GrampsDb.gramps_db_reader_factory(filetype)(self.state.db,filename,self.pulse_progressbar)
|
||||||
self.progress.hide()
|
self.progress.hide()
|
||||||
return True
|
return True
|
||||||
elif filetype == const.app_gedcom:
|
|
||||||
choose.destroy()
|
|
||||||
GrampsDb.gramps_db_reader_factory(filetype)(self.state.db,filename)
|
|
||||||
return True
|
|
||||||
|
|
||||||
(the_path,the_file) = os.path.split(filename)
|
(the_path,the_file) = os.path.split(filename)
|
||||||
GrampsKeys.save_last_import_dir(the_path)
|
GrampsKeys.save_last_import_dir(the_path)
|
||||||
|
Loading…
Reference in New Issue
Block a user