* src/Report.py: Fix adding styles and calling doc.init().
* src/BaseDoc.py: Restructure header; Replace tabs with spaces. * src/plugins/AncestorChart.py (calc): Remove doc.init() call. * src/plugins/AncestorChart2.py (calc): Remove doc.init() call. * src/plugins/Ancestors.py (define_table_styles): Add method. * src/plugins/FamilyGroup.py (define_table_styles): Add method. * src/plugins/FanChart.py (define_graphics_styles): Add method. * src/plugins/FtmStyleDescendants.py (define_table_styles): Add method. * src/plugins/FtmStyleAncestors.py: Minor cleanups * src/plugins/IndivComplete.py (define_table_styles): Add method. * src/plugins/IndivSummary.py (define_table_styles): Add method. * src/plugins/Partition.py: Remove from CVS. * src/plugins/StatisticsChart.py (define_graphics_styles): Add method. * src/plugins/TimeLine.py (define_graphics_styles): Add method. svn: r3948
This commit is contained in:
parent
e70e6c6e68
commit
73f958b915
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
||||
2005-01-24 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/Report.py: Fix adding styles and calling doc.init().
|
||||
* src/BaseDoc.py: Restructure header; Replace tabs with spaces.
|
||||
* src/plugins/AncestorChart.py (calc): Remove doc.init() call.
|
||||
* src/plugins/AncestorChart2.py (calc): Remove doc.init() call.
|
||||
* src/plugins/Ancestors.py (define_table_styles): Add method.
|
||||
* src/plugins/FamilyGroup.py (define_table_styles): Add method.
|
||||
* src/plugins/FanChart.py (define_graphics_styles): Add method.
|
||||
* src/plugins/FtmStyleDescendants.py (define_table_styles):
|
||||
Add method.
|
||||
* src/plugins/FtmStyleAncestors.py: Minor cleanups
|
||||
* src/plugins/IndivComplete.py (define_table_styles): Add method.
|
||||
* src/plugins/IndivSummary.py (define_table_styles): Add method.
|
||||
* src/plugins/Partition.py: Remove from CVS.
|
||||
* src/plugins/StatisticsChart.py (define_graphics_styles):
|
||||
Add method.
|
||||
* src/plugins/TimeLine.py (define_graphics_styles): Add method.
|
||||
|
||||
2005-01-23 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/BaseDoc.py: don't check for init on table or cell addition
|
||||
* src/Report.py: Call doc.init() before write_report
|
||||
|
@ -1,8 +1,23 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||
# Copyright (C) 2000-2005 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
|
||||
#
|
||||
|
||||
# Modified September 2002 by Gary Shao
|
||||
#
|
||||
# Added line_break() method to BaseDoc class to allow breaking a line
|
||||
@ -34,20 +49,6 @@
|
||||
# modules the PDF generator is based on does not support them at this
|
||||
# time)
|
||||
#
|
||||
# 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$
|
||||
|
||||
@ -120,7 +121,6 @@ GRAPHICS_MODE = 1
|
||||
SOLID = 0
|
||||
DASHED = 1
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# cnv2color
|
||||
@ -287,7 +287,7 @@ class FontStyle:
|
||||
|
||||
def get_color(self):
|
||||
"Returns an RGB color tuple"
|
||||
return self.color
|
||||
return self.color
|
||||
|
||||
def set_size(self,val):
|
||||
"sets font size in points"
|
||||
@ -385,7 +385,7 @@ class TableStyle:
|
||||
@param index: column being set (index starts at 0)
|
||||
@param width: percentage of the table width assigned to the column
|
||||
"""
|
||||
self.colwid[index] = width
|
||||
self.colwid[index] = width
|
||||
|
||||
def get_column_width(self,index):
|
||||
"""
|
||||
@ -394,7 +394,7 @@ class TableStyle:
|
||||
|
||||
@param index: column to return (index starts at 0)
|
||||
"""
|
||||
return self.colwid[index]
|
||||
return self.colwid[index]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -419,15 +419,15 @@ class TableCellStyle:
|
||||
self.tborder = obj.tborder
|
||||
self.bborder = obj.bborder
|
||||
self.padding = obj.padding
|
||||
self.longlist = obj.longlist
|
||||
self.longlist = obj.longlist
|
||||
else:
|
||||
self.rborder = 0
|
||||
self.lborder = 0
|
||||
self.tborder = 0
|
||||
self.bborder = 0
|
||||
self.padding = 0
|
||||
self.longlist = 0
|
||||
|
||||
self.longlist = 0
|
||||
|
||||
def set_padding(self,val):
|
||||
"Returns the cell padding in centimeters"
|
||||
self.padding = val
|
||||
@ -514,11 +514,11 @@ class ParagraphStyle:
|
||||
self.lmargin = source.lmargin
|
||||
self.first_indent = source.first_indent
|
||||
self.align = source.align
|
||||
self.level = source.level
|
||||
self.top_border = source.top_border
|
||||
self.bottom_border = source.bottom_border
|
||||
self.right_border = source.right_border
|
||||
self.left_border = source.left_border
|
||||
self.level = source.level
|
||||
self.top_border = source.top_border
|
||||
self.bottom_border = source.bottom_border
|
||||
self.right_border = source.right_border
|
||||
self.left_border = source.left_border
|
||||
self.pad = source.pad
|
||||
self.bgcolor = source.bgcolor
|
||||
self.description = source.description
|
||||
@ -528,11 +528,11 @@ class ParagraphStyle:
|
||||
self.lmargin = 0
|
||||
self.first_indent = 0
|
||||
self.align = PARA_ALIGN_LEFT
|
||||
self.level = 0
|
||||
self.top_border = 0
|
||||
self.bottom_border = 0
|
||||
self.right_border = 0
|
||||
self.left_border = 0
|
||||
self.level = 0
|
||||
self.top_border = 0
|
||||
self.bottom_border = 0
|
||||
self.right_border = 0
|
||||
self.left_border = 0
|
||||
self.pad = 0
|
||||
self.bgcolor = (255,255,255)
|
||||
self.description = ""
|
||||
@ -646,7 +646,7 @@ class ParagraphStyle:
|
||||
|
||||
def get_bottom_border(self):
|
||||
"Returns 1 if a bottom border is specified"
|
||||
return self.bottom_border
|
||||
return self.bottom_border
|
||||
|
||||
def set_left_border(self,val):
|
||||
"""
|
||||
@ -719,27 +719,27 @@ class ParagraphStyle:
|
||||
return "unknown"
|
||||
|
||||
def set_left_margin(self,value):
|
||||
"sets the left paragraph margin in centimeters"
|
||||
"sets the left paragraph margin in centimeters"
|
||||
self.lmargin = value
|
||||
|
||||
def set_right_margin(self,value):
|
||||
"sets the right paragraph margin in centimeters"
|
||||
"sets the right paragraph margin in centimeters"
|
||||
self.rmargin = value
|
||||
|
||||
def set_first_indent(self,value):
|
||||
"sets the first indent margin in centimeters"
|
||||
"sets the first indent margin in centimeters"
|
||||
self.first_indent = value
|
||||
|
||||
def get_left_margin(self):
|
||||
"returns the left margin in centimeters"
|
||||
"returns the left margin in centimeters"
|
||||
return self.lmargin
|
||||
|
||||
def get_right_margin(self):
|
||||
"returns the right margin in centimeters"
|
||||
"returns the right margin in centimeters"
|
||||
return self.rmargin
|
||||
|
||||
def get_first_indent(self):
|
||||
"returns the first indent margin in centimeters"
|
||||
"returns the first indent margin in centimeters"
|
||||
return self.first_indent
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -996,7 +996,7 @@ class GraphicsStyle:
|
||||
self.para_name = obj.para_name
|
||||
self.shadow = obj.shadow
|
||||
self.shadow_space = obj.shadow_space
|
||||
self.color = obj.color
|
||||
self.color = obj.color
|
||||
self.fill_color = obj.fill_color
|
||||
self.lwidth = obj.lwidth
|
||||
self.lstyle = obj.lstyle
|
||||
@ -1049,7 +1049,7 @@ class GraphicsStyle:
|
||||
return self.height
|
||||
|
||||
def get_width(self):
|
||||
return self.width
|
||||
return self.width
|
||||
|
||||
def get_paragraph_style(self):
|
||||
return self.para_name
|
||||
@ -1105,10 +1105,10 @@ class BaseDoc:
|
||||
self.title = ""
|
||||
self.owner = ''
|
||||
|
||||
self.draw_styles = {}
|
||||
self.draw_styles = {}
|
||||
self.font = FontStyle()
|
||||
self.style_list = styles.get_styles()
|
||||
self.table_styles = {}
|
||||
self.table_styles = {}
|
||||
self.cell_styles = {}
|
||||
self.name = ""
|
||||
self.media_list = []
|
||||
@ -1235,7 +1235,7 @@ class BaseDoc:
|
||||
|
||||
def line_break(self):
|
||||
"Forces a line break within a paragraph"
|
||||
pass
|
||||
pass
|
||||
|
||||
def page_break(self):
|
||||
"Forces a page break, creating a new page"
|
||||
@ -1255,10 +1255,10 @@ class BaseDoc:
|
||||
|
||||
def start_listing(self,style_name):
|
||||
"""
|
||||
Starts a new listing block, using the specified style name.
|
||||
Starts a new listing block, using the specified style name.
|
||||
|
||||
@param style_name: name of the ParagraphStyle to use for the block.
|
||||
"""
|
||||
"""
|
||||
pass
|
||||
|
||||
def end_listing(self):
|
||||
@ -1353,10 +1353,10 @@ class BaseDoc:
|
||||
pass
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
pass
|
||||
pass
|
||||
|
||||
def write_at(self,style,text,x,y):
|
||||
pass
|
||||
pass
|
||||
|
||||
def draw_bar(self,style,x1,y1,x2,y2):
|
||||
pass
|
||||
@ -1371,7 +1371,7 @@ class BaseDoc:
|
||||
pass
|
||||
|
||||
def draw_line(self,style,x1,y1,x2,y2):
|
||||
pass
|
||||
pass
|
||||
|
||||
def draw_wedge(self, style, centerx, centery, radius, start_angle,
|
||||
end_angle, short_radius=0):
|
||||
|
@ -216,12 +216,13 @@ class Report:
|
||||
if output:
|
||||
self.standalone = True
|
||||
self.doc.open(options_class.get_output())
|
||||
self.doc.init()
|
||||
else:
|
||||
self.standalone = False
|
||||
|
||||
self.define_table_styles()
|
||||
self.define_graphics_styles()
|
||||
|
||||
def begin_report(self):
|
||||
self.doc.init()
|
||||
if self.options_class.get_newpage():
|
||||
self.doc.page_break()
|
||||
|
||||
@ -232,6 +233,18 @@ class Report:
|
||||
if self.standalone:
|
||||
self.doc.close()
|
||||
|
||||
def define_table_styles(self):
|
||||
"""
|
||||
This method MUST be used for adding table and cell styles.
|
||||
"""
|
||||
pass
|
||||
|
||||
def define_graphics_styles(self):
|
||||
"""
|
||||
This method MUST be used for adding drawing styles.
|
||||
"""
|
||||
pass
|
||||
|
||||
def get_progressbar_data(self):
|
||||
"""The window title for this dialog, and the header line to
|
||||
put at the top of the contents of the dialog box."""
|
||||
@ -1759,6 +1772,7 @@ def report(database,person,report_class,options_class,translated_name,name,categ
|
||||
if response:
|
||||
try:
|
||||
MyReport = report_class(dialog.db,dialog.person,dialog.options)
|
||||
MyReport.doc.init()
|
||||
MyReport.begin_report()
|
||||
MyReport.write_report()
|
||||
MyReport.end_report()
|
||||
@ -1806,6 +1820,7 @@ def cl_report(database,name,category,report_class,options_class,options_str_dict
|
||||
clr.option_class.handler.doc = clr.format(
|
||||
clr.selected_style,clr.paper,clr.template_name,clr.orien)
|
||||
MyReport = report_class(database, clr.person, clr.option_class)
|
||||
MyReport.doc.init()
|
||||
MyReport.begin_report()
|
||||
MyReport.write_report()
|
||||
MyReport.end_report()
|
||||
|
@ -177,8 +177,6 @@ class AncestorChart(Report.Report):
|
||||
|
||||
g = BaseDoc.GraphicsStyle()
|
||||
self.doc.add_draw_style("AC-line",g)
|
||||
if self.standalone:
|
||||
self.doc.init()
|
||||
|
||||
def get_numbers(self,start,index,vals):
|
||||
if index > 4:
|
||||
|
@ -344,8 +344,6 @@ class AncestorChart(Report.Report):
|
||||
|
||||
g = BaseDoc.GraphicsStyle()
|
||||
self.doc.add_draw_style("AC2-line",g)
|
||||
if self.standalone:
|
||||
self.doc.init()
|
||||
|
||||
def print_page(self,startx,stopx,starty,stopy,colx,coly):
|
||||
|
||||
|
@ -86,6 +86,7 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
self.RelClass = PluginMgr.relationship_class
|
||||
self.relationship = self.RelClass(database)
|
||||
|
||||
def define_table_styles(self):
|
||||
table = BaseDoc.TableStyle ()
|
||||
table.set_column_widths ([15, 85])
|
||||
table.set_width (100)
|
||||
@ -131,7 +132,6 @@ class ComprehensiveAncestorsReport (Report.Report):
|
||||
cell.set_padding (0.1)
|
||||
self.doc.add_cell_style ("AR-Entry", cell)
|
||||
|
||||
|
||||
def write_report(self):
|
||||
self.sources = []
|
||||
name = self.person_name (self.start_person.get_handle())
|
||||
|
@ -89,9 +89,7 @@ class FamilyGroup(Report.Report):
|
||||
self.family = family
|
||||
break
|
||||
|
||||
self.setup()
|
||||
|
||||
def setup(self):
|
||||
def define_table_styles(self):
|
||||
"""
|
||||
Define the table styles used by the report.
|
||||
"""
|
||||
|
@ -54,7 +54,6 @@ from ReportUtils import pt2cm
|
||||
class FanChart(Report.Report):
|
||||
|
||||
def __init__(self,database,person,options_class):
|
||||
#database,person,display,doc,output,newpage=0):
|
||||
"""
|
||||
Creates the FanChart object that produces the report.
|
||||
|
||||
@ -78,9 +77,7 @@ class FanChart(Report.Report):
|
||||
self.text= {}
|
||||
self.box_width = 0
|
||||
|
||||
self.setup()
|
||||
|
||||
def setup(self):
|
||||
def define_graphics_styles(self):
|
||||
g = BaseDoc.GraphicsStyle()
|
||||
g.set_paragraph_style('FC-Title')
|
||||
g.set_line_width(0)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2003-2004 Donald N. Allingham
|
||||
# Copyright (C) 2003-2005 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
|
||||
@ -37,19 +37,10 @@ from gettext import gettext as _
|
||||
import Report
|
||||
import BaseDoc
|
||||
import RelLib
|
||||
import Errors
|
||||
from QuestionDialog import ErrorDialog
|
||||
import ReportOptions
|
||||
import DateHandler
|
||||
from DateHandler import displayer as dd
|
||||
import const
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
dd = DateHandler.displayer
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# AncestorReport
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2003-2004 Donald N. Allingham
|
||||
# Copyright (C) 2003-2005 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
|
||||
@ -40,20 +40,11 @@ from gettext import gettext as _
|
||||
import Report
|
||||
import BaseDoc
|
||||
import RelLib
|
||||
import Errors
|
||||
import Utils
|
||||
import ReportOptions
|
||||
from QuestionDialog import ErrorDialog
|
||||
import DateHandler
|
||||
from DateHandler import displayer as dd
|
||||
import const
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
dd = DateHandler.displayer
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# DescendantReport
|
||||
@ -86,12 +77,10 @@ class FtmDescendantReport(Report.Report):
|
||||
(self.max_generations,self.pgbrk) \
|
||||
= options_class.get_report_generations()
|
||||
|
||||
self.setup()
|
||||
|
||||
self.sref_map = {}
|
||||
self.sref_index = 0
|
||||
|
||||
def setup(self):
|
||||
def define_table_styles(self):
|
||||
tbl = BaseDoc.TableStyle()
|
||||
tbl.set_width(100)
|
||||
tbl.set_columns(3)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||
# Copyright (C) 2000-2005 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
|
||||
@ -43,11 +43,8 @@ import gtk
|
||||
import RelLib
|
||||
import const
|
||||
import BaseDoc
|
||||
import StyleEditor
|
||||
import Report
|
||||
import GenericFilter
|
||||
import Errors
|
||||
from QuestionDialog import ErrorDialog
|
||||
import ReportOptions
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -84,13 +81,8 @@ class IndivCompleteReport(Report.Report):
|
||||
filters = options_class.get_report_filters(person)
|
||||
filters.extend(GenericFilter.CustomFilters.get_filters())
|
||||
self.filter = filters[filter_num]
|
||||
|
||||
c = database.get_researcher().get_name()
|
||||
self.doc.creator(c)
|
||||
self.map = {}
|
||||
self.setup()
|
||||
|
||||
def setup(self):
|
||||
def define_table_styles(self):
|
||||
tbl = BaseDoc.TableStyle()
|
||||
tbl.set_width(100)
|
||||
tbl.set_columns(2)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||
# Copyright (C) 2000-2005 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
|
||||
@ -45,10 +45,7 @@ import gtk
|
||||
import RelLib
|
||||
import const
|
||||
import BaseDoc
|
||||
import StyleEditor
|
||||
import Report
|
||||
import Errors
|
||||
from QuestionDialog import ErrorDialog
|
||||
import ReportOptions
|
||||
import const
|
||||
|
||||
@ -73,10 +70,7 @@ class IndivSummary(Report.Report):
|
||||
|
||||
Report.Report.__init__(self,database,person,options_class)
|
||||
|
||||
self.map = {}
|
||||
self.setup()
|
||||
|
||||
def setup(self):
|
||||
def define_table_styles(self):
|
||||
tbl = BaseDoc.TableStyle()
|
||||
tbl.set_width(100)
|
||||
tbl.set_columns(2)
|
||||
|
@ -1,234 +0,0 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2003 Jesper Zedlitz
|
||||
# Copyright (C) 2003-2004 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$
|
||||
|
||||
"Export/Partition"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
import posixpath
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import Utils
|
||||
import RelLib
|
||||
import GrampsCfg
|
||||
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gettext import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GNOME/GTK modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gobject
|
||||
import gtk
|
||||
import gtk.glade
|
||||
from gnome.ui import *
|
||||
import WriteXML
|
||||
|
||||
personSeen = []
|
||||
familySeen = []
|
||||
#database_for_unlinked_persons = RelLib.GrampsDB()
|
||||
prefix = "/tmp/test"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def work_on_person( db, person ):
|
||||
global personSeen
|
||||
|
||||
if (len(person.get_family_handle_list()) + len(person.get_parent_family_handle_list())) > 0:
|
||||
database = db
|
||||
#else:
|
||||
# database = database_for_unlinked_persons
|
||||
|
||||
if( database.get_person_handle_map().has_key( person.get_handle() ) ):
|
||||
return
|
||||
|
||||
database.add_person_no_map( person, person.get_handle() )
|
||||
personSeen.append(person)
|
||||
|
||||
for source_ref in person.get_primary_name().get_source_references():
|
||||
work_on_sourceref( database, source_ref)
|
||||
|
||||
for name in person.get_alternate_names():
|
||||
for source_ref in name.get_source_references():
|
||||
work_on_sourceref( database, source_ref)
|
||||
|
||||
work_on_event( database, person.get_birth() )
|
||||
work_on_event( database, person.get_death() )
|
||||
for event in person.get_event_list():
|
||||
work_on_event(database, event)
|
||||
|
||||
# recursion
|
||||
for fam in person.get_family_handle_list():
|
||||
work_on_family( database, fam )
|
||||
|
||||
for fam in person.get_parent_family_handle_list():
|
||||
work_on_family( database, fam[0] )
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def work_on_family( database, family ):
|
||||
global familySeen
|
||||
if database.get_family_handle_map().has_key( family.get_handle() ):
|
||||
return
|
||||
|
||||
database.get_family_handle_map()[family.get_handle()] = family
|
||||
familySeen.append(family)
|
||||
|
||||
work_on_event( database, family.get_marriage() )
|
||||
for event in family.get_event_list():
|
||||
work_on_event(database, event)
|
||||
|
||||
|
||||
# recursion
|
||||
father = family.get_father_handle()
|
||||
if( father != None ):
|
||||
work_on_person( database, father )
|
||||
|
||||
mother = family.get_mother_handle()
|
||||
if( mother != None ):
|
||||
work_on_person( database, mother )
|
||||
|
||||
for person in family.get_child_handle_list():
|
||||
work_on_person( database, person )
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def work_on_sourceref( database, source_ref ):
|
||||
if source_ref == None:
|
||||
return
|
||||
|
||||
source = source_ref.get_base_handle()
|
||||
if source == None:
|
||||
return
|
||||
|
||||
if database.get_source_map().has_key(source.get_handle()):
|
||||
return
|
||||
|
||||
database.add_source_no_map( source, source.get_handle() );
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def work_on_event( database, event ):
|
||||
if event == None:
|
||||
return
|
||||
|
||||
for source_ref in event.get_source_references():
|
||||
work_on_sourceref( database, source_ref)
|
||||
|
||||
work_on_place( database, event.get_place_handle() )
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def work_on_place( database, place ):
|
||||
if place == None:
|
||||
return
|
||||
|
||||
if place in database.get_place_handles():
|
||||
return
|
||||
database.add_place_no_map(place, place.get_handle())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def report(db, person):
|
||||
global personSeen
|
||||
global prefix
|
||||
global database_for_unlinked_persons
|
||||
|
||||
text = "=== Partitions ===\n"
|
||||
count = 0
|
||||
for p in db.get_person_handle_map().values():
|
||||
if not p in personSeen:
|
||||
database = RelLib.GrampsDB()
|
||||
work_on_person( database, p )
|
||||
|
||||
person_len = len(database.get_person_handles(sort_handles=False))
|
||||
if person_len > 0:
|
||||
g = WriteXML.XmlWriter(database,None,0,0)
|
||||
g.write(prefix+str(count)+".xml")
|
||||
text += "partition "+prefix+str(count)+".xml written ( "+str(person_len)+" persons)\n"
|
||||
count += 1
|
||||
|
||||
g = WriteXML.XmlWriter(database_for_unlinked_persons,None,0,0)
|
||||
g.write(prefix+".xml")
|
||||
text += "partition "+prefix+".xml written ( "+str(len(database_for_unlinked_persons.get_person_handles(sort_handles=False)))+" persons)\n"
|
||||
|
||||
base = os.path.dirname(__file__)
|
||||
glade_file = "%s/summary.glade" % base
|
||||
|
||||
topDialog = gtk.glade.XML(glade_file,"summary","gramps")
|
||||
topDialog.signal_autoconnect({
|
||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
||||
})
|
||||
|
||||
top = topDialog.get_widget("summary")
|
||||
textwindow = topDialog.get_widget("textwindow")
|
||||
textwindow.get_buffer().set_text(text)
|
||||
top.show()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from PluginMgr import register_report
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Partitions"),
|
||||
status=(_("Alpha")),
|
||||
category=_("Export"),
|
||||
description=_("This program partitions individuals in a database into disjoint partitions.\n"+
|
||||
"A partition is composed of people related by one or more multiple relations.\n"+
|
||||
"There should be no known relationship between people in different partitions.")
|
||||
)
|
||||
|
@ -409,8 +409,6 @@ class StatisticsChart(Report.Report):
|
||||
print heading
|
||||
print table[1]
|
||||
|
||||
self.setup()
|
||||
|
||||
|
||||
def index_items(self, data, sort, reverse):
|
||||
"""creates & stores a sorted index for the items"""
|
||||
@ -434,7 +432,7 @@ class StatisticsChart(Report.Report):
|
||||
return index
|
||||
|
||||
|
||||
def setup(self):
|
||||
def define_graphics_styles(self):
|
||||
"""
|
||||
Define the graphics styles used by the report. Paragraph definitions
|
||||
have already been defined in the document. The styles used are:
|
||||
@ -466,7 +464,7 @@ class StatisticsChart(Report.Report):
|
||||
g.set_width(self.doc.get_usable_width())
|
||||
self.doc.add_draw_style("SC-title",g)
|
||||
|
||||
|
||||
|
||||
def write_report(self):
|
||||
"output the selected statistics..."
|
||||
|
||||
|
@ -95,9 +95,7 @@ class TimeLine(Report.Report):
|
||||
sort_functions = options_class.get_sort_functions(Sort.Sort(database))
|
||||
self.sort_func = sort_functions[sort_func_num][1]
|
||||
|
||||
self.setup()
|
||||
|
||||
def setup(self):
|
||||
def define_graphics_styles(self):
|
||||
"""
|
||||
Define the graphics styles used by the report. Paragraph definitions
|
||||
have already been defined in the document. The styles used are:
|
||||
|
Loading…
Reference in New Issue
Block a user