* 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
b5ba21b5e4
commit
159c0eb08f
@ -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
|
||||
|
@ -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
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -85,12 +82,7 @@ class IndivCompleteReport(Report.Report):
|
||||
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:
|
||||
|
@ -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