* src/Plugins.py: Add more values for book item registration.
* src/plugins/FtmStyleDescendants.py: Comply with book changes. * src/plugins/FtmStyleAncestors.py: Likewise. * src/plugins/BookReport.py: Rewrite most of the code using new classes: BookItem, Book, BookList, BookParser, BookListDisplay. Add open/save/edit functionality. * src/plugins/book.glade: Add new dialog for BookListDisplay. Also add a text entry field for saving book and new buttons: Open, Edit, Save. svn: r1706
This commit is contained in:
@@ -1126,7 +1126,7 @@ class FtmDescendantReport(Report.Report):
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def _make_default_style(self):
|
||||
def _make_default_style(default_style):
|
||||
"""Make the default output style for the FTM Style Descendant report."""
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(face=TextDoc.FONT_SANS_SERIF,size=16,bold=1,italic=1)
|
||||
@@ -1136,7 +1136,7 @@ def _make_default_style(self):
|
||||
para.set_alignment(TextDoc.PARA_ALIGN_CENTER)
|
||||
para.set(pad=0.5)
|
||||
para.set_description(_('The style used for the title of the page.'))
|
||||
self.default_style.add_style("Title",para)
|
||||
default_style.add_style("Title",para)
|
||||
|
||||
font = TextDoc.FontStyle()
|
||||
font.set(face=TextDoc.FONT_SANS_SERIF,size=14,italic=1)
|
||||
@@ -1146,27 +1146,27 @@ def _make_default_style(self):
|
||||
para.set(pad=0.5)
|
||||
para.set_alignment(TextDoc.PARA_ALIGN_CENTER)
|
||||
para.set_description(_('The style used for the generation header.'))
|
||||
self.default_style.add_style("Generation",para)
|
||||
default_style.add_style("Generation",para)
|
||||
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set(first_indent=-1.0,lmargin=1.0,pad=0.25)
|
||||
para.set_description(_('The basic style used for the text display.'))
|
||||
self.default_style.add_style("Entry",para)
|
||||
default_style.add_style("Entry",para)
|
||||
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set(lmargin=1.0,pad=0.05)
|
||||
para.set_description(_('The basic style used for the text display.'))
|
||||
self.default_style.add_style("Details",para)
|
||||
default_style.add_style("Details",para)
|
||||
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set(lmargin=1.0,pad=0.25)
|
||||
para.set_description(_('The basic style used for the text display.'))
|
||||
self.default_style.add_style("SubEntry",para)
|
||||
default_style.add_style("SubEntry",para)
|
||||
|
||||
para = TextDoc.ParagraphStyle()
|
||||
para.set(pad=0.05)
|
||||
para.set_description(_('The basic style used for the text display.'))
|
||||
self.default_style.add_style("Endnotes",para)
|
||||
default_style.add_style("Endnotes",para)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@@ -1201,7 +1201,7 @@ class FtmDescendantReportDialog(Report.TextReportDialog):
|
||||
return "ftm_descendant_report.xml"
|
||||
|
||||
def make_default_style(self):
|
||||
_make_default_style(self)
|
||||
_make_default_style(self.default_style)
|
||||
|
||||
def make_report(self):
|
||||
"""Create the object that will produce the FTM Style Descendant Report.
|
||||
@@ -1234,18 +1234,13 @@ def report(database,person):
|
||||
# Set up sane defaults for the book_item
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class FakeObj(object):
|
||||
pass
|
||||
|
||||
fo = FakeObj()
|
||||
fo.default_style = TextDoc.StyleSheet()
|
||||
|
||||
_make_default_style(fo)
|
||||
_style = fo.default_style
|
||||
_style_file = "ftm_descendant_report.xml"
|
||||
_style_name = "default"
|
||||
|
||||
_person_id = ""
|
||||
_max_gen = 10
|
||||
_pg_brk = 0
|
||||
_options = [ None, _max_gen, _pg_brk ]
|
||||
_options = [ _person_id, _max_gen, _pg_brk ]
|
||||
|
||||
def options_dialog(database,person):
|
||||
FtmDescendantBareReportDialog(database,person)
|
||||
@@ -1266,10 +1261,13 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog):
|
||||
else:
|
||||
self.person = person
|
||||
Report.BareReportDialog.__init__(self,database,self.person)
|
||||
self.make_default_style = _make_default_style
|
||||
self.max_gen = self.options[1]
|
||||
self.pg_brk = self.options[2]
|
||||
self.style = stl
|
||||
|
||||
def make_default_style(self):
|
||||
_make_default_style(self.default_style)
|
||||
|
||||
self.max_gen = int(self.options[1])
|
||||
self.pg_brk = int(self.options[2])
|
||||
self.style_name = stl
|
||||
self.new_person = None
|
||||
|
||||
self.generations_spinbox.set_value(self.max_gen)
|
||||
@@ -1292,11 +1290,8 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog):
|
||||
|
||||
def get_stylesheet_savefile(self):
|
||||
"""Where to save styles for this report."""
|
||||
return "ftm_descendant_report.xml"
|
||||
return _style_file
|
||||
|
||||
def make_default_style(self):
|
||||
_make_default_style(self)
|
||||
|
||||
def on_cancel(self, obj):
|
||||
pass
|
||||
|
||||
@@ -1311,7 +1306,7 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog):
|
||||
if self.new_person:
|
||||
self.person = self.new_person
|
||||
self.options = [ self.person.getId(), self.max_gen, self.pg_brk ]
|
||||
self.style = self.selected_style
|
||||
self.style_name = self.selected_style.get_name()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@@ -1447,12 +1442,14 @@ register_report(
|
||||
author_email="shura@alex.neuro.umn.edu"
|
||||
)
|
||||
|
||||
# register_book_item( name, category, dialog, write_item, get_options, get_style)
|
||||
# (name,category,options_dialog,write_book_item,options,style_name,style_file,make_default_style)
|
||||
register_book_item(
|
||||
_("FTM Style Descendant Report"),
|
||||
_("Text"),
|
||||
FtmDescendantBareReportDialog,
|
||||
write_book_item,
|
||||
_options,
|
||||
_style
|
||||
_style_name,
|
||||
_style_file,
|
||||
_make_default_style
|
||||
)
|
||||
|
Reference in New Issue
Block a user