From e1dca2bfaae0f4085074aaaa18edc3d76b3ffb15 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Sat, 26 Nov 2016 15:23:01 -0800 Subject: [PATCH] 9789: Book Report only works with the default values (master "4ffc5e3") --- gramps/gen/config.py | 2 ++ gramps/gen/plug/report/_book.py | 12 +++++++++--- gramps/gui/glade/book.glade | 1 - gramps/gui/plug/report/_bookdialog.py | 10 +++++++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/gramps/gen/config.py b/gramps/gen/config.py index aa948d60c..632cee3d0 100644 --- a/gramps/gen/config.py +++ b/gramps/gen/config.py @@ -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) diff --git a/gramps/gen/plug/report/_book.py b/gramps/gen/plug/report/_book.py index 605837846..b0ef6f8c2 100644 --- a/gramps/gen/plug/report/_book.py +++ b/gramps/gen/plug/report/_book.py @@ -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): """ diff --git a/gramps/gui/glade/book.glade b/gramps/gui/glade/book.glade index bd50a5f89..e476b26ab 100644 --- a/gramps/gui/glade/book.glade +++ b/gramps/gui/glade/book.glade @@ -5,7 +5,6 @@ False Book - center True diff --git a/gramps/gui/plug/report/_bookdialog.py b/gramps/gui/plug/report/_bookdialog.py index 04b11d04a..15b6f28de 100644 --- a/gramps/gui/plug/report/_bookdialog.py +++ b/gramps/gui/plug/report/_bookdialog.py @@ -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(