From deada04e03e88c1ab04950b774176d668eed3e28 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 30 Jun 2003 03:12:22 +0000 Subject: [PATCH] * src/DisplayTrace.py: identify more linux versions * src/gramps_main.py: fix callbacks for reports * src/plugins/ReorderIds.py: handle integers larger that 32bit * src/Plugins.py: keep a separate lists for formats that support the book format * src/docgen/PdfDoc.py: register as a format supporting books * src/docgen/OpenOfficeDoc.py: register as a format supporting books * src/plugins/BookReport.py: Support different lists for books svn: r1804 --- gramps2/src/Plugins.py | 55 +++++++++++++++++++++++++++++ gramps2/src/docgen/OpenOfficeDoc.py | 1 + gramps2/src/docgen/PdfDoc.py | 9 +++++ gramps2/src/plugins/BookReport.py | 4 +-- 4 files changed, 67 insertions(+), 2 deletions(-) diff --git a/gramps2/src/Plugins.py b/gramps2/src/Plugins.py index 24fada900..2d000c0c3 100644 --- a/gramps2/src/Plugins.py +++ b/gramps2/src/Plugins.py @@ -76,6 +76,7 @@ _expect = [] _attempt = [] _loaddir = [] _textdoc = [] +_bookdoc = [] _drawdoc = [] _failmsg = [] _bkitems = [] @@ -486,6 +487,18 @@ def register_text_doc(name,classref, table, paper, style, ext): return _textdoc.append((name,classref,table,paper,style,ext)) +#------------------------------------------------------------------------- +# +# Text document registration +# +#------------------------------------------------------------------------- +def register_book_doc(name,classref, table, paper, style, ext): + """Register a text document generator""" + for n in _bookdoc: + if n[0] == name: + return + _bookdoc.append((name,classref,table,paper,style,ext)) + #------------------------------------------------------------------------- # # Drawing document registration @@ -654,6 +667,36 @@ def get_text_doc_menu(main_menu,tables,callback,obj=None): index = index + 1 main_menu.set_menu(myMenu) +#------------------------------------------------------------------------- +# +# get_text_doc_menu +# +#------------------------------------------------------------------------- +def get_book_menu(main_menu,tables,callback,obj=None): + + index = 0 + myMenu = gtk.Menu() + _bookdoc.sort() + for item in _bookdoc: + if tables and item[2] == 0: + continue + name = item[0] + menuitem = gtk.MenuItem(name) + menuitem.set_data("name",item[1]) + menuitem.set_data("styles",item[4]) + menuitem.set_data("paper",item[3]) + menuitem.set_data("ext",item[5]) + menuitem.set_data("obj",obj) + if callback: + menuitem.connect("activate",callback) + menuitem.show() + myMenu.append(menuitem) + if name == GrampsCfg.output_preference: + myMenu.set_active(index) + callback(menuitem) + index = index + 1 + main_menu.set_menu(myMenu) + #------------------------------------------------------------------------- # # get_text_doc_list @@ -666,6 +709,18 @@ def get_text_doc_list(): l.append(item[0]) return l +#------------------------------------------------------------------------- +# +# get_text_doc_list +# +#------------------------------------------------------------------------- +def get_book_doc_list(): + l = [] + _bookdoc.sort() + for item in _bookdoc: + l.append(item[0]) + return l + #------------------------------------------------------------------------- # # get_draw_doc_list diff --git a/gramps2/src/docgen/OpenOfficeDoc.py b/gramps2/src/docgen/OpenOfficeDoc.py index e279291ba..d38013bfc 100644 --- a/gramps2/src/docgen/OpenOfficeDoc.py +++ b/gramps2/src/docgen/OpenOfficeDoc.py @@ -616,3 +616,4 @@ class OpenOfficeDoc(TextDoc.TextDoc): self.f.close() Plugins.register_text_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1,".sxw") +Plugins.register_book_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1,".sxw") diff --git a/gramps2/src/docgen/PdfDoc.py b/gramps2/src/docgen/PdfDoc.py index 48329badd..be6691b63 100644 --- a/gramps2/src/docgen/PdfDoc.py +++ b/gramps2/src/docgen/PdfDoc.py @@ -323,3 +323,12 @@ Plugins.register_text_doc( style=1, ext=".pdf" ) + +Plugins.register_book_doc( + name=_("PDF"), + classref=PdfDoc, + table=1, + paper=1, + style=1, + ext=".pdf" + ) diff --git a/gramps2/src/plugins/BookReport.py b/gramps2/src/plugins/BookReport.py index 43ebf4fa5..59af261ae 100644 --- a/gramps2/src/plugins/BookReport.py +++ b/gramps2/src/plugins/BookReport.py @@ -861,8 +861,8 @@ class BookReportDialog(Report.ReportDialog): """Build a menu of document types that are appropriate for this text report. This menu will be generated based upon whether the document requires table support, etc.""" - Plugins.get_text_doc_menu(self.format_menu, self.doc_uses_tables(), - self.doc_type_changed) + Plugins.get_book_menu(self.format_menu, self.doc_uses_tables(), + self.doc_type_changed) def make_document(self): """Create a document of the type requested by the user."""