* src/gramps_main.py (undo): Rebuild bookmarks menu on undo.

* src/plugins/ChangeNames.py: Add ProgressMeter.
* src/plugins/ChangeTypes.;y: Add ProgressMeter.
* src/plugins/Check.py: Mark translatable string.
* src/plugins/EventCmp.py: Add ProgressMeter.
* src/plugins/PatchNames.py: Add ProgressMeter.


svn: r5010
This commit is contained in:
Alex Roitman 2005-08-03 22:17:10 +00:00
parent 1cc16595a9
commit 5eb6e7c97e
7 changed files with 68 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2005-08-03 Alex Roitman <shura@gramps-project.org>
* src/gramps_main.py (undo): Rebuild bookmarks menu on undo.
* src/plugins/ChangeNames.py: Add ProgressMeter.
* src/plugins/ChangeTypes.;y: Add ProgressMeter.
* src/plugins/Check.py: Mark translatable string.
* src/plugins/EventCmp.py: Add ProgressMeter.
* src/plugins/PatchNames.py: Add ProgressMeter.
2005-08-03 Don Allingham <don@gramps-project.org> 2005-08-03 Don Allingham <don@gramps-project.org>
* src/GrampsDbBase.py: provide functions for indicating the number * src/GrampsDbBase.py: provide functions for indicating the number
of items in each table of items in each table

View File

@ -204,6 +204,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.db.set_researcher(GrampsCfg.get_researcher()) self.db.set_researcher(GrampsCfg.get_researcher())
self.db.connect('person-delete',self.on_remove_bookmark) self.db.connect('person-delete',self.on_remove_bookmark)
self.db.connect('person-update',self.on_update_bookmark)
def welcome(self): def welcome(self):
if GrampsKeys.get_welcome() >= 200: if GrampsKeys.get_welcome() >= 200:
@ -560,6 +561,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.db.undo() self.db.undo()
self.db.enable_signals() self.db.enable_signals()
self.db.request_rebuild() self.db.request_rebuild()
self.bookmarks.redraw()
if self.active_person: if self.active_person:
p = self.db.get_person_from_handle(self.active_person.get_handle()) p = self.db.get_person_from_handle(self.active_person.get_handle())
self.change_active_person(p) self.change_active_person(p)
@ -1879,6 +1881,15 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
""" """
self.bookmarks.remove_people(handle_list) self.bookmarks.remove_people(handle_list)
def on_update_bookmark(self,handle_list):
"""
Callback to update the labels on the Bookmark menu,
in case name was changed on the bookmarked people.
"""
if [handle for handle in handle_list
if handle in self.bookmarks.bookmarks]:
self.bookmarks.redraw()
def on_edit_bookmarks_activate(self,obj): def on_edit_bookmarks_activate(self,obj):
self.bookmarks.edit() self.bookmarks.edit()

View File

@ -79,14 +79,20 @@ class ChangeNames:
return return
self.win_key = self.__class__ self.win_key = self.__class__
self.name_list = [] self.name_list = []
self.progress = Utils.ProgressMeter(_('Checking family names'),'')
self.progress.set_pass(_('Searching family names'),
len(self.db.get_surname_list()))
for name in self.db.get_surname_list(): for name in self.db.get_surname_list():
if name != name.capitalize(): if name != name.capitalize():
self.name_list.append(name) self.name_list.append(name)
self.progress.step()
if self.name_list: if self.name_list:
self.display() self.display()
else: else:
self.progress.close()
OkDialog(_('No modifications made'), OkDialog(_('No modifications made'),
_("No capitalization changes were detected.")) _("No capitalization changes were detected."))
@ -126,12 +132,15 @@ class ChangeNames:
self.list.set_model(self.model) self.list.set_model(self.model)
self.iter_list = [] self.iter_list = []
self.progress.set_pass(_('Building display'),len(self.name_list))
for name in self.name_list: for name in self.name_list:
handle = self.model.append() handle = self.model.append()
self.model.set_value(handle,0,1) self.model.set_value(handle,0,1)
self.model.set_value(handle,1,name) self.model.set_value(handle,1,name)
self.model.set_value(handle,2,name.capitalize()) self.model.set_value(handle,2,name.capitalize())
self.iter_list.append(handle) self.iter_list.append(handle)
self.progress.step()
self.progress.close()
self.add_itself_to_menu() self.add_itself_to_menu()
self.window.show() self.window.show()
@ -186,6 +195,7 @@ class ChangeNames:
self.db.transaction_commit(self.trans,_("Capitalization changes")) self.db.transaction_commit(self.trans,_("Capitalization changes"))
self.db.enable_signals() self.db.enable_signals()
self.db.request_rebuild() self.db.request_rebuild()
self.parent.bookmarks.redraw()
self.close(obj) self.close(obj)
self.cb(None,1) self.cb(None,1)

