0003032: Book reports loses center person
svn: r12837
This commit is contained in:
parent
06171f8488
commit
1a60fad3fc
@ -105,19 +105,22 @@ def _initialize_options(options, dbstate):
|
|||||||
menu: The Menu class
|
menu: The Menu class
|
||||||
dbase: the database the options will be applied to
|
dbase: the database the options will be applied to
|
||||||
"""
|
"""
|
||||||
dbase = dbstate.get_database()
|
|
||||||
if not hasattr(options, "menu"):
|
if not hasattr(options, "menu"):
|
||||||
return
|
return
|
||||||
|
dbase = dbstate.get_database()
|
||||||
menu = options.menu
|
menu = options.menu
|
||||||
|
|
||||||
for name in menu.get_all_option_names():
|
for name in menu.get_all_option_names():
|
||||||
option = menu.get_option_by_name(name)
|
option = menu.get_option_by_name(name)
|
||||||
|
value = option.get_value()
|
||||||
|
|
||||||
if isinstance(option, PersonOption):
|
if isinstance(option, PersonOption):
|
||||||
|
if not dbase.get_person_from_gramps_id(value):
|
||||||
person = dbstate.get_active_person()
|
person = dbstate.get_active_person()
|
||||||
option.set_value(person.get_gramps_id())
|
option.set_value(person.get_gramps_id())
|
||||||
|
|
||||||
elif isinstance(option, FamilyOption):
|
elif isinstance(option, FamilyOption):
|
||||||
|
if not dbase.get_family_from_gramps_id(value):
|
||||||
person = dbstate.get_active_person()
|
person = dbstate.get_active_person()
|
||||||
family_list = person.get_family_handle_list()
|
family_list = person.get_family_handle_list()
|
||||||
if family_list:
|
if family_list:
|
||||||
@ -789,6 +792,15 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
|||||||
name = saved_item.get_name()
|
name = saved_item.get_name()
|
||||||
item = BookItem(self.db, name)
|
item = BookItem(self.db, name)
|
||||||
item.option_class = saved_item.option_class
|
item.option_class = saved_item.option_class
|
||||||
|
|
||||||
|
# The option values were loaded magically by the book parser.
|
||||||
|
# But they still need to be applied to the menu options.
|
||||||
|
opt_dict = item.option_class.handler.options_dict
|
||||||
|
menu = item.option_class.menu
|
||||||
|
for optname in opt_dict:
|
||||||
|
menu_option = menu.get_option_by_name(optname)
|
||||||
|
menu_option.set_value(opt_dict[optname])
|
||||||
|
|
||||||
_initialize_options(item.option_class, self.dbstate)
|
_initialize_options(item.option_class, self.dbstate)
|
||||||
item.set_style_name(saved_item.get_style_name())
|
item.set_style_name(saved_item.get_style_name())
|
||||||
self.book.append_item(item)
|
self.book.append_item(item)
|
||||||
|
Loading…
Reference in New Issue
Block a user