Multiple enhancements to the marker report.
svn: r8784
This commit is contained in:
		
							
								
								
									
										10
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								ChangeLog
									
									
									
									
									
								
							@@ -1,3 +1,13 @@
 | 
			
		||||
2007-07-28  Brian Matherly <brian@gramps-project.org>
 | 
			
		||||
	* src/plugins/MarkerReport.py: Enhanced
 | 
			
		||||
	* src/Filters/Rules/Event/_HasMarkerOf.py: Added
 | 
			
		||||
	* src/Filters/Rules/Event/__init__.py: Add _HasMarkerOf.py
 | 
			
		||||
	* src/Filters/Rules/Event/Makefile.am: Add _HasMarkerOf.py
 | 
			
		||||
	* src/Filters/Rules/Note/_HasMarkerOf.py: Added
 | 
			
		||||
	* src/Filters/Rules/Note/__init__.py: Add _HasMarkerOf.py
 | 
			
		||||
	* src/Filters/Rules/Note/Makefile.am: Add _HasMarkerOf.py
 | 
			
		||||
	* po/POTFILES.in: Add _HasMarkerOf.py for Events and Notes
 | 
			
		||||
 | 
			
		||||
2007-07-27  Don Allingham  <don@gramps-project.org>
 | 
			
		||||
	* src/ListModel.py: change __connect_model back to connect_model
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -559,6 +559,7 @@ src/Filters/Rules/Event/_HasNoteRegexp.py
 | 
			
		||||
src/Filters/Rules/Event/_RegExpIdOf.py
 | 
			
		||||
src/Filters/Rules/Event/_AllEvents.py
 | 
			
		||||
src/Filters/Rules/Event/_HasIdOf.py
 | 
			
		||||
src/Filters/Rules/Event/_HasMarkerOf.py
 | 
			
		||||
src/Filters/Rules/Event/_HasType.py
 | 
			
		||||
src/Filters/Rules/Event/_HasNoteMatchingSubstringOf.py
 | 
			
		||||
src/Filters/Rules/Event/__init__.py
 | 
			
		||||
@@ -612,6 +613,7 @@ src/Filters/Rules/Repository/__init__.py
 | 
			
		||||
# Filters.Rules.Note package
 | 
			
		||||
src/Filters/Rules/Note/_AllNotes.py
 | 
			
		||||
src/Filters/Rules/Note/_HasIdOf.py
 | 
			
		||||
src/Filters/Rules/Note/_HasMarkerOf.py
 | 
			
		||||
src/Filters/Rules/Note/_HasNoteMatchingSubstringOf.py
 | 
			
		||||
src/Filters/Rules/Note/_HasNoteRegexp.py
 | 
			
		||||
src/Filters/Rules/Note/_HasNote.py
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@ pkgdata_PYTHON = \
 | 
			
		||||
	_RegExpIdOf.py\
 | 
			
		||||
	_AllEvents.py\
 | 
			
		||||
	_HasIdOf.py\
 | 
			
		||||
	_HasMarkerOf.py\
 | 
			
		||||
	_HasType.py\
 | 
			
		||||
	_HasNoteMatchingSubstringOf.py\
 | 
			
		||||
	__init__.py
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										46
									
								
								src/Filters/Rules/Event/_HasMarkerOf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/Filters/Rules/Event/_HasMarkerOf.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# 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
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# Standard Python modules
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
from gettext import gettext as _
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# GRAMPS modules
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
from Filters.Rules._HasMarkerBase import HasMarkerBase
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# HasEvent
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasMarkerOf(HasMarkerBase):
 | 
			
		||||
    """Rule that checks for an event with a particular marker"""
 | 
			
		||||
 | 
			
		||||
    name        =  _('Events with <marker>')
 | 
			
		||||
    description = _("Matches Events with a marker of a particular value")
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2002-2006  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
 | 
			
		||||
@@ -29,6 +30,7 @@ __author__ = "Don Allingham"
 | 
			
		||||
from Filters.Rules._HasEventBase import HasEventBase as HasEvent
 | 
			
		||||
 | 
			
		||||
from _HasType import HasType
 | 
			
		||||
from _HasMarkerOf import HasMarkerOf
 | 
			
		||||
from _AllEvents import AllEvents
 | 
			
		||||
from _HasIdOf import HasIdOf
 | 
			
		||||
