* src/plugins/BookReport.py (Book.pop_item): Add missing return

statement.
* src/plugins/BookReport.py (BookReportSelector.open_book):
Add a warning if the database for the book is not the same as current.


svn: r1709
This commit is contained in:
Alex Roitman 2003-06-11 22:33:01 +00:00
parent 37e9220498
commit 91b3c84bee
2 changed files with 31 additions and 14 deletions

View File

@ -1,3 +1,9 @@
2003-06-11 Alex Roitman <shura@alex.neuro.umn.edu>
* src/plugins/BookReport.py (Book.pop_item): Add missing return
statement.
* src/plugins/BookReport.py (BookReportSelector.open_book):
Add a warning if the database for the book is not the same as current.
2003-06-11 Tim Waugh <twaugh@redhat.com> 2003-06-11 Tim Waugh <twaugh@redhat.com>
* src/docgen/HtmlDoc.py (add_photo): Fix typo in image reference. * src/docgen/HtmlDoc.py (add_photo): Fix typo in image reference.

View File

@ -19,6 +19,11 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
#
# Written by Alex Roitman,
# largely based on the TextDoc classes by Don Allingham
#
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Standard Python modules # Standard Python modules
@ -64,14 +69,9 @@ import ListModel
import GrampsCfg import GrampsCfg
import Plugins import Plugins
import Report import Report
import TextDoc
#def get_registered_item(name): from QuestionDialog import WarningDialog
# the_item = None
# for item in Plugins._bkitems:
# if item[0] == name:
# the_item = item
# return the_item
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# Book Item class # Book Item class
@ -198,7 +198,7 @@ class Book:
self.item_list.insert(index,item) self.item_list.insert(index,item)
def pop_item(self,index): def pop_item(self,index):
self.item_list.pop(index) return self.item_list.pop(index)
def get_item(self,index): def get_item(self,index):
return self.item_list[index] return self.item_list[index]
@ -264,7 +264,7 @@ class BookList:
Adds or replaces a Book in the BookList. Adds or replaces a Book in the BookList.
name - name assocated with the Book to add or replace. name - name assocated with the Book to add or replace.
style - definition of the Book book - definition of the Book
""" """
self.bookmap[name] = book self.bookmap[name] = book
@ -404,7 +404,7 @@ class BookListDisplay:
self.top.run() self.top.run()
def redraw(self): def redraw(self):
"""Redraws the list of books that are currently available""" """Redraws the list of currently available books"""
self.blist.model.clear() self.blist.model.clear()
names = self.booklist.get_book_names() names = self.booklist.get_book_names()
@ -521,13 +521,24 @@ class BookReportSelector:
self.avail_tree.scroll_to_cell(path,col,1,1,0.0) self.avail_tree.scroll_to_cell(path,col,1,1,0.0)
def open_book(self,book): def open_book(self,book):
if book.get_dbname() == self.db.getSavePath():
same_db = 1
else:
same_db = 0
WarningDialog(_('Different database'), _(
'This book was created with the references to database %s.\n'
'This makes references to the central person saved in the book invalid.\n\n'
'Therefore, the central person for each item is being set '
'to the default person of the currently opened database.' )
% book.get_dbname() )
self.book.clear() self.book.clear()
self.bk_model.clear() self.bk_model.clear()
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(name) item = BookItem(name)
options = saved_item.get_options() options = saved_item.get_options()
if not options[0]: if not same_db or not options[0]:
options[0] = self.person.getId() options[0] = self.person.getId()
item.set_options(options) item.set_options(options)
item.set_style_name(saved_item.get_style_name()) item.set_style_name(saved_item.get_style_name())
@ -538,6 +549,7 @@ class BookReportSelector:
data.append(pname.getPrimaryName().getRegularName()) data.append(pname.getPrimaryName().getRegularName())
self.bk_model.add(data) self.bk_model.add(data)
def on_add_clicked(self,obj): def on_add_clicked(self,obj):
store,iter = self.av_model.get_selected() store,iter = self.av_model.get_selected()
if not iter: if not iter:
@ -680,7 +692,7 @@ class BookReportDialog(Report.ReportDialog):
return _("Book Report") return _("Book Report")
def get_header(self,name): def get_header(self,name):
return _("Book Report") return _("GRAMPS Book")
def make_doc_menu(self): def make_doc_menu(self):
"""Build a menu of document types that are appropriate for """Build a menu of document types that are appropriate for
@ -830,4 +842,3 @@ register_report(
author_name="Alex Roitman", author_name="Alex Roitman",
author_email="shura@alex.neuro.umn.edu" author_email="shura@alex.neuro.umn.edu"
) )