* src/Report.py: De-uglify center_person frame.
* src/plugins/BookReport.py: Add a center person column to a book * src/plugins/FtmStyleDescendants.py: Get the style right. svn: r1674
This commit is contained in:
@@ -107,7 +107,8 @@ class BookReportSelector:
|
||||
self.max_key = 0
|
||||
|
||||
av_titles = [(_('Name'),2,150),(_('Type'),1,50)]
|
||||
bk_titles = [(_('Item name'),-1,150),(_('Type'),1,50),('',-1,0)] #,('',-1,0)
|
||||
bk_titles = [(_('Item name'),-1,150),(_('Type'),1,50),
|
||||
(_('Center person'),1,50),('',-1,0)]
|
||||
|
||||
self.av_ncols = len(av_titles)
|
||||
self.bk_ncols = len(bk_titles)
|
||||
@@ -142,6 +143,7 @@ class BookReportSelector:
|
||||
if not iter:
|
||||
return
|
||||
data = self.av_model.get_data(iter,range(self.av_ncols))
|
||||
data.append(self.person.getPrimaryName().getRegularName())
|
||||
self.max_key = self.max_key + 1
|
||||
newkey = str(self.max_key)
|
||||
data.append(newkey)
|
||||
@@ -155,7 +157,7 @@ class BookReportSelector:
|
||||
if not iter:
|
||||
return
|
||||
data = self.bk_model.get_data(iter,range(self.bk_ncols))
|
||||
key = data[2]
|
||||
key = data[self.bk_ncols-1]
|
||||
del self.item_storage[key]
|
||||
self.bk_model.remove(iter)
|
||||
|
||||
@@ -186,17 +188,18 @@ class BookReportSelector:
|
||||
if not iter:
|
||||
return
|
||||
data = self.bk_model.get_data(iter,range(self.bk_ncols))
|
||||
key = data[2]
|
||||
key = data[self.bk_ncols-1]
|
||||
book_item = self.item_storage[key]
|
||||
options_dialog = book_item[2]
|
||||
get_opt = book_item[4]
|
||||
get_stl = book_item[5]
|
||||
opt_dlg = options_dialog(self.db,self.person,get_opt,get_stl)
|
||||
if opt_dlg.person:
|
||||
self.bk_model.model.set_value(iter,2,
|
||||
opt_dlg.person.getPrimaryName().getRegularName())
|
||||
book_item[4] = opt_dlg.get_options
|
||||
book_item[5] = opt_dlg.get_style
|
||||
self.item_storage[key] = book_item
|
||||
self.person = opt_dlg.person
|
||||
#print opt_dlg.person.getPrimaryName().getRegularName()
|
||||
|
||||
def bk_double_click(self,obj,event):
|
||||
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
||||
@@ -213,7 +216,7 @@ class BookReportSelector:
|
||||
self.bk_model.select_row(row)
|
||||
store,iter = self.bk_model.get_selected()
|
||||
data = self.bk_model.get_data(iter,range(self.bk_ncols))
|
||||
key = data[2]
|
||||
key = data[self.bk_ncols-1]
|
||||
book_item = self.item_storage[key]
|
||||
item_list.append(book_item)
|
||||
BookReportDialog(self.db,self.person,item_list)
|
||||
@@ -264,9 +267,8 @@ class BookReportDialog(Report.ReportDialog):
|
||||
self.doc.open(self.target_path)
|
||||
|
||||
def make_report(self):
|
||||
"""Create the contents of the report. This is a simple
|
||||
default implementation suitable for testing. Is should be
|
||||
overridden to produce a real report."""
|
||||
"""The actual book report. Start it out, then go through the item list
|
||||
and call each item's write_book_item method."""
|
||||
self.doc.start_paragraph("Title")
|
||||
title = _("Book Report")
|
||||
self.doc.write_text(title)
|
||||
|
||||
@@ -1177,7 +1177,6 @@ def _make_default_style(self):
|
||||
class FtmDescendantReportDialog(Report.TextReportDialog):
|
||||
def __init__(self,database,person):
|
||||
Report.TextReportDialog.__init__(self,database,person)
|
||||
self.make_default_style = _make_default_style
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@@ -1201,6 +1200,9 @@ class FtmDescendantReportDialog(Report.TextReportDialog):
|
||||
"""Where to save styles for this report."""
|
||||
return "ftm_descendant_report.xml"
|
||||
|
||||
def make_default_style(self):
|
||||
_make_default_style(self)
|
||||
|
||||
def make_report(self):
|
||||
"""Create the object that will produce the FTM Style Descendant Report.
|
||||
All user dialog has already been handled and the output file
|
||||
@@ -1277,6 +1279,8 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog):
|
||||
self.generations_spinbox.set_value(self.max_gen)
|
||||
self.pagebreak_checkbox.set_active(self.pg_brk)
|
||||
|
||||
self.window.run()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Customization hooks
|
||||
@@ -1294,6 +1298,9 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog):
|
||||
"""Where to save styles for this report."""
|
||||
return "ftm_descendant_report.xml"
|
||||
|
||||
def make_default_style(self):
|
||||
_make_default_style(self)
|
||||
|
||||
def on_ok_clicked(self, obj):
|
||||
"""The user is satisfied with the dialog choices. Parse all options
|
||||
and close the window."""
|
||||
@@ -1308,9 +1315,13 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog):
|
||||
self.window.destroy()
|
||||
|
||||
def get_options(self):
|
||||
"""This function returns the options to be used for this book item."""
|
||||
|
||||
return [ self.person, self.max_gen, self.pg_brk ]
|
||||
|
||||
def get_style(self):
|
||||
"""This function returns the style to be used for this book item."""
|
||||
|
||||
return self.selected_style
|
||||
|
||||
|
||||
@@ -1451,4 +1462,4 @@ register_book_item(
|
||||
write_book_item,
|
||||
get_options,
|
||||
get_style
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user