View File

@ -128,6 +128,8 @@ class ChangeTypes:
original = unicode(self.auto1.child.get_text()) original = unicode(self.auto1.child.get_text())
new = unicode(self.auto2.child.get_text()) new = unicode(self.auto2.child.get_text())
progress = Utils.ProgressMeter(_('Analyzing events'),'')
progress.set_pass('',self.db.get_number_of_people())
for person_handle in self.db.get_person_handles(sort_handles=False): for person_handle in self.db.get_person_handles(sort_handles=False):
person = self.db.get_person_from_handle(person_handle) person = self.db.get_person_from_handle(person_handle)
for event_handle in person.get_event_list(): for event_handle in person.get_event_list():
@ -138,13 +140,15 @@ class ChangeTypes:
event.set_name(new) event.set_name(new)
modified = modified + 1 modified = modified + 1
self.db.commit_event(event,self.trans) self.db.commit_event(event,self.trans)
progress.step()
progress.close()
if modified == 1: if modified == 1:
msg = _("1 event record was modified") msg = _("1 event record was modified")
else: else:
msg = _("%d event records were modified") % modified msg = _("%d event records were modified") % modified
OkDialog(_('Change types'),msg,self.parent) OkDialog(_('Change types'),msg,self.parent.topWindow)
self.db.transaction_commit(self.trans,_('Change types')) self.db.transaction_commit(self.trans,_('Change types'))
self.close(None) self.close(None)

View File

@ -120,7 +120,7 @@ class CheckIntegrity:
self.invalid_death_events = [] self.invalid_death_events = []
self.invalid_place_references = [] self.invalid_place_references = []
self.invalid_source_references = [] self.invalid_source_references = []
self.progress = Utils.ProgressMeter('Checking database','') self.progress = Utils.ProgressMeter(_('Checking database'),'')
def family_errors(self): def family_errors(self):
return len(self.broken_parent_links) + len(self.broken_links) + len(self.empty_family) + len(self.duplicate_links) return len(self.broken_parent_links) + len(self.broken_links) + len(self.empty_family) + len(self.duplicate_links)

View File

@ -200,7 +200,13 @@ class EventComparison:
def on_apply_clicked(self,obj): def on_apply_clicked(self,obj):
cfilter = self.filter_menu.get_active().get_data("filter") cfilter = self.filter_menu.get_active().get_data("filter")
plist = cfilter.apply(self.db,self.db.get_person_handles(sort_handles=False)) progress_bar = Utils.ProgressMeter(_('Comparing events'),'')
progress_bar.set_pass(_('Selecting people'),1)
plist = cfilter.apply(self.db,
self.db.get_person_handles(sort_handles=False))
progress_bar.step()
progress_bar.close()
if len(plist) == 0: if len(plist) == 0:
WarningDialog(_("No matches were found")) WarningDialog(_("No matches were found"))
@ -311,10 +317,17 @@ class DisplayChart:
index = index + 1 index = index + 1
self.list = ListModel.ListModel(self.eventlist,titles) self.list = ListModel.ListModel(self.eventlist,titles)
self.progress_bar.set_pass(_('Building display'),len(self.row_data))
for data in self.row_data: for data in self.row_data:
self.list.add(data) self.list.add(data)
self.progress_bar.step()
self.progress_bar.close()
def build_row_data(self): def build_row_data(self):
self.progress_bar = Utils.ProgressMeter(_('Comparing events'),'')
self.progress_bar.set_pass(_('Building data'),
self.db.get_number_of_people())
for individual_id in self.my_list: for individual_id in self.my_list:
individual = self.db.get_person_from_handle(individual_id) individual = self.db.get_person_from_handle(individual_id)
name = individual.get_primary_name().get_name() name = individual.get_primary_name().get_name()
@ -381,6 +394,7 @@ class DisplayChart:
done = 1 done = 1
else: else:
self.row_data.append(tlist) self.row_data.append(tlist)
self.progress_bar.step()
def make_event_titles(self): def make_event_titles(self):
"""Creates the list of unique event types, along with the person's """Creates the list of unique event types, along with the person's

