9789: Book Report only works with the default values (master "4ffc5e3")
This commit is contained in:
parent
13acd73c9e
commit
e3d732a31e
@ -90,7 +90,6 @@ class BookItem:
|
|||||||
"""
|
"""
|
||||||
self.dbase = dbase
|
self.dbase = dbase
|
||||||
self.style_name = "default"
|
self.style_name = "default"
|
||||||
self.was_reconfigured = False # has the item been reconfigured?
|
|
||||||
pmgr = BasePluginManager.get_instance()
|
pmgr = BasePluginManager.get_instance()
|
||||||
|
|
||||||
for pdata in pmgr.get_reg_bookitems():
|
for pdata in pmgr.get_reg_bookitems():
|
||||||
@ -179,7 +178,6 @@ class Book:
|
|||||||
self.paper_format = None
|
self.paper_format = None
|
||||||
self.paper_output = None
|
self.paper_output = None
|
||||||
self.item_list = []
|
self.item_list = []
|
||||||
self.was_reconfigured = False # has the book been reconfigured?
|
|
||||||
if obj:
|
if obj:
|
||||||
if exact_copy:
|
if exact_copy:
|
||||||
self.item_list = obj.item_list
|
self.item_list = obj.item_list
|
||||||
@ -188,8 +186,12 @@ class Book:
|
|||||||
new_item = BookItem(item.dbase, item.get_name())
|
new_item = BookItem(item.dbase, item.get_name())
|
||||||
orig_opt_dict = item.option_class.handler.options_dict
|
orig_opt_dict = item.option_class.handler.options_dict
|
||||||
new_opt_dict = new_item.option_class.handler.options_dict
|
new_opt_dict = new_item.option_class.handler.options_dict
|
||||||
|
menu = new_item.option_class.menu
|
||||||
for optname in orig_opt_dict:
|
for optname in orig_opt_dict:
|
||||||
new_opt_dict[optname] = orig_opt_dict[optname]
|
new_opt_dict[optname] = orig_opt_dict[optname]
|
||||||
|
menu_option = menu.get_option_by_name(optname)
|
||||||
|
if menu_option:
|
||||||
|
menu_option.set_value(new_opt_dict[optname])
|
||||||
new_item.set_style_name(item.get_style_name())
|
new_item.set_style_name(item.get_style_name())
|
||||||
self.item_list.append(new_item)
|
self.item_list.append(new_item)
|
||||||
|
|
||||||
|
@ -76,8 +76,6 @@ from gramps.gen.plug.report._options import ReportOptions
|
|||||||
from ._reportdialog import ReportDialog
|
from ._reportdialog import ReportDialog
|
||||||
from ._docreportdialog import DocReportDialog
|
from ._docreportdialog import DocReportDialog
|
||||||
|
|
||||||
from gramps.gen.display.name import displayer as _nd
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Private Constants
|
# Private Constants
|
||||||
@ -463,13 +461,14 @@ class BookSelector(ManagedWindow):
|
|||||||
for saved_item in book.get_item_list():
|
for saved_item in book.get_item_list():
|
||||||
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
|
|
||||||
|
|
||||||
# The option values were loaded magically by the book parser.
|
# The option values were loaded magically by the book parser.
|
||||||
# But they still need to be applied to the menu options.
|
# But they still need to be applied to the menu options.
|
||||||
opt_dict = item.option_class.handler.options_dict
|
opt_dict = item.option_class.handler.options_dict
|
||||||
|
orig_opt_dict = saved_item.option_class.handler.options_dict
|
||||||
menu = item.option_class.menu
|
menu = item.option_class.menu
|
||||||
for optname in opt_dict:
|
for optname in opt_dict:
|
||||||
|
opt_dict[optname] = orig_opt_dict[optname]
|
||||||
menu_option = menu.get_option_by_name(optname)
|
menu_option = menu.get_option_by_name(optname)
|
||||||
if menu_option:
|
if menu_option:
|
||||||
menu_option.set_value(opt_dict[optname])
|
menu_option.set_value(opt_dict[optname])
|
||||||
@ -751,7 +750,7 @@ class BookSelector(ManagedWindow):
|
|||||||
# booklist was saved into a file so everything was fine, but
|
# booklist was saved into a file so everything was fine, but
|
||||||
# this created a problem once the paper settings were added
|
# this created a problem once the paper settings were added
|
||||||
# to the Book object in the BookDialog, since those settings
|
# to the Book object in the BookDialog, since those settings
|
||||||
# were retrieved from the Book object in Book.save, so mutiple
|
# were retrieved from the Book object in BookList.save, so mutiple
|
||||||
# books (differentiated by their names) were assigned the
|
# books (differentiated by their names) were assigned the
|
||||||
# same paper values, so the solution is to make each Book be
|
# same paper values, so the solution is to make each Book be
|
||||||
# unique in the booklist, so if multiple copies are saved away
|
# unique in the booklist, so if multiple copies are saved away
|
||||||
@ -926,14 +925,13 @@ class BookDialog(DocReportDialog):
|
|||||||
def __init__(self, dbstate, uistate, book, options):
|
def __init__(self, dbstate, uistate, book, options):
|
||||||
self.format_menu = None
|
self.format_menu = None
|
||||||
self.options = options
|
self.options = options
|
||||||
self.is_from_saved_book = False
|
|
||||||
self.page_html_added = False
|
self.page_html_added = False
|
||||||
self.book = book
|
self.book = book
|
||||||
self.title = _('Generate Book')
|
self.title = _('Generate Book')
|
||||||
self.database = dbstate.db
|
self.database = dbstate.db
|
||||||
DocReportDialog.__init__(self, dbstate, uistate, options,
|
DocReportDialog.__init__(self, dbstate, uistate, options,
|
||||||
'book', self.title)
|
'book', self.title)
|
||||||
self.options.options_dict['bookname'] = self.book.name
|
self.options.options_dict['bookname'] = self.book.get_name()
|
||||||
|
|
||||||
response = self.window.run()
|
response = self.window.run()
|
||||||
if response == Gtk.ResponseType.OK:
|
if response == Gtk.ResponseType.OK:
|
||||||
@ -1038,7 +1036,6 @@ class BookDialog(DocReportDialog):
|
|||||||
self.options = option_class(self.raw_name, self.database)
|
self.options = option_class(self.raw_name, self.database)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.options = option_class
|
self.options = option_class
|
||||||
if not self.is_from_saved_book:
|
|
||||||
self.options.load_previous_values()
|
self.options.load_previous_values()
|
||||||
handler = self.options.handler
|
handler = self.options.handler
|
||||||
if self.book.get_paper_name():
|
if self.book.get_paper_name():
|
||||||
|
Loading…
Reference in New Issue
Block a user