from _RegExpIdOf import RegExpIdOf
 | 
			
		||||
@@ -41,6 +43,8 @@ editor_rule_list = [
 | 
			
		||||
    AllEvents,
 | 
			
		||||
    HasType,
 | 
			
		||||
    HasIdOf,
 | 
			
		||||
# TODO: At the time of this writing, the GRAMPS UI does not allow setting markers for events.
 | 
			
		||||
#    HasMarkerOf, 
 | 
			
		||||
    RegExpIdOf,
 | 
			
		||||
    HasNoteRegexp,
 | 
			
		||||
    HasNoteMatchingSubstringOf,
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/Filters/Rules/Note
 | 
			
		||||
pkgdata_PYTHON = \
 | 
			
		||||
	_AllNotes.py\
 | 
			
		||||
	_HasIdOf.py\
 | 
			
		||||
	_HasMarkerOf.py\
 | 
			
		||||
	_HasNoteMatchingSubstringOf.py\
 | 
			
		||||
	_HasNoteRegexp.py\
 | 
			
		||||
	_HasNote.py\
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										46
									
								
								src/Filters/Rules/Note/_HasMarkerOf.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/Filters/Rules/Note/_HasMarkerOf.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
#
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# 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
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# $Id$
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# Standard Python modules
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
from gettext import gettext as _
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# GRAMPS modules
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
from Filters.Rules._HasMarkerBase import HasMarkerBase
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
# HasEvent
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
class HasMarkerOf(HasMarkerBase):
 | 
			
		||||
    """Rule that checks for a note with a particular marker"""
 | 
			
		||||
 | 
			
		||||
    name        =  _('Notes with <marker>')
 | 
			
		||||
    description = _("Matches Notes with a marker of a particular value")
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
# Gramps - a GTK+/GNOME based genealogy program
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2002-2006  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
 | 
			
		||||
@@ -28,6 +29,7 @@ __author__ = "Don Allingham"
 | 
			
		||||
 | 
			
		||||
from _AllNotes import AllNotes
 | 
			
		||||
from _HasIdOf import HasIdOf
 | 
			
		||||
from _HasMarkerOf import HasMarkerOf
 | 
			
		||||
from _RegExpIdOf import RegExpIdOf
 | 
			
		||||
from _HasNoteRegexp import HasNoteRegexp
 | 
			
		||||
from _HasNoteMatchingSubstringOf import HasNoteMatchingSubstringOf
 | 
			
		||||
@@ -38,6 +40,7 @@ from _HasNote import HasNote
 | 
			
		||||
editor_rule_list = [
 | 
			
		||||
    AllNotes,
 | 
			
		||||
    HasIdOf,
 | 
			
		||||
    HasMarkerOf,
 | 
			
		||||
    RegExpIdOf,
 | 
			
		||||
    HasNote,
 | 
			
		||||
    HasNoteRegexp,
 | 
			
		||||
 
 | 
			
		||||
@@ -39,9 +39,10 @@ from ReportBase import Report, ReportUtils, ReportOptions, \
 | 
			
		||||
     CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
 | 
			
		||||
import BaseDoc
 | 
			
		||||
import Sort
 | 
			
		||||
from RelLib import MarkerType
 | 
			
		||||
from Filters import GenericFilter, Rules
 | 
			
		||||
from RelLib import MarkerType, FamilyRelType
 | 
			
		||||
from Filters import GenericFilter, GenericFilterFactory, Rules
 | 
			
		||||
from BasicUtils import name_displayer
 | 
			
		||||
import DateHandler
 | 
			
		||||
 | 
			
		||||
#------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
@@ -77,8 +78,7 @@ class MarkerReport(Report):
 | 
			
		||||
        Report.__init__(self,database,person,options_class)
 | 
			
		||||
 | 
			
		||||
        self.marker = options_class.handler.options_dict['marker']
 | 
			
		||||
        self.filter = GenericFilter()
 | 
			
		||||
        self.filter.add_rule(Rules.Person.HasMarkerOf([self.marker]))
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
    def write_report(self):
 | 
			
		||||
        self.doc.start_paragraph("MR-Title")
 | 
			
		||||
@@ -87,18 +87,341 @@ class MarkerReport(Report):
 | 
			
		||||
        self.doc.write_text(title,mark)
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        
 | 
			
		||||
        plist = self.database.get_person_handles(sort_handles=False)
 | 
			
		||||
        ind_list = self.filter.apply(self.database,plist)
 | 
			
		||||
        self.write_people()
 | 
			
		||||
        self.write_families()
 | 
			
		||||
        self.write_events()
 | 
			
		||||
        self.write_notes()
 | 
			
		||||
            
 | 
			
		||||
        count = 1
 | 
			
		||||
    def write_people(self):
 | 
			
		||||
        plist = self.database.get_person_handles(sort_handles=False)
 | 
			
		||||
        FilterClass = GenericFilterFactory('Person')
 | 
			
		||||
        filter = FilterClass()
 | 
			
		||||
        filter.add_rule(Rules.Person.HasMarkerOf([self.marker]))
 | 
			
		||||
        ind_list = filter.apply(self.database,plist)
 | 
			
		||||
        
 | 
			
		||||
        if not ind_list:
 | 
			
		||||
            return
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_paragraph("MR-Heading")
 | 
			
		||||
        header = _("People")
 | 
			
		||||
        mark = BaseDoc.IndexMark(header,BaseDoc.INDEX_TYPE_TOC,2)
 | 
			
		||||
        self.doc.write_text(header,mark)
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
 | 
			
		||||
        self.doc.start_table('PeopleTable','MR-Table')
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_row()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Id"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Name"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Birth"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Death"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.end_row()
 | 
			
		||||
 | 
			
		||||
        for person_handle in ind_list:
 | 
			
		||||
            person = self.database.get_person_from_handle(person_handle)
 | 
			
		||||
 | 
			
		||||
            self.doc.start_row()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            self.doc.write_text(person.get_gramps_id())
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
 | 
			
		||||
            name = name_displayer.display(person)
 | 
			
		||||
            mark = ReportUtils.get_person_mark(self.database, person)
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal',str(count))
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            self.doc.write_text(name,mark)
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            count = count + 1
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            birth_ref = person.get_birth_ref()
 | 
			
		||||
            if birth_ref:
 | 
			
		||||
                event = self.database.get_event_from_handle(birth_ref.ref)
 | 
			
		||||
                self.doc.write_text(DateHandler.get_date( event ))
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            death_ref = person.get_death_ref()
 | 
			
		||||
            if death_ref:
 | 
			
		||||
                event = self.database.get_event_from_handle(death_ref.ref)
 | 
			
		||||
                self.doc.write_text(DateHandler.get_date( event ))
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.end_row()
 | 
			
		||||
            
 | 
			
		||||
        self.doc.end_table()
 | 
			
		||||
            
 | 
			
		||||
    def write_families(self):
 | 
			
		||||
        flist = self.database.get_family_handles()
 | 
			
		||||
        FilterClass = GenericFilterFactory('Family')
 | 
			
		||||
        filter = FilterClass()
 | 
			
		||||
        filter.add_rule(Rules.Family.HasMarkerOf([self.marker]))
 | 
			
		||||
        fam_list = filter.apply(self.database,flist)
 | 
			
		||||
        
 | 
			
		||||
        if not fam_list:
 | 
			
		||||
            return
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_paragraph("MR-Heading")
 | 
			
		||||
        header = _("Families")
 | 
			
		||||
        mark = BaseDoc.IndexMark(header,BaseDoc.INDEX_TYPE_TOC,2)
 | 
			
		||||
        self.doc.write_text(header,mark)
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
 | 
			
		||||
        self.doc.start_table('FamilyTable','MR-Table')
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_row()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Id"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Father"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Mother"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Relationship"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.end_row()
 | 
			
		||||
 | 
			
		||||
        for family_handle in fam_list:
 | 
			
		||||
            family = self.database.get_family_from_handle(family_handle)
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_row()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            self.doc.write_text(family.get_gramps_id())
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            father_handle = family.get_father_handle()
 | 
			
		||||
            if father_handle:
 | 
			
		||||
                father = self.database.get_person_from_handle(father_handle)
 | 
			
		||||
                mark = ReportUtils.get_person_mark(self.database, father)
 | 
			
		||||
                self.doc.write_text(name_displayer.display(father),mark)
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            mother_handle = family.get_mother_handle()
 | 
			
		||||
            if mother_handle:
 | 
			
		||||
                mother = self.database.get_person_from_handle(mother_handle)
 | 
			
		||||
                mark = ReportUtils.get_person_mark(self.database, mother)
 | 
			
		||||
                self.doc.write_text(name_displayer.display(mother),mark)
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            relation = family.get_relationship()
 | 
			
		||||
            self.doc.write_text( str(FamilyRelType(relation)) )
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.end_row()
 | 
			
		||||
            
 | 
			
		||||
        self.doc.end_table()
 | 
			
		||||
 | 
			
		||||
    def write_events(self):
 | 
			
		||||
        # At the time of this writing, the GRAMPS UI does not allow the setting
 | 
			
		||||
        # of markers for events.
 | 
			
		||||
        elist = self.database.get_event_handles()
 | 
			
		||||
        FilterClass = GenericFilterFactory('Event')
 | 
			
		||||
        filter = FilterClass()
 | 
			
		||||
        filter.add_rule(Rules.Event.HasMarkerOf([self.marker]))
 | 
			
		||||
        event_list = filter.apply(self.database,elist)
 | 
			
		||||
        
 | 
			
		||||
        if not event_list:
 | 
			
		||||
            return
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_paragraph("MR-Heading")
 | 
			
		||||
        header = _("Events")
 | 
			
		||||
        mark = BaseDoc.IndexMark(header,BaseDoc.INDEX_TYPE_TOC,2)
 | 
			
		||||
        self.doc.write_text(header,mark)
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
 | 
			
		||||
        self.doc.start_table('EventTable','MR-Table')
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_row()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Id"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Date"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Place"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Description"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.end_row()
 | 
			
		||||
 | 
			
		||||
        for event_handle in event_list:
 | 
			
		||||
            event = self.database.get_event_from_handle(event_handle)
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_row()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            self.doc.write_text(event.get_gramps_id())
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()            
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            date = DateHandler.get_date(event)
 | 
			
		||||
            if date:
 | 
			
		||||
                self.doc.write_text(date)
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            place_handle = event.get_place_handle()
 | 
			
		||||
            place = ReportUtils.place_name(self.database,place_handle)
 | 
			
		||||
            if place:
 | 
			
		||||
                self.doc.write_text(place)
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            descr = event.get_description()
 | 
			
		||||
            if descr:
 | 
			
		||||
                self.doc.write_text( descr )
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.end_row()
 | 
			
		||||
            
 | 
			
		||||
        self.doc.end_table()
 | 
			
		||||
        
 | 
			
		||||
    def write_notes(self):
 | 
			
		||||
        nlist = self.database.get_note_handles()
 | 
			
		||||
        FilterClass = GenericFilterFactory('Note')
 | 
			
		||||
        filter = FilterClass()
 | 
			
		||||
        filter.add_rule(Rules.Note.HasMarkerOf([self.marker]))
 | 
			
		||||
        note_list = filter.apply(self.database,nlist)
 | 
			
		||||
        
 | 
			
		||||
        if not note_list:
 | 
			
		||||
            return
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_paragraph("MR-Heading")
 | 
			
		||||
        header = _("Notes")
 | 
			
		||||
        mark = BaseDoc.IndexMark(header,BaseDoc.INDEX_TYPE_TOC,2)
 | 
			
		||||
        self.doc.write_text(header,mark)
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
 | 
			
		||||
        self.doc.start_table('NoteTable','MR-Table')
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_row()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Id"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
 | 
			
		||||
        self.doc.start_cell('MR-TableCell')
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Type"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.start_cell('MR-TableCell',2)
 | 
			
		||||
        self.doc.start_paragraph('MR-Normal-Bold')
 | 
			
		||||
        self.doc.write_text(_("Text"))
 | 
			
		||||
        self.doc.end_paragraph()
 | 
			
		||||
        self.doc.end_cell()
 | 
			
		||||
        
 | 
			
		||||
        self.doc.end_row()
 | 
			
		||||
 | 
			
		||||
        for note_handle in note_list:
 | 
			
		||||
            note = self.database.get_note_from_handle(note_handle)
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_row()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            self.doc.write_text(note.get_gramps_id())
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()            
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell')
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            type = note.get_type()
 | 
			
		||||
            self.doc.write_text(str(type))
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.start_cell('MR-TableCell',2)
 | 
			
		||||
            self.doc.start_paragraph('MR-Normal')
 | 
			
		||||
            self.doc.write_text(note.get(True))
 | 
			
		||||
            self.doc.end_paragraph()
 | 
			
		||||
            self.doc.end_cell()
 | 
			
		||||
            
 | 
			
		||||
            self.doc.end_row()
 | 
			
		||||
            
 | 
			
		||||
        self.doc.end_table()
 | 
			
		||||
 | 
			
		||||
#------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
@@ -152,8 +475,9 @@ class MarkerOptions(ReportOptions):
 | 
			
		||||
 | 
			
		||||
    def make_default_style(self,default_style):
 | 
			
		||||
        """Make the default output style for the Marker Report."""
 | 
			
		||||
        # Paragraph Styles
 | 
			
		||||
        f = BaseDoc.FontStyle()
 | 
			
		||||
        f.set_size(12)
 | 
			
		||||
        f.set_size(16)
 | 
			
		||||
        f.set_type_face(BaseDoc.FONT_SANS_SERIF)
 | 
			
		||||
        f.set_bold(1)
 | 
			
		||||
        p = BaseDoc.ParagraphStyle()
 | 
			
		||||
@@ -166,6 +490,16 @@ class MarkerOptions(ReportOptions):
 | 
			
		||||
        p.set_description(_("The style used for the title of the page."))
 | 
			
		||||
        default_style.add_paragraph_style("MR-Title",p)
 | 
			
		||||
        
 | 
			
		||||
        font = BaseDoc.FontStyle()
 | 
			
		||||
        font.set(face=BaseDoc.FONT_SANS_SERIF,size=14,italic=1)
 | 
			
		||||
        para = BaseDoc.ParagraphStyle()
 | 
			
		||||
        para.set_font(font)
 | 
			
		||||
        para.set_header_level(2)
 | 
			
		||||
        para.set_top_margin(0.25)
 | 
			
		||||
        para.set_bottom_margin(0.25)
 | 
			
		||||
        para.set_description(_('The style used for the section headers.'))
 | 
			
		||||
        default_style.add_paragraph_style("MR-Heading",para)
 | 
			
		||||
        
 | 
			
		||||
        font = BaseDoc.FontStyle()
 | 
			
		||||
        font.set_size(12)
 | 
			
		||||
        p = BaseDoc.ParagraphStyle()
 | 
			
		||||
@@ -175,6 +509,30 @@ class MarkerOptions(ReportOptions):
 | 
			
		||||
        p.set_bottom_margin(ReportUtils.pt2cm(3))
 | 
			
		||||
        p.set_description(_('The basic style used for the text display.'))
 | 
			
		||||
        default_style.add_paragraph_style("MR-Normal",p)
 | 
			
		||||
        
 | 
			
		||||
        font = BaseDoc.FontStyle()
 | 
			
		||||
        font.set_size(12)
 | 
			
		||||
        font.set_bold(True)
 | 
			
		||||
        p = BaseDoc.ParagraphStyle()
 | 
			
		||||
        p.set(first_indent=-0.75,lmargin=.75)
 | 
			
		||||
        p.set_font(font)
 | 
			
		||||
        p.set_top_margin(ReportUtils.pt2cm(3))
 | 
			
		||||
        p.set_bottom_margin(ReportUtils.pt2cm(3))
 | 
			
		||||
        p.set_description(_('The basic style used for table headings.'))
 | 
			
		||||
        default_style.add_paragraph_style("MR-Normal-Bold",p)
 | 
			
		||||
        
 | 
			
		||||
        #Table Styles
 | 
			
		||||
        cell = BaseDoc.TableCellStyle()
 | 
			
		||||
        default_style.add_cell_style('MR-TableCell',cell)
 | 
			
		||||
 | 
			
		||||
        table = BaseDoc.TableStyle()
 | 
			
		||||
        table.set_width(100)
 | 
			
		||||
        table.set_columns(4)
 | 
			
		||||
        table.set_column_width(0,10)
 | 
			
		||||
        table.set_column_width(1,30)
 | 
			
		||||
        table.set_column_width(2,30)
 | 
			
		||||
        table.set_column_width(3,30)
 | 
			
		||||
        default_style.add_table_style('MR-Table',table)
 | 
			
		||||
 | 
			
		||||
#------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user