From 8d2c37f2b48b0d58d1f10c4180559888e9e8140c Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 10 Sep 2003 03:05:14 +0000 Subject: [PATCH] (SimpleBookTitle.write_report): Insert image only if it is passed. Set empty object_id to "" (was None). * src/plugins/BookReport.py (BookReportSelector.open_book): Don't displpay person name for special items (title). svn: r2111 --- gramps2/ChangeLog | 4 ++++ gramps2/src/plugins/BookReport.py | 7 +++++-- gramps2/src/plugins/SimpleBookTitle.py | 16 +++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 9296a14bd..7d8f17e16 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -6,6 +6,10 @@ (select_file): Add a placeholder function. (select_obj): Gracefully handle Cancel empty object (cancel). Enable Remove button on non-empty selection. + (SimpleBookTitle.write_report): Insert image only if it is passed. + Set empty object_id to "" (was None). + * src/plugins/BookReport.py (BookReportSelector.open_book): + Don't displpay person name for special items (title). 2003-09-08 Don Allingham * src/GenericFilter.py: handle the possibility of missing diff --git a/gramps2/src/plugins/BookReport.py b/gramps2/src/plugins/BookReport.py index cd8fada5d..2134eaf3c 100644 --- a/gramps2/src/plugins/BookReport.py +++ b/gramps2/src/plugins/BookReport.py @@ -675,8 +675,11 @@ class BookReportSelector: self.book.append_item(item) data = [ item.get_name(), item.get_category() ] - pname = self.db.getPerson(options[0]) - data.append(pname.getPrimaryName().getRegularName()) + if data[1] == _("Title"): + data.append(_("Not Applicable")) + else: + pname = self.db.getPerson(options[0]) + data.append(pname.getPrimaryName().getRegularName()) self.bk_model.add(data) def on_add_clicked(self,obj): diff --git a/gramps2/src/plugins/SimpleBookTitle.py b/gramps2/src/plugins/SimpleBookTitle.py index fda75a7e0..d36429c0a 100644 --- a/gramps2/src/plugins/SimpleBookTitle.py +++ b/gramps2/src/plugins/SimpleBookTitle.py @@ -80,9 +80,10 @@ class SimpleBookTitle(Report.Report): self.doc.write_text(self.title_string) self.doc.end_paragraph() - object = self.database.getObject(self.object_id) - name = object.getPath() - self.doc.add_photo(name,'center',10,10) + if self.object_id: + object = self.database.getObject(self.object_id) + name = object.getPath() + self.doc.add_photo(name,'center',10,10) self.doc.start_paragraph('SBT-Subtitle') self.doc.write_text(self.copyright_string) @@ -124,7 +125,7 @@ _style_name = "default" _person_id = "" _title_string = "" -_object_id = None +_object_id = "" _copyright_string = "" _options = ( _person_id, _title_string, _object_id, _copyright_string ) @@ -157,7 +158,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog): if self.options[2]: self.object_id = self.options[2] else: - self.object_id = None + self.object_id = "" if self.options[3]: self.copyright_string = self.options[3] @@ -181,6 +182,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog): else: icon_image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(the_type)) self.preview.set_from_pixbuf(icon_image) + self.remove_obj_button.set_sensitive(gtk.TRUE) self.new_person = None @@ -262,7 +264,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog): pass def remove_obj(self, obj): - self.object_id = None + self.object_id = "" self.obj_title.set_text('') self.preview.set_from_pixbuf(None) self.remove_obj_button.set_sensitive(gtk.FALSE) @@ -321,7 +323,7 @@ def write_book_item(database,person,doc,options,newpage=0): if options[2]: object_id = options[2] else: - object_id = None + object_id = "" if options[3]: copyright_string = options[3] else: