diff --git a/ChangeLog b/ChangeLog index 081f2068d..6b806567f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-12-29 Douglas S. Blank + * src/DataViews/MyGrampsView.py: fixme's are fixed + * src/DataViews/EventView.py: added quick report popup + * src/plugins/SameSurnames.py: removed unneeded imports + * src/plugins/siblings.py: removed unneeded imports + * src/Simple/_SimpleTable.py: add date handler + * src/plugins/OnThisDay.py: new event quick report + 2007-12-29 Benny Malengier * src/ArgHandler.py: better handling of -l * src/const.py.in: forgot to commit this, new constants diff --git a/src/DataViews/EventView.py b/src/DataViews/EventView.py index 1b62c22d6..57ae5992f 100644 --- a/src/DataViews/EventView.py +++ b/src/DataViews/EventView.py @@ -49,6 +49,7 @@ from DdTargets import DdTargets from QuestionDialog import QuestionDialog from Editors import EditEvent, DelEventQuery from Filters.SideBar import EventSidebarFilter +from ReportBase import CATEGORY_QR_EVENT #------------------------------------------------------------------------- # @@ -80,6 +81,7 @@ class EventView(PageView.ListView): EDIT_MSG = _("Edit the selected event") DEL_MSG = _("Delete the selected event") FILTER_TYPE = "Event" + QR_CATEGORY = CATEGORY_QR_EVENT def __init__(self, dbstate, uistate): """ @@ -170,6 +172,10 @@ class EventView(PageView.ListView): + + + + ''' @@ -178,7 +184,11 @@ class EventView(PageView.ListView): self._add_action('FilterEdit', None, _('Event Filter Editor'), callback=self.filter_editor,) self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES, - _('_Column Editor'), callback=self._column_editor,) + _('_Column Editor'), callback=self._column_editor,) + self._add_action('QuickReport', None, + _("Quick Report"), None, None, None) + self._add_action('Dummy', None, + ' ', None, None, self.dummy_report) def get_handle_from_gramps_id(self, gid): obj = self.dbstate.db.get_event_from_gramps_id(gid) @@ -261,3 +271,11 @@ class EventView(PageView.ListView): EditEvent(self.dbstate, self.uistate, [], event) except Errors.WindowActiveError: pass + + def dummy_report(self, obj): + ''' For the xml UI definition of popup to work, the submenu + Quick Report must have an entry in the xml + As this submenu will be dynamically built, we offer a dummy action + ''' + pass + diff --git a/src/DataViews/MyGrampsView.py b/src/DataViews/MyGrampsView.py index 3ba59d9c6..fae98c4fa 100644 --- a/src/DataViews/MyGrampsView.py +++ b/src/DataViews/MyGrampsView.py @@ -142,7 +142,6 @@ class GadgetWindow(ManagedWindow.ManagedWindow): self.gadget.viewpage.detached_gadgets.remove(self.gadget) self.gadget.state = "maximized" self.gadget.mainframe.reparent(self.gadget.parent) - # FIXME: need to pack as it was, not just stick it in expand,fill,padding,pack = self.gadget.parent.query_child_packing(self.gadget.mainframe) self.gadget.parent.set_child_packing(self.gadget.mainframe,self.gadget.expand,fill,padding,pack) ManagedWindow.ManagedWindow.close(self, *args) @@ -513,7 +512,6 @@ class MyGrampsView(PageView.PageView): frame.viewpage = self frame.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.hbox = gtk.HBox(homogeneous=True) - # FIXME: issue when window is scrolled down; drops in wrong place # Set up drag and drop frame.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | diff --git a/src/PageView.py b/src/PageView.py index 7c1496932..7ca3b3668 100644 --- a/src/PageView.py +++ b/src/PageView.py @@ -1068,5 +1068,3 @@ class ListView(BookMarkView): o.end_page() o.close() - - diff --git a/src/ReportBase/_Constants.py b/src/ReportBase/_Constants.py index f9413fb52..1651e26ad 100644 --- a/src/ReportBase/_Constants.py +++ b/src/ReportBase/_Constants.py @@ -70,4 +70,4 @@ CATEGORY_QR_FAMILY = 1 CATEGORY_QR_EVENT = 2 CATEGORY_QR_SOURCE = 3 CATEGORY_QR_PLACE = 4 -CATEGORY_QR_REPOSITORY = 5 \ No newline at end of file +CATEGORY_QR_REPOSITORY = 5 diff --git a/src/Simple/_SimpleTable.py b/src/Simple/_SimpleTable.py index d65fb9f22..2c8bd60ee 100644 --- a/src/Simple/_SimpleTable.py +++ b/src/Simple/_SimpleTable.py @@ -23,8 +23,10 @@ Provides a simplified table creation interface """ import copy + import gen.lib import Errors +import DateHandler class SimpleTable: """ @@ -125,6 +127,10 @@ class SimpleTable: elif isinstance(item, gen.lib.Place): pass elif isinstance(item, gen.lib.Repository): pass elif isinstance(item, gen.lib.Note): pass + elif isinstance(item, gen.lib.Date): + text = DateHandler.displayer.display(item) + retval.append(text) + #link = ('Date', item) else: raise AttributeError, ("unknown object type: '%s': %s" % (item, type(item))) diff --git a/src/plugins/OnThisDay.py b/src/plugins/OnThisDay.py new file mode 100644 index 000000000..bb0c93010 --- /dev/null +++ b/src/plugins/OnThisDay.py @@ -0,0 +1,99 @@ +# +# 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 +# + +""" +Display all events on a particular day. +""" + +from Simple import SimpleAccess, SimpleDoc, SimpleTable +from gettext import gettext as _ +from PluginUtils import register_quick_report +from ReportBase import CATEGORY_QR_EVENT + +def run(database, document, main_event): + """ + Loops through the families that the person is a child in, and display + the information about the other children. + """ + # setup the simple access functions + sdb = SimpleAccess(database) + sdoc = SimpleDoc(document) + stab = SimpleTable(sdb, sdoc) + yeartab = SimpleTable(sdb, sdoc) + histab = SimpleTable(sdb, sdoc) + + main_date = main_event.get_date_object() + + # display the title + sdoc.title(_("Events of %s") % sdb.event_date(main_event)) + sdoc.paragraph("") + stab.columns(_("Date"), _("Type"), _("Place")) + yeartab.columns(_("Date"), _("Type"), _("Place")) + histab.columns(_("Date"), _("Type"), _("Place")) + + for event_handle in database.get_event_handles(): + event = database.get_event_from_handle(event_handle) + date = event.get_date_object() + if date.get_year() == 0: + continue + if (date.get_year() == main_date.get_year() and + date.get_month() == main_date.get_month() and + date.get_day() == main_date.get_day()): + stab.row(date, + sdb.event_type(event), + sdb.event_place(event)) + elif (date.get_month() == main_date.get_month() and + date.get_day() == main_date.get_day()): + histab.row(date, + sdb.event_type(event), + sdb.event_place(event)) + elif (date.get_year() == main_date.get_year()): + yeartab.row(date, + sdb.event_type(event), + sdb.event_place(event)) + + stab.write() + + sdoc.paragraph("") + if histab.get_row_count() > 0: + sdoc.paragraph("Other events on this day in history") + histab.write() + + sdoc.paragraph("") + if yeartab.get_row_count() > 0: + sdoc.paragraph("Other events in %d" % main_date.get_year()) + yeartab.write() + +#------------------------------------------------------------------------ +# +# +# +#------------------------------------------------------------------------ +register_quick_report( + name = 'onthisday', + category = CATEGORY_QR_EVENT, + run_func = run, + translated_name = _("On This Day"), + status = _("Stable"), + description= _("Display events on a particular day"), + author_name="Douglas Blank", + author_email="dblank@cs.brynmawr.edu" + ) diff --git a/src/plugins/SameSurnames.py b/src/plugins/SameSurnames.py index f0afffbc6..bcecc702c 100644 --- a/src/plugins/SameSurnames.py +++ b/src/plugins/SameSurnames.py @@ -24,9 +24,8 @@ Display a people who have a person's same surname """ from Simple import SimpleAccess, SimpleDoc, SimpleTable -from gen.lib import Person from gettext import gettext as _ -from PluginUtils import register_quick_report, relationship_class +from PluginUtils import register_quick_report from ReportBase import CATEGORY_QR_PERSON from Filters.Rules.Person import SearchName from Filters import GenericFilterFactory, Rules @@ -40,7 +39,6 @@ def run(database, document, person): sdb = SimpleAccess(database) sdoc = SimpleDoc(document) stab = SimpleTable(sdb, sdoc) - rel_class = relationship_class() # display the title sdoc.title(_("People with same surname as %s") % sdb.name(person)) sdoc.paragraph("") diff --git a/src/plugins/siblings.py b/src/plugins/siblings.py index ca816227d..269567c14 100644 --- a/src/plugins/siblings.py +++ b/src/plugins/siblings.py @@ -24,7 +24,6 @@ Display a person's siblings in a report window """ from Simple import SimpleAccess, SimpleDoc, SimpleTable -from gen.lib import Person from gettext import gettext as _ from PluginUtils import register_quick_report, relationship_class from ReportBase import CATEGORY_QR_PERSON