diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index c3fd45d96..4dc113d6f 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,11 @@ +2005-08-03 Alex Roitman + * 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 * src/GrampsDbBase.py: provide functions for indicating the number of items in each table diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 207c35ab1..4830a6ff6 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -204,6 +204,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback): self.db.set_researcher(GrampsCfg.get_researcher()) self.db.connect('person-delete',self.on_remove_bookmark) + self.db.connect('person-update',self.on_update_bookmark) def welcome(self): if GrampsKeys.get_welcome() >= 200: @@ -559,7 +560,8 @@ class Gramps(GrampsDBCallback.GrampsDBCallback): self.db.disable_signals() self.db.undo() self.db.enable_signals() - self.db.request_rebuild() + self.db.request_rebuild() + self.bookmarks.redraw() if self.active_person: p = self.db.get_person_from_handle(self.active_person.get_handle()) self.change_active_person(p) @@ -1879,6 +1881,15 @@ class Gramps(GrampsDBCallback.GrampsDBCallback): """ 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): self.bookmarks.edit() diff --git a/gramps2/src/plugins/ChangeNames.py b/gramps2/src/plugins/ChangeNames.py index 7a6930275..d37913293 100644 --- a/gramps2/src/plugins/ChangeNames.py +++ b/gramps2/src/plugins/ChangeNames.py @@ -79,14 +79,20 @@ class ChangeNames: return self.win_key = self.__class__ 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(): if name != name.capitalize(): self.name_list.append(name) + self.progress.step() if self.name_list: self.display() else: + self.progress.close() OkDialog(_('No modifications made'), _("No capitalization changes were detected.")) @@ -126,12 +132,15 @@ class ChangeNames: self.list.set_model(self.model) self.iter_list = [] + self.progress.set_pass(_('Building display'),len(self.name_list)) for name in self.name_list: handle = self.model.append() self.model.set_value(handle,0,1) self.model.set_value(handle,1,name) self.model.set_value(handle,2,name.capitalize()) self.iter_list.append(handle) + self.progress.step() + self.progress.close() self.add_itself_to_menu() self.window.show() @@ -186,6 +195,7 @@ class ChangeNames: self.db.transaction_commit(self.trans,_("Capitalization changes")) self.db.enable_signals() self.db.request_rebuild() + self.parent.bookmarks.redraw() self.close(obj) self.cb(None,1) diff --git a/gramps2/src/plugins/ChangeTypes.py b/gramps2/src/plugins/ChangeTypes.py index f4fbaded1..b3499cc5e 100644 --- a/gramps2/src/plugins/ChangeTypes.py +++ b/gramps2/src/plugins/ChangeTypes.py @@ -128,6 +128,8 @@ class ChangeTypes: original = unicode(self.auto1.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): person = self.db.get_person_from_handle(person_handle) for event_handle in person.get_event_list(): @@ -138,13 +140,15 @@ class ChangeTypes: event.set_name(new) modified = modified + 1 self.db.commit_event(event,self.trans) + progress.step() + progress.close() if modified == 1: msg = _("1 event record was modified") else: 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.close(None) diff --git a/gramps2/src/plugins/Check.py b/gramps2/src/plugins/Check.py index e39030311..6ebb83424 100644 --- a/gramps2/src/plugins/Check.py +++ b/gramps2/src/plugins/Check.py @@ -120,7 +120,7 @@ class CheckIntegrity: self.invalid_death_events = [] self.invalid_place_references = [] self.invalid_source_references = [] - self.progress = Utils.ProgressMeter('Checking database','') + self.progress = Utils.ProgressMeter(_('Checking database'),'') def family_errors(self): return len(self.broken_parent_links) + len(self.broken_links) + len(self.empty_family) + len(self.duplicate_links) diff --git a/gramps2/src/plugins/EventCmp.py b/gramps2/src/plugins/EventCmp.py index eed1e2854..a67de62ab 100644 --- a/gramps2/src/plugins/EventCmp.py +++ b/gramps2/src/plugins/EventCmp.py @@ -200,7 +200,13 @@ class EventComparison: def on_apply_clicked(self,obj): 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: WarningDialog(_("No matches were found")) @@ -311,10 +317,17 @@ class DisplayChart: index = index + 1 self.list = ListModel.ListModel(self.eventlist,titles) + + self.progress_bar.set_pass(_('Building display'),len(self.row_data)) for data in self.row_data: self.list.add(data) + self.progress_bar.step() + self.progress_bar.close() 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: individual = self.db.get_person_from_handle(individual_id) name = individual.get_primary_name().get_name() @@ -381,6 +394,7 @@ class DisplayChart: done = 1 else: self.row_data.append(tlist) + self.progress_bar.step() def make_event_titles(self): """Creates the list of unique event types, along with the person's diff --git a/gramps2/src/plugins/PatchNames.py b/gramps2/src/plugins/PatchNames.py index 4413ca663..4cd6c5e97 100644 --- a/gramps2/src/plugins/PatchNames.py +++ b/gramps2/src/plugins/PatchNames.py @@ -103,6 +103,11 @@ class PatchNames: self.prefix1_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): person = self.db.get_person_from_handle(key) @@ -139,10 +144,12 @@ class PatchNames: if match: groups = match.groups() 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: self.display() else: + self.progress.close() OkDialog(_('No modifications made'), _("No titles or nicknames were found")) @@ -197,7 +204,11 @@ class PatchNames: self.title_hash = {} self.prefix1_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: p = self.db.get_person_from_handle(id) gid = p.get_gramps_id() @@ -208,6 +219,7 @@ class PatchNames: self.model.set_value(handle,3,nick) self.model.set_value(handle,4,p.get_primary_name().get_name()) self.nick_hash[id] = handle + self.progress.step() for (id,title,nick) in self.title_list: 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,4,p.get_primary_name().get_name()) self.title_hash[id] = handle + self.progress.step() for (id,prefix,fname) in self.prefix1_list: 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,4,p.get_primary_name().get_name()) self.prefix1_hash[id] = handle + self.progress.step() for (id,prefix,fname) in self.prefix2_list: 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,4,p.get_primary_name().get_name()) self.prefix2_hash[id] = handle + self.progress.step() + self.progress.close() self.add_itself_to_menu() self.window.show()