diff --git a/src/plugins/tool/Check.py b/src/plugins/tool/Check.py index dbb5b4dd6..65516579c 100644 --- a/src/plugins/tool/Check.py +++ b/src/plugins/tool/Check.py @@ -49,7 +49,6 @@ log = logging.getLogger(".CheckRepair") # #------------------------------------------------------------------------- import gtk -from gtk import glade #------------------------------------------------------------------------- # @@ -376,13 +375,15 @@ class CheckIntegrity: self.broken_parent_links.append((mother_handle,family_handle)) mother_handle = None - if father_handle and father and family_handle not in father.get_family_handle_list(): + if father_handle and father and \ + family_handle not in father.get_family_handle_list(): # The referenced father has no reference back to the family self.broken_parent_links.append((father_handle,family_handle)) father.add_family_handle(family_handle) self.db.commit_person(father,self.trans) - if mother_handle and mother \ - and (family_handle not in mother.get_family_handle_list()): + + if mother_handle and mother and \ + family_handle not in mother.get_family_handle_list(): # The referenced mother has no reference back to the family self.broken_parent_links.append((mother_handle,family_handle)) mother.add_family_handle(family_handle) @@ -655,13 +656,13 @@ class CheckIntegrity: CHANGE_NOTE), 'remove' : self.db.remove_note}, } - for the_type in tables.keys(): - cursor = tables[the_type]['cursor_func']() - total = tables[the_type]['total_func']() - check = tables[the_type]['check_func'] - remove_func = tables[the_type]['remove'] + for the_type, the_func in tables.iteritems(): + cursor = the_func['cursor_func']() + total = the_func['total_func']() + check = the_func['check_func'] + remove_func = the_func['remove'] - self.progress.set_pass(tables[the_type]['progress'],total) + self.progress.set_pass(the_func['progress'],total) item = cursor.first() while item: @@ -1057,11 +1058,15 @@ class CheckIntegrity: def check_source_references(self): known_handles = self.db.get_source_handles() - total = self.db.get_number_of_people() + self.db.get_number_of_families() + \ - self.db.get_number_of_events() + self.db.get_number_of_places() + \ - self.db.get_number_of_media_objects() + \ - self.db.get_number_of_sources() + \ + total = ( + self.db.get_number_of_people() + + self.db.get_number_of_families() + + self.db.get_number_of_events() + + self.db.get_number_of_places() + + self.db.get_number_of_media_objects() + + self.db.get_number_of_sources() + self.db.get_number_of_repositories() + ) self.progress.set_pass(_('Looking for source reference problems'), total) @@ -1182,9 +1187,13 @@ class CheckIntegrity: def check_media_references(self): known_handles = self.db.get_media_object_handles(False) - total = self.db.get_number_of_people() + self.db.get_number_of_families() + \ - self.db.get_number_of_events() + self.db.get_number_of_places() + \ + total = ( + self.db.get_number_of_people() + + self.db.get_number_of_families() + + self.db.get_number_of_events() + + self.db.get_number_of_places() + self.db.get_number_of_sources() + ) self.progress.set_pass(_('Looking for media object reference problems'), total) @@ -1272,11 +1281,15 @@ class CheckIntegrity: def check_note_references(self): known_handles = self.db.get_note_handles() - total = self.db.get_number_of_people() + self.db.get_number_of_families() + \ - self.db.get_number_of_events() + self.db.get_number_of_places() + \ - self.db.get_number_of_media_objects() + \ - self.db.get_number_of_sources() + \ + total = ( + self.db.get_number_of_people() + + self.db.get_number_of_families() + + self.db.get_number_of_events() + + self.db.get_number_of_places() + + self.db.get_number_of_media_objects() + + self.db.get_number_of_sources() + self.db.get_number_of_repositories() + ) self.progress.set_pass(_('Looking for note reference problems'), total) @@ -1423,21 +1436,22 @@ class CheckIntegrity: media_references = len(self.invalid_media_references) note_references = len(self.invalid_note_references) name_format = len(self.removed_name_format) - empty_objs = ( len(self.empty_objects['persons']) - + len(self.empty_objects['families']) - + len(self.empty_objects['events']) - + len(self.empty_objects['sources']) - + len(self.empty_objects['media']) - + len(self.empty_objects['places']) - + len(self.empty_objects['repos']) - + len(self.empty_objects['notes']) + empty_objs = ( + len(self.empty_objects['persons']) + + len(self.empty_objects['families']) + + len(self.empty_objects['events']) + + len(self.empty_objects['sources']) + + len(self.empty_objects['media']) + + len(self.empty_objects['places']) + + len(self.empty_objects['repos']) + + len(self.empty_objects['notes']) ) - errors = (photos + efam + blink + plink + slink + rel - + event_invalid + person - + person_references + place_references + source_references - + repo_references + media_references + note_references - + name_format + empty_objs + invalid_dates + errors = (photos + efam + blink + plink + slink + rel + + event_invalid + person + + person_references + place_references + source_references + + repo_references + media_references + note_references + + name_format + empty_objs + invalid_dates ) if errors == 0: @@ -1609,15 +1623,16 @@ class Report(ManagedWindow.ManagedWindow): base = os.path.dirname(__file__) glade_file = base + os.sep + "summary.glade" - topDialog = glade.XML(glade_file,"summary","gramps") - topDialog.get_widget("close").connect('clicked',self.close) - - window = topDialog.get_widget("summary") - textwindow = topDialog.get_widget("textwindow") + topDialog = gtk.Builder() + topDialog.add_from_file(glade_file) + topDialog.get_object("close").connect('clicked',self.close) + window = topDialog.get_object ("summary") + textwindow = topDialog.get_object("textwindow") textwindow.get_buffer().set_text(text) self.set_window(window, - topDialog.get_widget("title"), + #topDialog.get_widget("title"), + topDialog.get_object("title"), _("Integrity Check Results")) self.show() diff --git a/src/plugins/tool/summary.glade b/src/plugins/tool/summary.glade index 6a3d8fc84..0a74b41bd 100644 --- a/src/plugins/tool/summary.glade +++ b/src/plugins/tool/summary.glade @@ -1,137 +1,128 @@ - - - - - - - True - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 450 - 400 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - False - 6 - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 8 - False - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_OUT - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - + + + + + True + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 450 + 400 + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + False + + + + True + False + 0 + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + + + + + + 0 + False + True + GTK_PACK_END + + + + + 6 + True + False + 6 + + + True + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 8 + False + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_OUT + GTK_CORNER_TOP_LEFT + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + close + + +