9789: Book Report only works with the default values (master "4ffc5e3")

This commit is contained in:
Paul Franklin 2016-11-26 15:23:01 -08:00
parent fec5d532d1
commit e1dca2bfaa
4 changed files with 20 additions and 5 deletions

View File

@ -188,6 +188,8 @@ register('interface.address-width', 650)
register('interface.attribute-height', 350)
register('interface.attribute-width', 600)
register('interface.book-selector-height', 600)
register('interface.book-selector-horiz-position', 100)
register('interface.book-selector-vert-position', 200)
register('interface.book-selector-width', 700)
register('interface.child-ref-height', 450)
register('interface.child-ref-width', 600)

View File

@ -90,6 +90,7 @@ class BookItem:
"""
self.dbase = dbase
self.style_name = "default"
self.was_reconfigured = False # has the item been reconfigured?
pmgr = BasePluginManager.get_instance()
for pdata in pmgr.get_reg_bookitems():
@ -178,14 +179,19 @@ class Book:
self.paper_format = None
self.paper_output = None
self.item_list = []
self.was_reconfigured = False # has the book been reconfigured?
if obj:
if exact_copy:
self.item_list = obj.item_list
else:
for item in obj.get_item_list():
regenerated_item = BookItem(item.dbase, item.get_name())
regenerated_item.set_style_name(item.get_style_name())
self.item_list.append(regenerated_item)
new_item = BookItem(item.dbase, item.get_name())
orig_opt_dict = item.option_class.handler.options_dict
new_opt_dict = new_item.option_class.handler.options_dict
for optname in orig_opt_dict:
new_opt_dict[optname] = orig_opt_dict[optname]
new_item.set_style_name(item.get_style_name())
self.item_list.append(new_item)
def set_name(self, name):
"""

View File

@ -5,7 +5,6 @@
<object class="GtkWindow" id="top">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Book</property>
<property name="window_position">center</property>
<child>
<object class="GtkBox" id="vbox4">
<property name="visible">True</property>

View File

@ -334,6 +334,9 @@ class BookSelector(ManagedWindow):
self.height_key = 'interface.book-selector-height'
self.width_key = 'interface.book-selector-width'
self._set_size()
self.horiz_position_key = 'interface.book-selector-horiz-position'
self.vert_position_key = 'interface.book-selector-vert-position'
self._set_position()
window.show()
self.xml.connect_signals({
"on_add_clicked" : self.on_add_clicked,
@ -678,7 +681,7 @@ class BookSelector(ManagedWindow):
"""
Run final BookDialog with the current book.
"""
if self.book.item_list:
if self.book.get_item_list():
old_paper_name = self.book.get_paper_name() # from books.xml
old_orientation = self.book.get_orientation()
old_paper_metric = self.book.get_paper_metric()
@ -719,6 +722,11 @@ class BookSelector(ManagedWindow):
"""
Save the current book in the xml booklist file.
"""
if not self.book.get_item_list():
WarningDialog(_('No items'),
_('This book has no items.'),
parent=self.window)
return
name = str(self.name_entry.get_text())
if not name:
WarningDialog(