From b34f6acb50a0993b66a56b97bda75a153da65e49 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Wed, 29 Jun 2005 21:24:31 +0000 Subject: [PATCH] * src/plugins/DumpGenderStats.py: New plugin for debugging svn: r4892 --- gramps2/ChangeLog | 3 ++ gramps2/src/plugins/DumpGenderStats.py | 65 ++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 gramps2/src/plugins/DumpGenderStats.py diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 3d6bfac79..a8d21caf9 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,6 @@ +2005-06-29 Martin Hawlisch + * src/plugins/DumpGenderStats.py: New plugin for debugging + 2005-06-29 Don Allingham * src/GrampsBSDDB.py: provide an upgrade task to rebuild gender stats * src/GrampsDbBase.py: move gender stats handling to the commit_person diff --git a/gramps2/src/plugins/DumpGenderStats.py b/gramps2/src/plugins/DumpGenderStats.py new file mode 100644 index 000000000..06b13a37e --- /dev/null +++ b/gramps2/src/plugins/DumpGenderStats.py @@ -0,0 +1,65 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2005 Martin Hawlisch, Donald N. Allingham +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# $Id$ + +"Dump gender stats" + +import gtk +import ListModel +_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ] + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def DumpGenderStatsPlugin(database,active_person,callback,parent=None): + stats_list = [] + for name in database.genderStats.stats.keys(): + stats_list.append((name,)+database.genderStats.stats[name]+(_GENDER[database.genderStats.guess_gender(name)],)) + + titles = [(_('Name'),1,100), (_('Male'),2,70), + (_('Female'),3,70), ('Unknown',4,70), (_('Guess'),5,70) ] + treeview = gtk.TreeView() + model = ListModel.ListModel(treeview,titles) + for entry in stats_list: + model.add(entry,entry[0]) + w = gtk.Window() + w.set_position(gtk.WIN_POS_MOUSE) + w.set_default_size(400,300) + s=gtk.ScrolledWindow() + s.add(treeview) + w.add(s) + w.show_all() + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +from PluginMgr import register_tool + +register_tool( + DumpGenderStatsPlugin, + _("Dumps gender statistics"), + category=_("Debug"), + description=_("Will dump the statistics for the gender guessing from the first name.") + )