From 255a59679df310b62c138314e480f68118850728 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 27 Jul 2007 03:51:54 +0000 Subject: [PATCH] 2007-07-26 Don Allingham * src/DataViews/_PersonView.py: add siblings quick report * src/plugins/siblings.py: Added * src/plugins/all_events.py: add i18n support * src/plugins/Makefile.am: added new files svn: r8774 --- ChangeLog | 6 +++++ po/POTFILES.in | 2 ++ src/DataViews/_PersonView.py | 25 ++++++++++++++++----- src/plugins/Makefile.am | 4 +++- src/plugins/all_events.py | 29 ++++++++++++++++++++---- src/plugins/siblings.py | 43 ++++++++++++++++++++++++++++++++++++ 6 files changed, 98 insertions(+), 11 deletions(-) create mode 100644 src/plugins/siblings.py diff --git a/ChangeLog b/ChangeLog index 04746eaad..f0ac56fbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-07-26 Don Allingham + * src/DataViews/_PersonView.py: add siblings quick report + * src/plugins/siblings.py: Added + * src/plugins/all_events.py: add i18n support + * src/plugins/Makefile.am: added new files + 2007-07-24 Brian Matherly * po/POTFILES.in: Add ImportCSV.py and ExportCSV.py diff --git a/po/POTFILES.in b/po/POTFILES.in index e9b1fe7d9..64b8e76f5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -277,6 +277,8 @@ src/Selectors/_SelectorFactory.py src/Selectors/__init__.py # plugins directory +src/plugins/all_events.py +src/plugins/siblings.py src/plugins/AncestorChart2.py src/plugins/AncestorReport.py src/plugins/BookReport.py diff --git a/src/DataViews/_PersonView.py b/src/DataViews/_PersonView.py index 3ba829118..2c1bb1b35 100644 --- a/src/DataViews/_PersonView.py +++ b/src/DataViews/_PersonView.py @@ -152,8 +152,11 @@ class PersonView(PageView.PersonNavView): _("Edit the selected person"), self.edit), ('CloseAllNodes', None, _("Collapse all nodes"), None, None, self.close_all_nodes), - ('QuickReport', None, _("Quick Report"), None, None, + ('QuickReport', None, _("Quick Report"), None, None, None), + ('AllEvents', None, _("All Events"), None, None, self.quick_report), + ('Siblings', None, _("Siblings"), None, None, + self.siblings_report), ]) self.edit_action.add_actions( @@ -411,7 +414,10 @@ class PersonView(PageView.PersonNavView): - + + + + ''' @@ -954,16 +960,23 @@ class PersonView(PageView.PersonNavView): path = (path[0]+1,) ofile.end_page() ofile.close() - - def quick_report(self, obj): + + def run_report(self, func): from TextBufDoc import TextBufDoc from Simple import make_basic_stylesheet - import all_events if self.dbstate.active: d = TextBufDoc(make_basic_stylesheet(), None, None) handle = self.dbstate.active.handle person = self.dbstate.db.get_person_from_handle(handle) d.open("") - all_events.run(self.db, d, person) + func(self.db, d, person) d.close() + + def quick_report(self, obj): + import all_events + self.run_report(all_events.run) + + def siblings_report(self, obj): + import siblings + self.run_report(siblings.run) diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 88d51ab46..73f63d29b 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -71,7 +71,9 @@ pkgdata_PYTHON = \ MediaManager.py\ RemoveUnused.py\ rel_pl.py\ - RebuildRefMap.py + RebuildRefMap.py\ + all_events.py \ + siblings.py pkgpyexecdir = @pkgpyexecdir@/plugins pkgpythondir = @pkgpythondir@/plugins diff --git a/src/plugins/all_events.py b/src/plugins/all_events.py index f62010b8b..0702d3ecb 100644 --- a/src/plugins/all_events.py +++ b/src/plugins/all_events.py @@ -1,4 +1,26 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2007 Donald N. Allingham +# Copyright (C) 2007 Brian G. Matherly +# +# 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 +# + from Simple import SimpleAccess, by_date, SimpleDoc +from gettext import gettext as _ def run(database, document, person): @@ -18,13 +40,12 @@ def run(database, document, person): # display the results - sd.title("Sorted events of %s" % sa.name(person)) + sd.title(_("Sorted events of %s") % sa.name(person)) sd.paragraph("") - sd.header1("Event Type\tEvent Date\tEvent Place") + sd.header1("\t".join(_("Event Type"),_("Event Date"),_("tEvent Place"))) + for event in event_list: sd.paragraph("%-12s\t%-12s\t%s" % (sa.event_type(event), sa.event_date(event), sa.event_place(event))) - - sd.paragraph("Marriage %s" % sa.marriage_place(person)) diff --git a/src/plugins/siblings.py b/src/plugins/siblings.py new file mode 100644 index 000000000..ba73590f6 --- /dev/null +++ b/src/plugins/siblings.py @@ -0,0 +1,43 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2007 Donald N. Allingham +# Copyright (C) 2007 Brian G. Matherly +# +# 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 +# + +from Simple import SimpleAccess, by_date, SimpleDoc +from gettext import gettext as _ + +def run(database, document, person): + + sa = SimpleAccess(database) + sd = SimpleDoc(document) + + sd.title(_("Siblings of %s") % sa.name(person)) + sd.paragraph("") + sd.header1("%-30s\t%-10s\t%s" % (_("Sibling"),_("Gender"),_("Birth Date"))) + + gid = sa.gid(person) + + for family in sa.child_in(person): + for child in sa.children(family): + if sa.gid(child) != gid: + sd.paragraph("%-30s\t%-10s\t%s" % ( + sa.name(child), + sa.gender(child), + sa.birth_date(child))) +