(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
This commit is contained in:
Alex Roitman 2003-09-10 03:05:14 +00:00
parent 07009fbe9d
commit 8d2c37f2b4
3 changed files with 18 additions and 9 deletions

View File

@ -6,6 +6,10 @@
(select_file): Add a placeholder function. (select_file): Add a placeholder function.
(select_obj): Gracefully handle Cancel empty object (cancel). (select_obj): Gracefully handle Cancel empty object (cancel).
Enable Remove button on non-empty selection. 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 <dallingham@users.sourceforge.net> 2003-09-08 Don Allingham <dallingham@users.sourceforge.net>
* src/GenericFilter.py: handle the possibility of missing * src/GenericFilter.py: handle the possibility of missing

View File

@ -675,6 +675,9 @@ class BookReportSelector:
self.book.append_item(item) self.book.append_item(item)
data = [ item.get_name(), item.get_category() ] data = [ item.get_name(), item.get_category() ]
if data[1] == _("Title"):
data.append(_("Not Applicable"))
else:
pname = self.db.getPerson(options[0]) pname = self.db.getPerson(options[0])
data.append(pname.getPrimaryName().getRegularName()) data.append(pname.getPrimaryName().getRegularName())
self.bk_model.add(data) self.bk_model.add(data)

View File

@ -80,6 +80,7 @@ class SimpleBookTitle(Report.Report):
self.doc.write_text(self.title_string) self.doc.write_text(self.title_string)
self.doc.end_paragraph() self.doc.end_paragraph()
if self.object_id:
object = self.database.getObject(self.object_id) object = self.database.getObject(self.object_id)
name = object.getPath() name = object.getPath()
self.doc.add_photo(name,'center',10,10) self.doc.add_photo(name,'center',10,10)
@ -124,7 +125,7 @@ _style_name = "default"
_person_id = "" _person_id = ""
_title_string = "" _title_string = ""
_object_id = None _object_id = ""
_copyright_string = "" _copyright_string = ""
_options = ( _person_id, _title_string, _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]: if self.options[2]:
self.object_id = self.options[2] self.object_id = self.options[2]
else: else:
self.object_id = None self.object_id = ""
if self.options[3]: if self.options[3]:
self.copyright_string = self.options[3] self.copyright_string = self.options[3]
@ -181,6 +182,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog):
else: else:
icon_image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(the_type)) icon_image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(the_type))
self.preview.set_from_pixbuf(icon_image) self.preview.set_from_pixbuf(icon_image)
self.remove_obj_button.set_sensitive(gtk.TRUE)
self.new_person = None self.new_person = None
@ -262,7 +264,7 @@ class SimpleBookTitleDialog(Report.BareReportDialog):
pass pass
def remove_obj(self, obj): def remove_obj(self, obj):
self.object_id = None self.object_id = ""
self.obj_title.set_text('') self.obj_title.set_text('')
self.preview.set_from_pixbuf(None) self.preview.set_from_pixbuf(None)
self.remove_obj_button.set_sensitive(gtk.FALSE) 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]: if options[2]:
object_id = options[2] object_id = options[2]
else: else:
object_id = None object_id = ""
if options[3]: if options[3]:
copyright_string = options[3] copyright_string = options[3]
else: else: