* src/Plugins.py: add GrampsBookFormatComboBox class
* src/Report.py: Roll common functions into Report class * src/plugins/AncestorReport.py: Bring up to date with Report * src/plugins/Ancestors.py: Bring up to date with Report * src/plugins/BookReport.py: Bring up to date with Report, incorporate new ComboBox * src/plugins/DescendReport.py: Bring up to date with Report * src/pulgins/FtmStyleAncestors.py: Bring up to date with Report * src/pulgins/FtmStyleDescendants.py: Bring up to date with Report * src/plugins/IndivSummary.py: Bring up to date with Report * src/plugins/TimeLine.py: Bring up to date with Report svn: r3843
This commit is contained in:
14
ChangeLog
14
ChangeLog
@@ -1,3 +1,17 @@
|
|||||||
|
2004-12-29 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
|
* src/Plugins.py: add GrampsBookFormatComboBox class
|
||||||
|
* src/Report.py: Roll common functions into Report class
|
||||||
|
* src/plugins/AncestorReport.py: Bring up to date with Report
|
||||||
|
* src/plugins/Ancestors.py: Bring up to date with Report
|
||||||
|
* src/plugins/BookReport.py: Bring up to date with Report,
|
||||||
|
incorporate new ComboBox
|
||||||
|
* src/plugins/DescendReport.py: Bring up to date with Report
|
||||||
|
* src/pulgins/FtmStyleAncestors.py: Bring up to date with Report
|
||||||
|
* src/pulgins/FtmStyleDescendants.py: Bring up to date
|
||||||
|
with Report
|
||||||
|
* src/plugins/IndivSummary.py: Bring up to date with Report
|
||||||
|
* src/plugins/TimeLine.py: Bring up to date with Report
|
||||||
|
|
||||||
2004-12-29 Alex Roitman <shura@alex.neuro.umn.edu>
|
2004-12-29 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/DisplayTrace.py: Typo in the debian version filename.
|
* src/DisplayTrace.py: Typo in the debian version filename.
|
||||||
* src/plugins/Ancestors.py: Convert to new scheme.
|
* src/plugins/Ancestors.py: Convert to new scheme.
|
||||||
|
@@ -936,48 +936,47 @@ class GrampsDrawFormatComboBox(gtk.ComboBox):
|
|||||||
def get_printable(self):
|
def get_printable(self):
|
||||||
return _drawdoc[self.get_active()][5]
|
return _drawdoc[self.get_active()][5]
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
class GrampsBookFormatComboBox(gtk.ComboBox):
|
||||||
#
|
|
||||||
# get_book_menu
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
def get_book_menu(main_menu,tables,callback,obj=None,active=None):
|
|
||||||
|
|
||||||
index = 0
|
def set(self,tables,callback,obj=None,active=None):
|
||||||
myMenu = gtk.Menu()
|
self.store = gtk.ListStore(str)
|
||||||
_bookdoc.sort()
|
self.set_model(self.store)
|
||||||
active_found = False
|
cell = gtk.CellRendererText()
|
||||||
other_active = None
|
self.pack_start(cell,True)
|
||||||
for item in _bookdoc:
|
self.add_attribute(cell,'text',0)
|
||||||
if tables and item[2] == 0:
|
|
||||||
continue
|
|
||||||
name = item[0]
|
|
||||||
menuitem = gtk.MenuItem(name)
|
|
||||||
menuitem.set_data("name",item[1])
|
|
||||||
menuitem.set_data("label",name)
|
|
||||||
menuitem.set_data("styles",item[4])
|
|
||||||
menuitem.set_data("paper",item[3])
|
|
||||||
menuitem.set_data("ext",item[5])
|
|
||||||
menuitem.set_data("obj",obj)
|
|
||||||
if callback:
|
|
||||||
menuitem.connect("activate",callback)
|
|
||||||
menuitem.show()
|
|
||||||
myMenu.append(menuitem)
|
|
||||||
if name == active:
|
|
||||||
myMenu.set_active(index)
|
|
||||||
if callback:
|
|
||||||
callback(menuitem)
|
|
||||||
active_found = True
|
|
||||||
elif name == GrampsGconfKeys.get_output_preference():
|
|
||||||
other_active = index
|
|
||||||
other_item = menuitem
|
|
||||||
index = index + 1
|
|
||||||
|
|
||||||
if other_active and not active_found:
|
out_pref = GrampsGconfKeys.get_output_preference()
|
||||||
myMenu.set_active(index)
|
index = 0
|
||||||
if callback:
|
_drawdoc.sort()
|
||||||
callback(other_item)
|
active_index = 0
|
||||||
main_menu.set_menu(myMenu)
|
self.data = []
|
||||||
|
for item in _bookdoc:
|
||||||
|
if tables and item[2] == 0:
|
||||||
|
continue
|
||||||
|
self.data.append(item)
|
||||||
|
name = item[0]
|
||||||
|
self.store.append(row=[name])
|
||||||
|
if name == active:
|
||||||
|
active_index = index
|
||||||
|
elif not active and name == out_pref:
|
||||||
|
active_index = index
|
||||||
|
index += 1
|
||||||
|
self.set_active(active_index)
|
||||||
|
|
||||||
|
def get_reference(self):
|
||||||
|
return self.data[self.get_active()][1]
|
||||||
|
|
||||||
|
def get_label(self):
|
||||||
|
return self.data[self.get_active()][0]
|
||||||
|
|
||||||
|
def get_paper(self):
|
||||||
|
return self.data[self.get_active()][3]
|
||||||
|
|
||||||
|
def get_ext(self):
|
||||||
|
return self.data[self.get_active()][5]
|
||||||
|
|
||||||
|
def get_printable(self):
|
||||||
|
return self.data[self.get_active()][6]
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@@ -201,6 +201,34 @@ class Report:
|
|||||||
29: _("Twenty-ninth")
|
29: _("Twenty-ninth")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def __init__(self, database, person, options_class):
|
||||||
|
self.database = database
|
||||||
|
self.start_person = person
|
||||||
|
self.options_class = options_class
|
||||||
|
|
||||||
|
self.doc = options_class.get_document()
|
||||||
|
|
||||||
|
creator = database.get_researcher().get_name()
|
||||||
|
self.doc.creator(creator)
|
||||||
|
|
||||||
|
if options_class.get_output():
|
||||||
|
self.standalone = True
|
||||||
|
self.doc.open(output)
|
||||||
|
self.doc.init()
|
||||||
|
else:
|
||||||
|
self.standalone = False
|
||||||
|
|
||||||
|
def begin_report(self):
|
||||||
|
if self.options_class.get_newpage():
|
||||||
|
self.doc.page_break()
|
||||||
|
|
||||||
|
def write_report(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def finish_report(self):
|
||||||
|
if self.standalone:
|
||||||
|
self.doc.close()
|
||||||
|
|
||||||
def get_progressbar_data(self):
|
def get_progressbar_data(self):
|
||||||
"""The window title for this dialog, and the header line to
|
"""The window title for this dialog, and the header line to
|
||||||
put at the top of the contents of the dialog box."""
|
put at the top of the contents of the dialog box."""
|
||||||
@@ -1232,7 +1260,7 @@ class ReportDialog(BareReportDialog):
|
|||||||
self.template_combo.append_text(template)
|
self.template_combo.append_text(template)
|
||||||
self.template_combo.append_text(_user_template)
|
self.template_combo.append_text(_user_template)
|
||||||
|
|
||||||
self.template_combo.set_active(0)
|
self.template_combo.set_active(False)
|
||||||
self.template_combo.connect('changed',self.html_file_enable)
|
self.template_combo.connect('changed',self.html_file_enable)
|
||||||
|
|
||||||
self.html_table.attach(self.template_combo,2,3,1,2)
|
self.html_table.attach(self.template_combo,2,3,1,2)
|
||||||
@@ -1242,7 +1270,7 @@ class ReportDialog(BareReportDialog):
|
|||||||
self.html_fileentry = gnome.ui.FileEntry("HTML_Template",
|
self.html_fileentry = gnome.ui.FileEntry("HTML_Template",
|
||||||
_("Choose File"))
|
_("Choose File"))
|
||||||
self.html_fileentry.set_modal(True)
|
self.html_fileentry.set_modal(True)
|
||||||
self.html_fileentry.set_sensitive(0)
|
self.html_fileentry.set_sensitive(False)
|
||||||
user_template = ''
|
user_template = ''
|
||||||
if os.path.isfile(user_template):
|
if os.path.isfile(user_template):
|
||||||
self.html_fileentry.set_filename(user_template)
|
self.html_fileentry.set_filename(user_template)
|
||||||
@@ -1711,7 +1739,9 @@ def report(database,person,report_class,options_class,translated_name,name,categ
|
|||||||
if response == True:
|
if response == True:
|
||||||
try:
|
try:
|
||||||
MyReport = report_class(dialog.db,dialog.person,dialog.options)
|
MyReport = report_class(dialog.db,dialog.person,dialog.options)
|
||||||
|
MyReport.begin_report()
|
||||||
MyReport.write_report()
|
MyReport.write_report()
|
||||||
|
MyReport.end_report()
|
||||||
except Errors.FilterError, msg:
|
except Errors.FilterError, msg:
|
||||||
(m1,m2) = msg.messages()
|
(m1,m2) = msg.messages()
|
||||||
ErrorDialog(m1,m2)
|
ErrorDialog(m1,m2)
|
||||||
|
@@ -78,26 +78,13 @@ class AncestorReport(Report.Report):
|
|||||||
newpage - if True, newpage is made before writing a report
|
newpage - if True, newpage is made before writing a report
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.database = database
|
|
||||||
self.start = person
|
Report.Report.__init__(self,database,person,options_class)
|
||||||
self.options_class = options_class
|
|
||||||
|
|
||||||
self.map = {}
|
self.map = {}
|
||||||
|
|
||||||
(self.max_generations,self.pgbrk) \
|
(self.max_generations,self.pgbrk) \
|
||||||
= options_class.get_report_generations()
|
= options_class.get_report_generations()
|
||||||
|
|
||||||
self.doc = options_class.get_document()
|
|
||||||
output = options_class.get_output()
|
|
||||||
self.newpage = options_class.get_newpage()
|
|
||||||
|
|
||||||
if output:
|
|
||||||
self.standalone = 1
|
|
||||||
self.doc.open(output)
|
|
||||||
self.doc.init()
|
|
||||||
else:
|
|
||||||
self.standalone = 0
|
|
||||||
|
|
||||||
def filter(self,person_handle,index,generation=1):
|
def filter(self,person_handle,index,generation=1):
|
||||||
if not person_handle or generation >= self.max_generations:
|
if not person_handle or generation >= self.max_generations:
|
||||||
return
|
return
|
||||||
@@ -112,12 +99,9 @@ class AncestorReport(Report.Report):
|
|||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
|
|
||||||
if self.newpage:
|
self.filter(self.start_person.get_handle(),1)
|
||||||
self.doc.page_break()
|
|
||||||
|
|
||||||
self.filter(self.start.get_handle(),1)
|
name = self.start_person.get_primary_name().get_regular_name()
|
||||||
|
|
||||||
name = self.start.get_primary_name().get_regular_name()
|
|
||||||
self.doc.start_paragraph("AHN-Title")
|
self.doc.start_paragraph("AHN-Title")
|
||||||
title = _("Ahnentafel Report for %s") % name
|
title = _("Ahnentafel Report for %s") % name
|
||||||
self.doc.write_text(title)
|
self.doc.write_text(title)
|
||||||
@@ -268,9 +252,6 @@ class AncestorReport(Report.Report):
|
|||||||
self.doc.write_text(".")
|
self.doc.write_text(".")
|
||||||
|
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
if self.standalone:
|
|
||||||
self.doc.close()
|
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@@ -61,9 +61,7 @@ class ComprehensiveAncestorsReport (Report.Report):
|
|||||||
def __init__(self,database,person,options_class):
|
def __init__(self,database,person,options_class):
|
||||||
#,max,pgbrk,cite,doc,output,newpage=0):
|
#,max,pgbrk,cite,doc,output,newpage=0):
|
||||||
|
|
||||||
self.database = database
|
Report.Report.__init__(self,database,person,options_class)
|
||||||
self.start = person
|
|
||||||
self.options_class = options_class
|
|
||||||
|
|
||||||
self.map = {}
|
self.map = {}
|
||||||
|
|
||||||
@@ -72,7 +70,6 @@ class ComprehensiveAncestorsReport (Report.Report):
|
|||||||
#self.opt_cite = cite
|
#self.opt_cite = cite
|
||||||
self.opt_cite = options_class.handler.options_dict['cites']
|
self.opt_cite = options_class.handler.options_dict['cites']
|
||||||
|
|
||||||
self.doc = options_class.get_document()
|
|
||||||
self.output = options_class.get_output()
|
self.output = options_class.get_output()
|
||||||
self.newpage = options_class.get_newpage()
|
self.newpage = options_class.get_newpage()
|
||||||
|
|
||||||
@@ -126,19 +123,10 @@ class ComprehensiveAncestorsReport (Report.Report):
|
|||||||
cell.set_padding (0.1)
|
cell.set_padding (0.1)
|
||||||
self.doc.add_cell_style ("AR-Entry", cell)
|
self.doc.add_cell_style ("AR-Entry", cell)
|
||||||
|
|
||||||
if self.output:
|
|
||||||
self.standalone = 1
|
|
||||||
self.doc.open(self.output)
|
|
||||||
self.doc.init()
|
|
||||||
else:
|
|
||||||
self.standalone = 0
|
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
if self.newpage:
|
|
||||||
self.doc.page_break()
|
|
||||||
|
|
||||||
self.sources = []
|
self.sources = []
|
||||||
name = self.person_name (self.start.get_handle())
|
name = self.person_name (self.start_person.get_handle())
|
||||||
self.doc.start_paragraph("AR-Title")
|
self.doc.start_paragraph("AR-Title")
|
||||||
title = _("Ancestors of %s") % name
|
title = _("Ancestors of %s") % name
|
||||||
self.doc.write_text(title)
|
self.doc.write_text(title)
|
||||||
@@ -148,11 +136,13 @@ class ComprehensiveAncestorsReport (Report.Report):
|
|||||||
self.doc.write_text (_("Generation 1"))
|
self.doc.write_text (_("Generation 1"))
|
||||||
self.doc.end_paragraph ()
|
self.doc.end_paragraph ()
|
||||||
|
|
||||||
self.write_paragraphs (self.person (self.start.get_handle(), suppress_children = 1,
|
self.write_paragraphs (self.person (self.start_person.get_handle(),
|
||||||
|
suppress_children = 1,
|
||||||
needs_name = 1))
|
needs_name = 1))
|
||||||
family_handles = [self.start.get_main_parents_family_handle ()]
|
family_handles = [self.start_person.get_main_parents_family_handle ()]
|
||||||
if len (family_handles) > 0:
|
if len (family_handles) > 0:
|
||||||
self.generation (self.max_generations, family_handles, [], [self.start.get_handle()])
|
self.generation (self.max_generations, family_handles, [],
|
||||||
|
[self.start_person.get_handle()])
|
||||||
|
|
||||||
if len (self.sources) > 0:
|
if len (self.sources) > 0:
|
||||||
self.doc.start_paragraph ("AR-Heading")
|
self.doc.start_paragraph ("AR-Heading")
|
||||||
@@ -182,8 +172,6 @@ class ComprehensiveAncestorsReport (Report.Report):
|
|||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
if self.standalone:
|
|
||||||
self.doc.close()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def write_paragraphs (self, paragraphs):
|
def write_paragraphs (self, paragraphs):
|
||||||
@@ -255,10 +243,10 @@ class ComprehensiveAncestorsReport (Report.Report):
|
|||||||
if self.gp:
|
if self.gp:
|
||||||
break
|
break
|
||||||
|
|
||||||
relstring = self.relationship.get_grandparents_string (self.start,
|
relstring = self.relationship.get_grandparents_string (self.start_person,
|
||||||
self.database.get_person_from_handle(self.gp))[0]
|
self.database.get_person_from_handle(self.gp))[0]
|
||||||
heading = _("%(name)s's maternal %(grandparents)s") % \
|
heading = _("%(name)s's maternal %(grandparents)s") % \
|
||||||
{ 'name': self.first_name_or_nick (self.start),
|
{ 'name': self.first_name_or_nick (self.start_person),
|
||||||
'grandparents': relstring }
|
'grandparents': relstring }
|
||||||
people.append ((self.doc.start_paragraph, ['AR-Heading']))
|
people.append ((self.doc.start_paragraph, ['AR-Heading']))
|
||||||
people.append ((self.doc.write_text, [heading]))
|
people.append ((self.doc.write_text, [heading]))
|
||||||
@@ -280,15 +268,15 @@ class ComprehensiveAncestorsReport (Report.Report):
|
|||||||
|
|
||||||
if paternal_known:
|
if paternal_known:
|
||||||
self.doc.start_paragraph ("AR-Heading")
|
self.doc.start_paragraph ("AR-Heading")
|
||||||
relstring = self.relationship.get_grandparents_string (self.start,
|
relstring = self.relationship.get_grandparents_string (self.start_person,
|
||||||
self.database.get_person_from_handle(self.gp))[0]
|
self.database.get_person_from_handle(self.gp))[0]
|
||||||
if thisgen == 2:
|
if thisgen == 2:
|
||||||
heading = _("%(name)s's %(parents)s") % \
|
heading = _("%(name)s's %(parents)s") % \
|
||||||
{ 'name': self.first_name_or_nick (self.start),
|
{ 'name': self.first_name_or_nick (self.start_person),
|
||||||
'parents': relstring }
|
'parents': relstring }
|
||||||
else:
|
else:
|
||||||
heading = _("%(name)s's paternal %(grandparents)s") % \
|
heading = _("%(name)s's paternal %(grandparents)s") % \
|
||||||
{ 'name': self.first_name_or_nick (self.start),
|
{ 'name': self.first_name_or_nick (self.start_person),
|
||||||
'grandparents': relstring }
|
'grandparents': relstring }
|
||||||
|
|
||||||
self.doc.write_text (heading)
|
self.doc.write_text (heading)
|
||||||
|
@@ -913,7 +913,8 @@ class BookItemDialog(Report.BareReportDialog):
|
|||||||
self.option_class = option_class
|
self.option_class = option_class
|
||||||
self.person = self.database.get_person_from_gramps_id(self.option_class.handler.get_person_id())
|
self.person = self.database.get_person_from_gramps_id(self.option_class.handler.get_person_id())
|
||||||
self.new_person = None
|
self.new_person = None
|
||||||
Report.BareReportDialog.__init__(self,database,self.person,option_class,name,translated_name)
|
Report.BareReportDialog.__init__(self,database,self.person,
|
||||||
|
option_class,name,translated_name)
|
||||||
|
|
||||||
def on_ok_clicked(self, obj):
|
def on_ok_clicked(self, obj):
|
||||||
"""The user is satisfied with the dialog choices. Parse all options
|
"""The user is satisfied with the dialog choices. Parse all options
|
||||||
@@ -1001,8 +1002,9 @@ class BookReportDialog(Report.ReportDialog):
|
|||||||
"""Build a menu of document types that are appropriate for
|
"""Build a menu of document types that are appropriate for
|
||||||
this text report. This menu will be generated based upon
|
this text report. This menu will be generated based upon
|
||||||
whether the document requires table support, etc."""
|
whether the document requires table support, etc."""
|
||||||
Plugins.get_book_menu(self.format_menu, self.doc_uses_tables(),
|
self.format_menu = Plugins.GrampsBookFormatComboBox()
|
||||||
self.doc_type_changed,None,active)
|
self.format_menu.set(self.doc_uses_tables(),
|
||||||
|
self.doc_type_changed, None, active)
|
||||||
|
|
||||||
def make_document(self):
|
def make_document(self):
|
||||||
"""Create a document of the type requested by the user."""
|
"""Create a document of the type requested by the user."""
|
||||||
|
@@ -58,7 +58,7 @@ _DIED = _('d.')
|
|||||||
# DescendantReport
|
# DescendantReport
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class DescendantReport:
|
class DescendantReport(Report.Report):
|
||||||
|
|
||||||
def __init__(self,database,person,options_class):
|
def __init__(self,database,person,options_class):
|
||||||
"""
|
"""
|
||||||
@@ -84,24 +84,11 @@ class DescendantReport:
|
|||||||
newpage - if True, newpage is made before writing a report
|
newpage - if True, newpage is made before writing a report
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.database = database
|
|
||||||
self.creator = database.get_researcher().get_name()
|
Report.Report.__init__(self,database,person,options_class)
|
||||||
self.person = person
|
|
||||||
self.options_class = options_class
|
|
||||||
|
|
||||||
(self.max_generations,self.pgbrk) \
|
(self.max_generations,self.pgbrk) \
|
||||||
= options_class.get_report_generations()
|
= options_class.get_report_generations()
|
||||||
|
|
||||||
self.doc = options_class.get_document()
|
|
||||||
output = options_class.get_output()
|
|
||||||
self.newpage = options_class.get_newpage()
|
|
||||||
|
|
||||||
if output:
|
|
||||||
self.standalone = 1
|
|
||||||
self.doc.open(output)
|
|
||||||
self.doc.init()
|
|
||||||
else:
|
|
||||||
self.standalone = 0
|
|
||||||
sort = Sort.Sort(self.database)
|
sort = Sort.Sort(self.database)
|
||||||
self.by_birthdate = sort.by_birthdate
|
self.by_birthdate = sort.by_birthdate
|
||||||
|
|
||||||
@@ -131,16 +118,12 @@ class DescendantReport:
|
|||||||
self.doc.write_text(')')
|
self.doc.write_text(')')
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
if self.newpage:
|
|
||||||
self.doc.page_break()
|
|
||||||
self.doc.start_paragraph("DR-Title")
|
self.doc.start_paragraph("DR-Title")
|
||||||
name = self.person.get_primary_name().get_regular_name()
|
name = self.start_person.get_primary_name().get_regular_name()
|
||||||
self.doc.write_text(_("Descendants of %s") % name)
|
self.doc.write_text(_("Descendants of %s") % name)
|
||||||
self.dump_dates(self.person)
|
self.dump_dates(self.start_person)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.dump(0,self.person)
|
self.dump(0,self.start_person)
|
||||||
if self.standalone:
|
|
||||||
self.doc.close()
|
|
||||||
|
|
||||||
def dump(self,level,person):
|
def dump(self,level,person):
|
||||||
|
|
||||||
|
@@ -81,25 +81,13 @@ class FtmAncestorReport(Report.Report):
|
|||||||
newpage - if True, newpage is made before writing a report
|
newpage - if True, newpage is made before writing a report
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.database = database
|
Report.Report.__init__(self,database,person,options_class)
|
||||||
self.start = person
|
|
||||||
self.options_class = options_class
|
|
||||||
|
|
||||||
self.map = {}
|
self.map = {}
|
||||||
|
|
||||||
(self.max_generations,self.pgbrk) \
|
(self.max_generations,self.pgbrk) \
|
||||||
= options_class.get_report_generations()
|
= options_class.get_report_generations()
|
||||||
|
|
||||||
self.doc = options_class.get_document()
|
|
||||||
output = options_class.get_output()
|
|
||||||
self.newpage = options_class.get_newpage()
|
|
||||||
|
|
||||||
if output:
|
|
||||||
self.standalone = 1
|
|
||||||
self.doc.open(output)
|
|
||||||
self.doc.init()
|
|
||||||
else:
|
|
||||||
self.standalone = 0
|
|
||||||
self.sref_map = {}
|
self.sref_map = {}
|
||||||
self.sref_index = 0
|
self.sref_index = 0
|
||||||
|
|
||||||
@@ -117,12 +105,9 @@ class FtmAncestorReport(Report.Report):
|
|||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
|
|
||||||
if self.newpage:
|
self.apply_filter(self.start_person.get_handle(),1)
|
||||||
self.doc.page_break()
|
|
||||||
|
|
||||||
self.apply_filter(self.start.get_handle(),1)
|
|
||||||
|
|
||||||
name = self.start.get_primary_name().get_regular_name()
|
name = self.start_person.get_primary_name().get_regular_name()
|
||||||
self.doc.start_paragraph("FTA-Title")
|
self.doc.start_paragraph("FTA-Title")
|
||||||
title = _("Ancestors of %s") % name
|
title = _("Ancestors of %s") % name
|
||||||
self.doc.write_text(title)
|
self.doc.write_text(title)
|
||||||
@@ -472,8 +457,6 @@ class FtmAncestorReport(Report.Report):
|
|||||||
self.print_more_about(person)
|
self.print_more_about(person)
|
||||||
|
|
||||||
self.write_endnotes()
|
self.write_endnotes()
|
||||||
if self.standalone:
|
|
||||||
self.doc.close()
|
|
||||||
|
|
||||||
def write_endnotes(self):
|
def write_endnotes(self):
|
||||||
keys = self.sref_map.keys()
|
keys = self.sref_map.keys()
|
||||||
|
@@ -86,9 +86,7 @@ class FtmDescendantReport(Report.Report):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.database = database
|
Report.Report.__init__(self,database,person,options_class)
|
||||||
self.start = person
|
|
||||||
self.options_class = options_class
|
|
||||||
|
|
||||||
self.anc_map = {}
|
self.anc_map = {}
|
||||||
self.gen_map = {}
|
self.gen_map = {}
|
||||||
@@ -96,18 +94,8 @@ class FtmDescendantReport(Report.Report):
|
|||||||
(self.max_generations,self.pgbrk) \
|
(self.max_generations,self.pgbrk) \
|
||||||
= options_class.get_report_generations()
|
= options_class.get_report_generations()
|
||||||
|
|
||||||
self.doc = options_class.get_document()
|
|
||||||
output = options_class.get_output()
|
|
||||||
self.newpage = options_class.get_newpage()
|
|
||||||
|
|
||||||
self.setup()
|
self.setup()
|
||||||
|
|
||||||
if output:
|
|
||||||
self.standalone = 1
|
|
||||||
self.doc.open(output)
|
|
||||||
self.doc.init()
|
|
||||||
else:
|
|
||||||
self.standalone = 0
|
|
||||||
self.sref_map = {}
|
self.sref_map = {}
|
||||||
self.sref_index = 0
|
self.sref_index = 0
|
||||||
|
|
||||||
@@ -145,12 +133,9 @@ class FtmDescendantReport(Report.Report):
|
|||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
|
|
||||||
if self.newpage:
|
self.apply_filter(self.start_person.get_handle(),1)
|
||||||
self.doc.page_break()
|
|
||||||
|
|
||||||
self.apply_filter(self.start.get_handle(),1)
|
|
||||||
|
|
||||||
name = self.start.get_primary_name().get_regular_name()
|
name = self.start_person.get_primary_name().get_regular_name()
|
||||||
self.doc.start_paragraph("FTD-Title")
|
self.doc.start_paragraph("FTD-Title")
|
||||||
title = _("Descendants of %s") % name
|
title = _("Descendants of %s") % name
|
||||||
self.doc.write_text(title)
|
self.doc.write_text(title)
|
||||||
@@ -498,8 +483,6 @@ class FtmDescendantReport(Report.Report):
|
|||||||
self.print_children(person)
|
self.print_children(person)
|
||||||
|
|
||||||
self.write_endnotes()
|
self.write_endnotes()
|
||||||
if self.standalone:
|
|
||||||
self.doc.close()
|
|
||||||
|
|
||||||
def write_endnotes(self):
|
def write_endnotes(self):
|
||||||
keys = self.sref_map.keys()
|
keys = self.sref_map.keys()
|
||||||
|
@@ -81,25 +81,11 @@ class IndivSummary(Report.Report):
|
|||||||
newpage - if True, newpage is made before writing a report
|
newpage - if True, newpage is made before writing a report
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.database = database
|
|
||||||
self.person = person
|
|
||||||
self.options_class = options_class
|
|
||||||
|
|
||||||
|
Report.Report.__init__(self,database,person,options_class)
|
||||||
|
|
||||||
self.d = options_class.get_document()
|
|
||||||
self.output = options_class.get_output()
|
|
||||||
self.newpage = options_class.get_newpage()
|
|
||||||
|
|
||||||
c = database.get_researcher().get_name()
|
|
||||||
self.d.creator(c)
|
|
||||||
self.map = {}
|
self.map = {}
|
||||||
self.setup()
|
self.setup()
|
||||||
if self.output:
|
|
||||||
self.standalone = 1
|
|
||||||
self.d.open(self.output)
|
|
||||||
self.d.init()
|
|
||||||
else:
|
|
||||||
self.standalone = 0
|
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
tbl = BaseDoc.TableStyle()
|
tbl = BaseDoc.TableStyle()
|
||||||
@@ -107,23 +93,19 @@ class IndivSummary(Report.Report):
|
|||||||
tbl.set_columns(2)
|
tbl.set_columns(2)
|
||||||
tbl.set_column_width(0,20)
|
tbl.set_column_width(0,20)
|
||||||
tbl.set_column_width(1,80)
|
tbl.set_column_width(1,80)
|
||||||
self.d.add_table_style("IVS-IndTable",tbl)
|
self.doc.add_table_style("IVS-IndTable",tbl)
|
||||||
|
|
||||||
cell = BaseDoc.TableCellStyle()
|
cell = BaseDoc.TableCellStyle()
|
||||||
cell.set_top_border(1)
|
cell.set_top_border(1)
|
||||||
cell.set_bottom_border(1)
|
cell.set_bottom_border(1)
|
||||||
self.d.add_cell_style("IVS-TableHead",cell)
|
self.doc.add_cell_style("IVS-TableHead",cell)
|
||||||
|
|
||||||
cell = BaseDoc.TableCellStyle()
|
cell = BaseDoc.TableCellStyle()
|
||||||
self.d.add_cell_style("IVS-NormalCell",cell)
|
self.doc.add_cell_style("IVS-NormalCell",cell)
|
||||||
|
|
||||||
cell = BaseDoc.TableCellStyle()
|
cell = BaseDoc.TableCellStyle()
|
||||||
cell.set_longlist(1)
|
cell.set_longlist(1)
|
||||||
self.d.add_cell_style("IVS-ListCell",cell)
|
self.doc.add_cell_style("IVS-ListCell",cell)
|
||||||
|
|
||||||
def end(self):
|
|
||||||
if self.standalone:
|
|
||||||
self.d.close()
|
|
||||||
|
|
||||||
def write_fact(self,event):
|
def write_fact(self,event):
|
||||||
if event == None:
|
if event == None:
|
||||||
@@ -151,19 +133,19 @@ class IndivSummary(Report.Report):
|
|||||||
'place' : place }
|
'place' : place }
|
||||||
text = '%s %s' % (text,description)
|
text = '%s %s' % (text,description)
|
||||||
|
|
||||||
self.d.start_row()
|
self.doc.start_row()
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text(name)
|
self.doc.write_text(name)
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
|
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text(text)
|
self.doc.write_text(text)
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
self.d.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@@ -172,35 +154,35 @@ class IndivSummary(Report.Report):
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def write_families(self):
|
def write_families(self):
|
||||||
|
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.start_table("three","IVS-IndTable")
|
self.doc.start_table("three","IVS-IndTable")
|
||||||
self.d.start_row()
|
self.doc.start_row()
|
||||||
self.d.start_cell("IVS-TableHead",2)
|
self.doc.start_cell("IVS-TableHead",2)
|
||||||
self.d.start_paragraph("IVS-TableTitle")
|
self.doc.start_paragraph("IVS-TableTitle")
|
||||||
self.d.write_text(_("Marriages/Children"))
|
self.doc.write_text(_("Marriages/Children"))
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
self.d.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
for family_handle in self.person.get_family_handle_list():
|
for family_handle in self.start_person.get_family_handle_list():
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
family = self.database.get_family_from_handle(family_handle)
|
||||||
if self.person.get_handle() == family.get_father_handle():
|
if self.start_person.get_handle() == family.get_father_handle():
|
||||||
spouse_id = family.get_mother_handle()
|
spouse_id = family.get_mother_handle()
|
||||||
else:
|
else:
|
||||||
spouse_id = family.get_father_handle()
|
spouse_id = family.get_father_handle()
|
||||||
|
|
||||||
self.d.start_row()
|
self.doc.start_row()
|
||||||
self.d.start_cell("IVS-NormalCell",2)
|
self.doc.start_cell("IVS-NormalCell",2)
|
||||||
self.d.start_paragraph("IVS-Spouse")
|
self.doc.start_paragraph("IVS-Spouse")
|
||||||
if spouse_id:
|
if spouse_id:
|
||||||
spouse = self.database.get_person_from_handle(spouse_id)
|
spouse = self.database.get_person_from_handle(spouse_id)
|
||||||
self.d.write_text(spouse.get_primary_name().get_regular_name())
|
self.doc.write_text(spouse.get_primary_name().get_regular_name())
|
||||||
else:
|
else:
|
||||||
self.d.write_text(_("unknown"))
|
self.doc.write_text(_("unknown"))
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
self.d.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
for event_handle in family.get_event_list():
|
for event_handle in family.get_event_list():
|
||||||
event = self.database.get_event_from_handle(event_handle)
|
event = self.database.get_event_from_handle(event_handle)
|
||||||
@@ -208,87 +190,84 @@ class IndivSummary(Report.Report):
|
|||||||
|
|
||||||
child_list = family.get_child_handle_list()
|
child_list = family.get_child_handle_list()
|
||||||
if len(child_list):
|
if len(child_list):
|
||||||
self.d.start_row()
|
self.doc.start_row()
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text(_("Children"))
|
self.doc.write_text(_("Children"))
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
|
|
||||||
self.d.start_cell("IVS-ListCell")
|
self.doc.start_cell("IVS-ListCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
|
|
||||||
first = 1
|
first = 1
|
||||||
for child_handle in child_list:
|
for child_handle in child_list:
|
||||||
if first == 1:
|
if first == 1:
|
||||||
first = 0
|
first = 0
|
||||||
else:
|
else:
|
||||||
self.d.write_text('\n')
|
self.doc.write_text('\n')
|
||||||
child = self.database.get_person_from_handle(child_handle)
|
child = self.database.get_person_from_handle(child_handle)
|
||||||
self.d.write_text(child.get_primary_name().get_regular_name())
|
self.doc.write_text(child.get_primary_name().get_regular_name())
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
self.d.end_row()
|
self.doc.end_row()
|
||||||
self.d.end_table()
|
self.doc.end_table()
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
|
|
||||||
if self.newpage:
|
media_list = self.start_person.get_media_list()
|
||||||
self.d.page_break()
|
|
||||||
|
|
||||||
media_list = self.person.get_media_list()
|
name = self.start_person.get_primary_name().get_regular_name()
|
||||||
|
self.doc.start_paragraph("IVS-Title")
|
||||||
|
self.doc.write_text(_("Summary of %s") % name)
|
||||||
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
name = self.person.get_primary_name().get_regular_name()
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.start_paragraph("IVS-Title")
|
self.doc.end_paragraph()
|
||||||
self.d.write_text(_("Summary of %s") % name)
|
|
||||||
self.d.end_paragraph()
|
|
||||||
|
|
||||||
self.d.start_paragraph("IVS-Normal")
|
|
||||||
self.d.end_paragraph()
|
|
||||||
|
|
||||||
if len(media_list) > 0:
|
if len(media_list) > 0:
|
||||||
object_handle = media_list[0].get_reference_handle()
|
object_handle = media_list[0].get_reference_handle()
|
||||||
object = self.database.get_object_from_handle(object_handle)
|
object = self.database.get_object_from_handle(object_handle)
|
||||||
if object.get_mime_type()[0:5] == "image":
|
if object.get_mime_type()[0:5] == "image":
|
||||||
file = object.get_path()
|
file = object.get_path()
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.add_media_object(file,"row",4.0,4.0)
|
self.doc.add_media_object(file,"row",4.0,4.0)
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
self.d.start_table("one","IVS-IndTable")
|
self.doc.start_table("one","IVS-IndTable")
|
||||||
|
|
||||||
self.d.start_row()
|
self.doc.start_row()
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text("%s:" % _("Name"))
|
self.doc.write_text("%s:" % _("Name"))
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
|
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text(self.person.get_primary_name().get_regular_name())
|
self.doc.write_text(self.start_person.get_primary_name().get_regular_name())
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
self.d.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
self.d.start_row()
|
self.doc.start_row()
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text("%s:" % _("Gender"))
|
self.doc.write_text("%s:" % _("Gender"))
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
|
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
if self.person.get_gender() == RelLib.Person.male:
|
if self.start_person.get_gender() == RelLib.Person.male:
|
||||||
self.d.write_text(_("Male"))
|
self.doc.write_text(_("Male"))
|
||||||
else:
|
else:
|
||||||
self.d.write_text(_("Female"))
|
self.doc.write_text(_("Female"))
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
self.d.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
fam_id = self.person.get_main_parents_family_handle()
|
fam_id = self.start_person.get_main_parents_family_handle()
|
||||||
if fam_id:
|
if fam_id:
|
||||||
family = self.database.get_family_from_handle(fam_id)
|
family = self.database.get_family_from_handle(fam_id)
|
||||||
father_handle = family.get_father_handle()
|
father_handle = family.get_father_handle()
|
||||||
@@ -307,57 +286,57 @@ class IndivSummary(Report.Report):
|
|||||||
father = ""
|
father = ""
|
||||||
mother = ""
|
mother = ""
|
||||||
|
|
||||||
self.d.start_row()
|
self.doc.start_row()
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text("%s:" % _("Father"))
|
self.doc.write_text("%s:" % _("Father"))
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
|
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text(father)
|
self.doc.write_text(father)
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
self.d.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
self.d.start_row()
|
self.doc.start_row()
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text("%s:" % _("Mother"))
|
self.doc.write_text("%s:" % _("Mother"))
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
|
|
||||||
self.d.start_cell("IVS-NormalCell")
|
self.doc.start_cell("IVS-NormalCell")
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.write_text(mother)
|
self.doc.write_text(mother)
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
self.d.end_row()
|
self.doc.end_row()
|
||||||
self.d.end_table()
|
self.doc.end_table()
|
||||||
|
|
||||||
self.d.start_paragraph("IVS-Normal")
|
self.doc.start_paragraph("IVS-Normal")
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
self.d.start_table("two","IVS-IndTable")
|
self.doc.start_table("two","IVS-IndTable")
|
||||||
self.d.start_row()
|
self.doc.start_row()
|
||||||
self.d.start_cell("IVS-TableHead",2)
|
self.doc.start_cell("IVS-TableHead",2)
|
||||||
self.d.start_paragraph("IVS-TableTitle")
|
self.doc.start_paragraph("IVS-TableTitle")
|
||||||
self.d.write_text(_("Individual Facts"))
|
self.doc.write_text(_("Individual Facts"))
|
||||||
self.d.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.d.end_cell()
|
self.doc.end_cell()
|
||||||
self.d.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
event_list = [ self.person.get_birth_handle(), self.person.get_death_handle() ]
|
event_list = [ self.start_person.get_birth_handle(),
|
||||||
event_list = event_list + self.person.get_event_list()
|
self.start_person.get_death_handle() ]
|
||||||
|
event_list = event_list + self.start_person.get_event_list()
|
||||||
for event_handle in event_list:
|
for event_handle in event_list:
|
||||||
if event_handle:
|
if event_handle:
|
||||||
event = self.database.get_event_from_handle(event_handle)
|
event = self.database.get_event_from_handle(event_handle)
|
||||||
self.write_fact(event)
|
self.write_fact(event)
|
||||||
self.d.end_table()
|
self.doc.end_table()
|
||||||
|
|
||||||
self.write_families()
|
self.write_families()
|
||||||
self.end()
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@@ -60,7 +60,7 @@ import const
|
|||||||
# TimeLine
|
# TimeLine
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class TimeLine:
|
class TimeLine(Report.Report):
|
||||||
|
|
||||||
def __init__(self,database,person,options_class):
|
def __init__(self,database,person,options_class):
|
||||||
"""
|
"""
|
||||||
@@ -93,9 +93,7 @@ class TimeLine:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.db = database
|
Report.Report.__init__(self,database,person,options_class)
|
||||||
self.person = person
|
|
||||||
self.options_class = options_class
|
|
||||||
|
|
||||||
filter_num = options_class.get_filter_number()
|
filter_num = options_class.get_filter_number()
|
||||||
filters = options_class.get_report_filters(person)
|
filters = options_class.get_report_filters(person)
|
||||||
@@ -107,17 +105,7 @@ class TimeLine:
|
|||||||
sort_functions = options_class.get_sort_functions(Sort.Sort(database))
|
sort_functions = options_class.get_sort_functions(Sort.Sort(database))
|
||||||
self.sort_func = sort_functions[sort_func_num][1]
|
self.sort_func = sort_functions[sort_func_num][1]
|
||||||
|
|
||||||
self.d = options_class.get_document()
|
|
||||||
self.output = options_class.get_output()
|
|
||||||
self.newpage = options_class.get_newpage()
|
|
||||||
|
|
||||||
self.setup()
|
self.setup()
|
||||||
if self.output:
|
|
||||||
self.standalone = 1
|
|
||||||
self.d.open(self.output)
|
|
||||||
self.d.init()
|
|
||||||
else:
|
|
||||||
self.standalone = 0
|
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
"""
|
"""
|
||||||
@@ -140,47 +128,47 @@ class TimeLine:
|
|||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
g.set_line_width(0.5)
|
g.set_line_width(0.5)
|
||||||
g.set_color((0,0,0))
|
g.set_color((0,0,0))
|
||||||
self.d.add_draw_style("TLG-line",g)
|
self.doc.add_draw_style("TLG-line",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
g.set_line_width(0.5)
|
g.set_line_width(0.5)
|
||||||
g.set_color((0,0,0))
|
g.set_color((0,0,0))
|
||||||
g.set_fill_color((0,0,0))
|
g.set_fill_color((0,0,0))
|
||||||
self.d.add_draw_style("TLG-solid",g)
|
self.doc.add_draw_style("TLG-solid",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
g.set_line_width(0.5)
|
g.set_line_width(0.5)
|
||||||
g.set_color((0,0,0))
|
g.set_color((0,0,0))
|
||||||
g.set_fill_color((255,255,255))
|
g.set_fill_color((255,255,255))
|
||||||
self.d.add_draw_style("open",g)
|
self.doc.add_draw_style("open",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
g.set_line_width(0.5)
|
g.set_line_width(0.5)
|
||||||
g.set_line_style(BaseDoc.DASHED)
|
g.set_line_style(BaseDoc.DASHED)
|
||||||
g.set_color((0,0,0))
|
g.set_color((0,0,0))
|
||||||
self.d.add_draw_style("TLG-grid",g)
|
self.doc.add_draw_style("TLG-grid",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
g.set_paragraph_style("TLG-Name")
|
g.set_paragraph_style("TLG-Name")
|
||||||
g.set_color((255,255,255))
|
g.set_color((255,255,255))
|
||||||
g.set_fill_color((255,255,255))
|
g.set_fill_color((255,255,255))
|
||||||
g.set_line_width(0)
|
g.set_line_width(0)
|
||||||
self.d.add_draw_style("TLG-text",g)
|
self.doc.add_draw_style("TLG-text",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
g.set_paragraph_style("TLG-Title")
|
g.set_paragraph_style("TLG-Title")
|
||||||
g.set_color((255,255,255))
|
g.set_color((255,255,255))
|
||||||
g.set_fill_color((255,255,255))
|
g.set_fill_color((255,255,255))
|
||||||
g.set_line_width(0)
|
g.set_line_width(0)
|
||||||
g.set_width(self.d.get_usable_width())
|
g.set_width(self.doc.get_usable_width())
|
||||||
self.d.add_draw_style("TLG-title",g)
|
self.doc.add_draw_style("TLG-title",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
g.set_paragraph_style("TLG-Label")
|
g.set_paragraph_style("TLG-Label")
|
||||||
g.set_color((255,255,255))
|
g.set_color((255,255,255))
|
||||||
g.set_fill_color((255,255,255))
|
g.set_fill_color((255,255,255))
|
||||||
g.set_line_width(0)
|
g.set_line_width(0)
|
||||||
self.d.add_draw_style("TLG-label",g)
|
self.doc.add_draw_style("TLG-label",g)
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
|
|
||||||
@@ -188,14 +176,14 @@ class TimeLine:
|
|||||||
|
|
||||||
if low == high:
|
if low == high:
|
||||||
if self.standalone:
|
if self.standalone:
|
||||||
self.d.close()
|
self.doc.close()
|
||||||
ErrorDialog(_("Report could not be created"),
|
ErrorDialog(_("Report could not be created"),
|
||||||
_("The range of dates chosen was not valid"))
|
_("The range of dates chosen was not valid"))
|
||||||
return
|
return
|
||||||
|
|
||||||
st_size = self.name_size()
|
st_size = self.name_size()
|
||||||
|
|
||||||
font = self.d.style_list['TLG-Name'].get_font()
|
font = self.doc.style_list['TLG-Name'].get_font()
|
||||||
|
|
||||||
incr = Utils.pt2cm(font.get_size())
|
incr = Utils.pt2cm(font.get_size())
|
||||||
pad = incr*.75
|
pad = incr*.75
|
||||||
@@ -203,13 +191,11 @@ class TimeLine:
|
|||||||
x1,x2,y1,y2 = (0,0,0,0)
|
x1,x2,y1,y2 = (0,0,0,0)
|
||||||
|
|
||||||
start = st_size+0.5
|
start = st_size+0.5
|
||||||
stop = self.d.get_usable_width()-0.5
|
stop = self.doc.get_usable_width()-0.5
|
||||||
size = (stop-start)
|
size = (stop-start)
|
||||||
self.header = 2.0
|
self.header = 2.0
|
||||||
|
|
||||||
if self.newpage:
|
self.doc.start_page()
|
||||||
self.d.page_break()
|
|
||||||
self.d.start_page()
|
|
||||||
|
|
||||||
index = 1
|
index = 1
|
||||||
current = 1;
|
current = 1;
|
||||||
@@ -219,21 +205,21 @@ class TimeLine:
|
|||||||
self.plist.sort(self.sort_func)
|
self.plist.sort(self.sort_func)
|
||||||
|
|
||||||
for p_id in self.plist:
|
for p_id in self.plist:
|
||||||
p = self.db.get_person_from_handle(p_id)
|
p = self.database.get_person_from_handle(p_id)
|
||||||
b_id = p.get_birth_handle()
|
b_id = p.get_birth_handle()
|
||||||
if b_id:
|
if b_id:
|
||||||
b = self.db.get_event_from_handle(b_id).get_date_object().get_year()
|
b = self.database.get_event_from_handle(b_id).get_date_object().get_year()
|
||||||
else:
|
else:
|
||||||
b = None
|
b = None
|
||||||
|
|
||||||
d_id = p.get_death_handle()
|
d_id = p.get_death_handle()
|
||||||
if d_id:
|
if d_id:
|
||||||
d = self.db.get_event_from_handle(d_id).get_date_object().get_year()
|
d = self.database.get_event_from_handle(d_id).get_date_object().get_year()
|
||||||
else:
|
else:
|
||||||
d = None
|
d = None
|
||||||
|
|
||||||
n = p.get_primary_name().get_name()
|
n = p.get_primary_name().get_name()
|
||||||
self.d.draw_text('TLG-text',n,incr+pad,self.header + (incr+pad)*index)
|
self.doc.draw_text('TLG-text',n,incr+pad,self.header + (incr+pad)*index)
|
||||||
|
|
||||||
y1 = self.header + (pad+incr)*index
|
y1 = self.header + (pad+incr)*index
|
||||||
y2 = self.header + ((pad+incr)*index)+incr
|
y2 = self.header + ((pad+incr)*index)+incr
|
||||||
@@ -244,13 +230,13 @@ class TimeLine:
|
|||||||
start_offset = ((float(b-low)/float(high-low)) * (size))
|
start_offset = ((float(b-low)/float(high-low)) * (size))
|
||||||
x1 = start+start_offset
|
x1 = start+start_offset
|
||||||
path = [(x1,y1),(x1+w,y3),(x1,y2),(x1-w,y3)]
|
path = [(x1,y1),(x1+w,y3),(x1,y2),(x1-w,y3)]
|
||||||
self.d.draw_path('TLG-line',path)
|
self.doc.draw_path('TLG-line',path)
|
||||||
|
|
||||||
if d:
|
if d:
|
||||||
start_offset = ((float(d-low)/float(high-low)) * (size))
|
start_offset = ((float(d-low)/float(high-low)) * (size))
|
||||||
x1 = start+start_offset
|
x1 = start+start_offset
|
||||||
path = [(x1,y1),(x1+w,y3),(x1,y2),(x1-w,y3)]
|
path = [(x1,y1),(x1+w,y3),(x1,y2),(x1-w,y3)]
|
||||||
self.d.draw_path('TLG-solid',path)
|
self.doc.draw_path('TLG-solid',path)
|
||||||
|
|
||||||
if b and d:
|
if b and d:
|
||||||
start_offset = ((float(b-low)/float(high-low)) * size) + w
|
start_offset = ((float(b-low)/float(high-low)) * size) + w
|
||||||
@@ -258,13 +244,13 @@ class TimeLine:
|
|||||||
|
|
||||||
x1 = start+start_offset
|
x1 = start+start_offset
|
||||||
x2 = start+stop_offset
|
x2 = start+stop_offset
|
||||||
self.d.draw_line('open',x1,y3,x2,y3)
|
self.doc.draw_line('open',x1,y3,x2,y3)
|
||||||
|
|
||||||
if (y2 + incr) >= self.d.get_usable_height():
|
if (y2 + incr) >= self.doc.get_usable_height():
|
||||||
if current != length:
|
if current != length:
|
||||||
self.build_grid(low,high,start,stop)
|
self.build_grid(low,high,start,stop)
|
||||||
self.d.end_page()
|
self.doc.end_page()
|
||||||
self.d.start_page()
|
self.doc.start_page()
|
||||||
self.build_grid(low,high,start,stop)
|
self.build_grid(low,high,start,stop)
|
||||||
index = 1
|
index = 1
|
||||||
x1,x2,y1,y2 = (0,0,0,0)
|
x1,x2,y1,y2 = (0,0,0,0)
|
||||||
@@ -273,9 +259,7 @@ class TimeLine:
|
|||||||
current += 1
|
current += 1
|
||||||
|
|
||||||
self.build_grid(low,high,start,stop)
|
self.build_grid(low,high,start,stop)
|
||||||
self.d.end_page()
|
self.doc.end_page()
|
||||||
if self.standalone:
|
|
||||||
self.d.close()
|
|
||||||
|
|
||||||
def build_grid(self,year_low,year_high,start_pos,stop_pos):
|
def build_grid(self,year_low,year_high,start_pos,stop_pos):
|
||||||
"""
|
"""
|
||||||
@@ -288,17 +272,17 @@ class TimeLine:
|
|||||||
start_pos - x position of the lowest leftmost grid line
|
start_pos - x position of the lowest leftmost grid line
|
||||||
stop_pos - x position of the rightmost grid line
|
stop_pos - x position of the rightmost grid line
|
||||||
"""
|
"""
|
||||||
width = self.d.get_usable_width()
|
width = self.doc.get_usable_width()
|
||||||
|
|
||||||
title_font = self.d.style_list['TLG-Title'].get_font()
|
title_font = self.doc.style_list['TLG-Title'].get_font()
|
||||||
normal_font = self.d.style_list['TLG-Name'].get_font()
|
normal_font = self.doc.style_list['TLG-Name'].get_font()
|
||||||
label_font = self.d.style_list['TLG-Label'].get_font()
|
label_font = self.doc.style_list['TLG-Label'].get_font()
|
||||||
|
|
||||||
self.d.center_text('TLG-title',self.title,width/2.0,0)
|
self.doc.center_text('TLG-title',self.title,width/2.0,0)
|
||||||
|
|
||||||
label_y = self.header - (Utils.pt2cm(normal_font.get_size())*1.2)
|
label_y = self.header - (Utils.pt2cm(normal_font.get_size())*1.2)
|
||||||
top_y = self.header
|
top_y = self.header
|
||||||
bottom_y = self.d.get_usable_height()
|
bottom_y = self.doc.get_usable_height()
|
||||||
|
|
||||||
incr = (year_high - year_low)/5
|
incr = (year_high - year_low)/5
|
||||||
delta = (stop_pos - start_pos)/ 5
|
delta = (stop_pos - start_pos)/ 5
|
||||||
@@ -307,26 +291,27 @@ class TimeLine:
|
|||||||
year_str = str(year_low + (incr*val))
|
year_str = str(year_low + (incr*val))
|
||||||
|
|
||||||
xpos = start_pos+(val*delta)
|
xpos = start_pos+(val*delta)
|
||||||
self.d.center_text('TLG-label', year_str, xpos, label_y)
|
self.doc.center_text('TLG-label', year_str, xpos, label_y)
|
||||||
self.d.draw_line('TLG-grid', xpos, top_y, xpos, bottom_y)
|
self.doc.draw_line('TLG-grid', xpos, top_y, xpos, bottom_y)
|
||||||
|
|
||||||
def find_year_range(self):
|
def find_year_range(self):
|
||||||
low = 999999
|
low = 999999
|
||||||
high = -999999
|
high = -999999
|
||||||
|
|
||||||
self.plist = self.filter.apply(self.db,self.db.get_person_handles(sort_handles=False))
|
self.plist = self.filter.apply(self.database,
|
||||||
|
self.database.get_person_handles(sort_handles=False))
|
||||||
|
|
||||||
for p_id in self.plist:
|
for p_id in self.plist:
|
||||||
p = self.db.get_person_from_handle(p_id)
|
p = self.database.get_person_from_handle(p_id)
|
||||||
b_id = p.get_birth_handle()
|
b_id = p.get_birth_handle()
|
||||||
if b_id:
|
if b_id:
|
||||||
b = self.db.get_event_from_handle(b_id).get_date_object().get_year()
|
b = self.database.get_event_from_handle(b_id).get_date_object().get_year()
|
||||||
else:
|
else:
|
||||||
b = None
|
b = None
|
||||||
|
|
||||||
d_id = p.get_death_handle()
|
d_id = p.get_death_handle()
|
||||||
if d_id:
|
if d_id:
|
||||||
d = self.db.get_event_from_handle(d_id).get_date_object().get_year()
|
d = self.database.get_event_from_handle(d_id).get_date_object().get_year()
|
||||||
else:
|
else:
|
||||||
d = None
|
d = None
|
||||||
|
|
||||||
@@ -349,16 +334,17 @@ class TimeLine:
|
|||||||
return (low,high)
|
return (low,high)
|
||||||
|
|
||||||
def name_size(self):
|
def name_size(self):
|
||||||
self.plist = self.filter.apply(self.db,self.db.get_person_handles(sort_handles=False))
|
self.plist = self.filter.apply(self.database,
|
||||||
|
self.database.get_person_handles(sort_handles=False))
|
||||||
|
|
||||||
style_name = self.d.draw_styles['TLG-text'].get_paragraph_style()
|
style_name = self.doc.draw_styles['TLG-text'].get_paragraph_style()
|
||||||
font = self.d.style_list[style_name].get_font()
|
font = self.doc.style_list[style_name].get_font()
|
||||||
|
|
||||||
size = 0
|
size = 0
|
||||||
for p_id in self.plist:
|
for p_id in self.plist:
|
||||||
p = self.db.get_person_from_handle(p_id)
|
p = self.database.get_person_from_handle(p_id)
|
||||||
n = p.get_primary_name().get_name()
|
n = p.get_primary_name().get_name()
|
||||||
size = max(self.d.string_width(font,n),size)
|
size = max(self.doc.string_width(font,n),size)
|
||||||
return Utils.pt2cm(size)
|
return Utils.pt2cm(size)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user