From 1f9f356d77f113481a1e8f4ad7660f50b68721c7 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 24 Oct 2004 01:09:12 +0000 Subject: [PATCH] * src/PeopleModel.py: disable bold due to gtk tree bug * src/PeopleView.py: disable bold due to gtk tree bug * src/plugins/CountAncestors.py: Handle duplicates properly svn: r3666 --- gramps2/ChangeLog | 5 +++++ gramps2/src/PeopleModel.py | 2 +- gramps2/src/PeopleView.py | 3 +-- gramps2/src/plugins/CountAncestors.py | 26 ++++++++++++++------------ 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index fa766a196..58343c2aa 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2004-10-23 Don Allingham + * src/PeopleModel.py: disable bold due to gtk tree bug + * src/PeopleView.py: disable bold due to gtk tree bug + * src/plugins/CountAncestors.py: Handle duplicates properly + 2004-10-22 Don Allingham * src/GrampsBSDDB.py: thumbnail handing in the database * src/GrampsDbBase.py: add set_thumbnail_image and diff --git a/gramps2/src/PeopleModel.py b/gramps2/src/PeopleModel.py index 6b7b29537..639d9e73c 100644 --- a/gramps2/src/PeopleModel.py +++ b/gramps2/src/PeopleModel.py @@ -315,7 +315,7 @@ class PeopleModel(gtk.GenericTreeModel): return node def column_header_bold(self,node): - return pango.WEIGHT_BOLD + return pango.WEIGHT_NORMAL #BOLD def column_header_view(self,node): return self.top_visible.has_key(node) diff --git a/gramps2/src/PeopleView.py b/gramps2/src/PeopleView.py index 5a1434caa..d961558e1 100644 --- a/gramps2/src/PeopleView.py +++ b/gramps2/src/PeopleView.py @@ -94,8 +94,7 @@ class PeopleView: for column in self.columns: self.person_tree.remove_column(column) - column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0, - weight=PeopleModel.COLUMN_BOLD) + column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0) column.set_resizable(gtk.TRUE) column.set_min_width(225) column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) diff --git a/gramps2/src/plugins/CountAncestors.py b/gramps2/src/plugins/CountAncestors.py index c1cb6d7e4..82af9f1b1 100644 --- a/gramps2/src/plugins/CountAncestors.py +++ b/gramps2/src/plugins/CountAncestors.py @@ -30,6 +30,7 @@ from gettext import gettext as _ from gnome.ui import * import gtk import gtk.glade +from sets import Set def report(database,person): try: @@ -48,24 +49,25 @@ class CountAncestors: topDialog.signal_autoconnect({ "destroy_passed_object" : Utils.destroy_passed_object, }) - thisgen = [] - allgen = [] - thisgen.append(person.get_handle()) + thisgen = Set() + allgen = 0 + thisgen.add(person.get_handle()) + title = _("Number of ancestors of \"%s\" by generation") % person.get_primary_name().get_name() - text = text + title + ':\n' + text += title + ':\n' thisgensize = 1 gen = 1 while thisgensize > 0: thisgensize = 0 if thisgen: thisgensize = len( thisgen ) - gen = gen - 1 + gen -= 1 if thisgensize == 1 : - text = text + _("Generation %d has 1 individual.\n") % (gen) + text += _("Generation %d has 1 individual.\n") % (gen) else: - text = text + _("Generation %d has %d individuals.\n") % (gen, thisgensize) + text += _("Generation %d has %d individuals.\n") % (gen, thisgensize) temp = thisgen - thisgen = [] + thisgen = Set() for person_handle in temp: person = database.get_person_from_handle(person_handle) family_handle = person.get_main_parents_family_handle() @@ -74,12 +76,12 @@ class CountAncestors: father_handle = family.get_father_handle() mother_handle = family.get_mother_handle() if father_handle: - thisgen.append(father_handle) + thisgen.add(father_handle) if mother_handle: - thisgen.append(mother_handle) - allgen = allgen + thisgen + thisgen.add(mother_handle) + allgen += len(thisgen) - text = text + _("Total ancestors in generations %d to -1 is %d.\n") % (gen, len(allgen)) + text += _("Total ancestors in generations %d to -1 is %d.\n") % (gen, allgen) top = topDialog.get_widget("summary") textwindow = topDialog.get_widget("textwindow")