* src/Plugins.py: Register book items with options and style instead
of the functions get_options and get_style. * src/plugins/BookReport.py, src/plugins/FtmStyleDescendants.py, src/plugins/FtmStyleAncestors.py: Change from functions to values, accordingly. Also switch to a proper use of dialog.run(). svn: r1678
This commit is contained in:
parent
4d0aaa727a
commit
9f905eef5f
@ -1,3 +1,10 @@
|
||||
2003-06-09 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/Plugins.py: Register book items with options and style instead
|
||||
of the functions get_options and get_style.
|
||||
* src/plugins/BookReport.py, src/plugins/FtmStyleDescendants.py,
|
||||
src/plugins/FtmStyleAncestors.py: Change from functions to values,
|
||||
accordingly. Also switch to a proper use of dialog.run().
|
||||
|
||||
2003-06-08 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/plugins/BookReport.py, src/plugins/FtmStyleDescendants.py:
|
||||
Minor fixes.
|
||||
|
@ -521,13 +521,13 @@ def relationship_function():
|
||||
# Book item registration
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def register_book_item(name,category,options_dialog,write_book_item,get_options,get_style):
|
||||
def register_book_item(name,category,options_dialog,write_book_item,options,style):
|
||||
"""Register a book item"""
|
||||
|
||||
for n in _bkitems:
|
||||
if n[0] == name:
|
||||
return
|
||||
_bkitems.append((name,category,options_dialog,write_book_item,get_options,get_style))
|
||||
_bkitems.append((name,category,options_dialog,write_book_item,options,style))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -152,6 +152,10 @@ class BookReportSelector:
|
||||
self.bk_model.add(data)
|
||||
for book_item in Plugins._bkitems:
|
||||
if book_item[0] == data[0]:
|
||||
#get_options = book_item[4]
|
||||
#get_style = book_item[5]
|
||||
#store_item = list(book_item)
|
||||
#[ book_item[0], book_item[1], book_item[2], book_item[3], get_options(), get_style() ]
|
||||
self.item_storage[newkey] = list(book_item)
|
||||
|
||||
def on_remove_clicked(self,obj):
|
||||
@ -193,14 +197,15 @@ class BookReportSelector:
|
||||
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)
|
||||
options = book_item[4]
|
||||
style = book_item[5]
|
||||
opt_dlg = options_dialog(self.db,self.person,options,style)
|
||||
opt_dlg.window.destroy()
|
||||
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
|
||||
book_item[4] = opt_dlg.options
|
||||
book_item[5] = opt_dlg.style
|
||||
self.item_storage[key] = book_item
|
||||
|
||||
def bk_double_click(self,obj,event):
|
||||
@ -240,8 +245,7 @@ class BookReportDialog(Report.ReportDialog):
|
||||
Report.BareReportDialog.__init__(self,database,person)
|
||||
self.item_list = item_list
|
||||
book_item = item_list[0]
|
||||
get_style = book_item[5]
|
||||
self.selected_style = get_style()
|
||||
self.selected_style = book_item[5]
|
||||
self.database = database
|
||||
self.person = person
|
||||
|
||||
@ -284,8 +288,7 @@ class BookReportDialog(Report.ReportDialog):
|
||||
first = 1
|
||||
for book_item in self.item_list:
|
||||
write_book_item = book_item[3]
|
||||
get_options = book_item[4]
|
||||
item_options = get_options()
|
||||
item_options = book_item[4]
|
||||
if write_book_item:
|
||||
if first:
|
||||
first = 0
|
||||
|
@ -821,7 +821,6 @@ class FtmAncestorReportDialog(Report.TextReportDialog):
|
||||
def report(database,person):
|
||||
FtmAncestorReportDialog(database,person)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Set up sane defaults for the book_item
|
||||
@ -835,18 +834,14 @@ fo.default_style = TextDoc.StyleSheet()
|
||||
|
||||
_make_default_style(fo)
|
||||
_style = fo.default_style
|
||||
|
||||
_max_gen = 10
|
||||
_pg_brk = 0
|
||||
_options = [ None, _max_gen, _pg_brk ]
|
||||
|
||||
def options_dialog(database,person):
|
||||
FtmAncestorBareReportDialog(database,person)
|
||||
|
||||
def get_style():
|
||||
return _style
|
||||
|
||||
def get_options():
|
||||
return [ None, _max_gen, _pg_brk ]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Book Item Options dialog
|
||||
@ -854,18 +849,18 @@ def get_options():
|
||||
#------------------------------------------------------------------------
|
||||
class FtmAncestorBareReportDialog(Report.BareReportDialog):
|
||||
|
||||
def __init__(self,database,person,get_opt,get_stl):
|
||||
def __init__(self,database,person,opt,stl):
|
||||
|
||||
options = get_opt()
|
||||
if options[0]:
|
||||
self.person = options[0]
|
||||
self.options = opt
|
||||
if self.options[0]:
|
||||
self.person = self.options[0]
|
||||
else:
|
||||
self.person = person
|
||||
Report.BareReportDialog.__init__(self,database,self.person)
|
||||
self.make_default_style = _make_default_style
|
||||
self.max_gen = options[1]
|
||||
self.pg_brk = options[2]
|
||||
self.selected_style = get_stl()
|
||||
self.max_gen = self.options[1]
|
||||
self.pg_brk = self.options[2]
|
||||
self.selected_style = stl
|
||||
self.new_person = None
|
||||
|
||||
self.generations_spinbox.set_value(self.max_gen)
|
||||
@ -893,6 +888,9 @@ class FtmAncestorBareReportDialog(Report.BareReportDialog):
|
||||
def make_default_style(self):
|
||||
_make_default_style(self)
|
||||
|
||||
def on_cancel(self, obj):
|
||||
pass
|
||||
|
||||
def on_ok_clicked(self, obj):
|
||||
"""The user is satisfied with the dialog choices. Parse all options
|
||||
and close the window."""
|
||||
@ -902,21 +900,15 @@ class FtmAncestorBareReportDialog(Report.BareReportDialog):
|
||||
self.parse_report_options_frame()
|
||||
|
||||
self.person = self.new_person
|
||||
|
||||
# Clean up the dialog object
|
||||
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
|
||||
|
||||
self.options = [ self.person, self.max_gen, self.pg_brk ]
|
||||
self.style = self.selected_style
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Function to write Book Item
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def write_book_item(database,person,doc,options,newpage=0):
|
||||
"""Write the FTM Style Ancestor Report options set.
|
||||
All user dialog has already been handled and the output file opened."""
|
||||
@ -1052,7 +1044,7 @@ register_book_item(
|
||||
_("Text"),
|
||||
FtmAncestorBareReportDialog,
|
||||
write_book_item,
|
||||
get_options,
|
||||
get_style
|
||||
_options,
|
||||
_style
|
||||
)
|
||||
|
||||
|
@ -1229,7 +1229,6 @@ class FtmDescendantReportDialog(Report.TextReportDialog):
|
||||
def report(database,person):
|
||||
FtmDescendantReportDialog(database,person)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Set up sane defaults for the book_item
|
||||
@ -1243,18 +1242,14 @@ fo.default_style = TextDoc.StyleSheet()
|
||||
|
||||
_make_default_style(fo)
|
||||
_style = fo.default_style
|
||||
|
||||
_max_gen = 10
|
||||
_pg_brk = 0
|
||||
_options = [ None, _max_gen, _pg_brk ]
|
||||
|
||||
def options_dialog(database,person):
|
||||
FtmDescendantBareReportDialog(database,person)
|
||||
|
||||
def get_style():
|
||||
return _style
|
||||
|
||||
def get_options():
|
||||
return [ None, _max_gen, _pg_brk ]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Book Item Options dialog
|
||||
@ -1262,18 +1257,18 @@ def get_options():
|
||||
#------------------------------------------------------------------------
|
||||
class FtmDescendantBareReportDialog(Report.BareReportDialog):
|
||||
|
||||
def __init__(self,database,person,get_opt,get_stl):
|
||||
def __init__(self,database,person,opt,stl):
|
||||
|
||||
options = get_opt()
|
||||
if options[0]:
|
||||
self.person = options[0]
|
||||
self.options = opt
|
||||
if self.options[0]:
|
||||
self.person = self.options[0]
|
||||
else:
|
||||
self.person = person
|
||||
Report.BareReportDialog.__init__(self,database,self.person)
|
||||
self.make_default_style = _make_default_style
|
||||
self.max_gen = options[1]
|
||||
self.pg_brk = options[2]
|
||||
self.selected_style = get_stl()
|
||||
self.max_gen = self.options[1]
|
||||
self.pg_brk = self.options[2]
|
||||
self.style = stl
|
||||
self.new_person = None
|
||||
|
||||
self.generations_spinbox.set_value(self.max_gen)
|
||||
@ -1301,6 +1296,9 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog):
|
||||
def make_default_style(self):
|
||||
_make_default_style(self)
|
||||
|
||||
def on_cancel(self, obj):
|
||||
pass
|
||||
|
||||
def on_ok_clicked(self, obj):
|
||||
"""The user is satisfied with the dialog choices. Parse all options
|
||||
and close the window."""
|
||||
@ -1310,21 +1308,14 @@ class FtmDescendantBareReportDialog(Report.BareReportDialog):
|
||||
self.parse_report_options_frame()
|
||||
|
||||
self.person = self.new_person
|
||||
|
||||
# Clean up the dialog object
|
||||
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
|
||||
|
||||
self.options = [ self.person, self.max_gen, self.pg_brk ]
|
||||
self.style = self.selected_style
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Function to write Book Item
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def write_book_item(database,person,doc,options,newpage=0):
|
||||
"""Write the FTM Style Descendant Report options set.
|
||||
All user dialog has already been handled and the output file opened."""
|
||||
@ -1460,6 +1451,6 @@ register_book_item(
|
||||
_("Text"),
|
||||
FtmDescendantBareReportDialog,
|
||||
write_book_item,
|
||||
get_options,
|
||||
get_style
|
||||
_options,
|
||||
_style
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user