View File

@ -103,6 +103,11 @@ class PatchNames:
self.prefix1_list = [] self.prefix1_list = []
self.prefix2_list = [] self.prefix2_list = []
self.progress = Utils.ProgressMeter(
_('Extracting information from names'),'')
self.progress.set_pass(_('Analyzing names'),
self.db.get_number_of_people())
for key in self.db.get_person_handles(sort_handles=False): for key in self.db.get_person_handles(sort_handles=False):
person = self.db.get_person_from_handle(key) person = self.db.get_person_from_handle(key)
@ -139,10 +144,12 @@ class PatchNames:
if match: if match:
groups = match.groups() groups = match.groups()
self.prefix2_list.append((key,groups[1],groups[0])) self.prefix2_list.append((key,groups[1],groups[0]))
self.progress.step()
if self.nick_list or self.title_list or self.prefix1_list or self.prefix2_list: if self.nick_list or self.title_list or self.prefix1_list or self.prefix2_list:
self.display() self.display()
else: else:
self.progress.close()
OkDialog(_('No modifications made'), OkDialog(_('No modifications made'),
_("No titles or nicknames were found")) _("No titles or nicknames were found"))
@ -198,6 +205,10 @@ class PatchNames:
self.prefix1_hash = {} self.prefix1_hash = {}
self.prefix2_hash = {} self.prefix2_hash = {}
self.progress.set_pass(_('Bulding display'),
len(self.nick_list)+len(self.title_list)
+len(self.prefix1_list)+len(self.prefix2_list))
for (id,name,nick) in self.nick_list: for (id,name,nick) in self.nick_list:
p = self.db.get_person_from_handle(id) p = self.db.get_person_from_handle(id)
gid = p.get_gramps_id() gid = p.get_gramps_id()
@ -208,6 +219,7 @@ class PatchNames:
self.model.set_value(handle,3,nick) self.model.set_value(handle,3,nick)
self.model.set_value(handle,4,p.get_primary_name().get_name()) self.model.set_value(handle,4,p.get_primary_name().get_name())
self.nick_hash[id] = handle self.nick_hash[id] = handle
self.progress.step()
for (id,title,nick) in self.title_list: for (id,title,nick) in self.title_list:
p = self.db.get_person_from_handle(id) p = self.db.get_person_from_handle(id)
@ -219,6 +231,7 @@ class PatchNames:
self.model.set_value(handle,3,nick) self.model.set_value(handle,3,nick)
self.model.set_value(handle,4,p.get_primary_name().get_name()) self.model.set_value(handle,4,p.get_primary_name().get_name())
self.title_hash[id] = handle self.title_hash[id] = handle
self.progress.step()
for (id,prefix,fname) in self.prefix1_list: for (id,prefix,fname) in self.prefix1_list:
p = self.db.get_person_from_handle(id) p = self.db.get_person_from_handle(id)
@ -230,6 +243,7 @@ class PatchNames:
self.model.set_value(handle,3,fname) self.model.set_value(handle,3,fname)
self.model.set_value(handle,4,p.get_primary_name().get_name()) self.model.set_value(handle,4,p.get_primary_name().get_name())
self.prefix1_hash[id] = handle self.prefix1_hash[id] = handle
self.progress.step()
for (id,prefix,fname) in self.prefix2_list: for (id,prefix,fname) in self.prefix2_list:
p = self.db.get_person_from_handle(id) p = self.db.get_person_from_handle(id)
@ -241,7 +255,9 @@ class PatchNames:
self.model.set_value(handle,3,fname) self.model.set_value(handle,3,fname)
self.model.set_value(handle,4,p.get_primary_name().get_name()) self.model.set_value(handle,4,p.get_primary_name().get_name())
self.prefix2_hash[id] = handle self.prefix2_hash[id] = handle
self.progress.step()
self.progress.close()
self.add_itself_to_menu() self.add_itself_to_menu()
self.window.show() self.window.show()