Remove the "tables" parameter for text and book document generators. All generators support tables, and if one didn't, it doesn't look like the code would work.

svn: r10745
This commit is contained in:
Brian Matherly 2008-05-20 03:19:58 +00:00
parent 1d306345bd
commit 92d5ba8dfd
12 changed files with 36 additions and 56 deletions

View File

@ -447,7 +447,7 @@ class PluginManager(gen.utils.Callback):
self.__cl_list.append( (name, category, report_class, options_class,
translated_name, unsupported, require_active) )
def register_text_doc(self, name, classref, table, paper, style, ext,
def register_text_doc(self, name, classref, paper, style, ext,
print_report_label=None, clname=''):
"""
Register a text document generator.
@ -463,11 +463,11 @@ class PluginManager(gen.utils.Callback):
if not clname:
clname = ext[1:]
self.__textdoc_list.append( (name, classref, table, paper, style,
self.__textdoc_list.append( (name, classref, paper, style,
ext, print_report_label, clname) )
self.__mod2text[classref.__module__] = name
def register_book_doc(self, name, classref, table, paper, style, ext,
def register_book_doc(self, name, classref, paper, style, ext,
print_report_label=None, clname=''):
"""
Register a text document generator.
@ -482,7 +482,7 @@ class PluginManager(gen.utils.Callback):
if not clname:
clname = ext[1:]
self.__bookdoc_list.append( (name, classref, table, paper, style, ext,
self.__bookdoc_list.append( (name, classref, paper, style, ext,
print_report_label, clname) )
def register_draw_doc(self, name, classref, paper, style, ext,

View File

@ -50,24 +50,22 @@ class BookFormatComboBox(gtk.ComboBox):
self.__book_doc_list.sort()
gtk.ComboBox.__init__(self)
def set(self,tables,callback, obj=None,active=None):
def set(self, callback, obj=None, active=None):
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()
self.pack_start(cell,True)
self.add_attribute(cell,'text',0)
self.pack_start(cell, True)
self.add_attribute(cell, 'text', 0)
out_pref = Config.get(Config.OUTPUT_PREFERENCE)
index = 0
active_index = 0
self.data = []
for item in self.__book_doc_list:
if tables and item[2] == 0:
continue
self.data.append(item)
name = item[0]
self.store.append(row=[name])
if item[7] == active:
if item[6] == active:
active_index = index
elif not active and name == out_pref:
active_index = index
@ -81,13 +79,13 @@ class BookFormatComboBox(gtk.ComboBox):
return self.data[self.get_active()][0]
def get_paper(self):
return self.data[self.get_active()][3]
return self.data[self.get_active()][2]
def get_ext(self):
return self.data[self.get_active()][5]
return self.data[self.get_active()][4]
def get_printable(self):
return self.data[self.get_active()][6]
return self.data[self.get_active()][5]
def get_clname(self):
return self.data[self.get_active()][7]
return self.data[self.get_active()][6]

View File

@ -39,22 +39,20 @@ class TextFormatComboBox(gtk.ComboBox):
self.__text_doc_list.sort()
gtk.ComboBox.__init__(self)
def set(self,tables,callback, obj=None,active=None):
def set(self, callback, obj=None, active=None):
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()
self.pack_start(cell,True)
self.add_attribute(cell,'text',0)
self.pack_start(cell, True)
self.add_attribute(cell, 'text', 0)
out_pref = Config.get(Config.OUTPUT_PREFERENCE)
index = 0
active_index = 0
for item in self.__text_doc_list:
if tables and item[2] == 0:
continue
name = item[0]
self.store.append(row=[name])
if item[7] == active:
if item[6] == active:
active_index = index
elif not active and name == out_pref:
active_index = index
@ -68,16 +66,16 @@ class TextFormatComboBox(gtk.ComboBox):
return self.__text_doc_list[self.get_active()][1]
def get_paper(self):
return self.__text_doc_list[self.get_active()][3]
return self.__text_doc_list[self.get_active()][2]
def get_styles(self):
return self.__text_doc_list[self.get_active()][4]
return self.__text_doc_list[self.get_active()][3]
def get_ext(self):
return self.__text_doc_list[self.get_active()][5]
return self.__text_doc_list[self.get_active()][4]
def get_printable(self):
return self.__text_doc_list[self.get_active()][6]
return self.__text_doc_list[self.get_active()][5]
def get_clname(self):
return self.__text_doc_list[self.get_active()][7]
return self.__text_doc_list[self.get_active()][6]

View File

@ -40,17 +40,6 @@ class TextReportDialog(DocReportDialog):
DocReportDialog.__init__(self, dbstate, uistate, options,
name, translated_name)
#------------------------------------------------------------------------
#
# Customization hooks for subclasses
#
#------------------------------------------------------------------------
def doc_uses_tables(self):
"""Does this report require the ability to generate tables in
the file format. Override this for documents that do need
table support."""
return 0
#------------------------------------------------------------------------
#
# Functions related to selecting/changing the current file format.
@ -61,5 +50,4 @@ class TextReportDialog(DocReportDialog):
this text report. This menu will be generated based upon
whether the document requires table support, etc."""
self.format_menu = TextFormatComboBox()
self.format_menu.set(self.doc_uses_tables(),
self.doc_type_changed, None, active)
self.format_menu.set(self.doc_type_changed, None, active)

View File

@ -384,7 +384,7 @@ try:
else:
print_label=None
pmgr.register_text_doc(mtype, AsciiDoc, 1, 1, 1, ".txt", print_label)
pmgr.register_text_doc(mtype, AsciiDoc, 1, 1, ".txt", print_label)
except:
pmgr.register_text_doc(_("Plain Text"), AsciiDoc, 1, 1, 1, ".txt", None)
pmgr.register_text_doc(_("Plain Text"), AsciiDoc, 1, 1, ".txt", None)

View File

@ -620,6 +620,6 @@ class GtkPrint(CairoDoc):
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_text_doc(_('Print...'), GtkPrint, 1, 1, 1, "", None)
pmgr.register_text_doc(_('Print...'), GtkPrint, 1, 1, "", None)
pmgr.register_draw_doc(_('Print...'), GtkPrint, 1, 1, "", None)
pmgr.register_book_doc(_('Print...'), GtkPrint, 1, 1, 1, "", None)
pmgr.register_book_doc(_('Print...'), GtkPrint, 1, 1, "", None)

View File

@ -494,6 +494,6 @@ try:
if mtype == _("unknown"):
mtype = _('HTML')
pmgr.register_text_doc(mtype, HtmlDoc, 1, 0, 1, ".html", print_label)
pmgr.register_text_doc(mtype, HtmlDoc, 0, 1, ".html", print_label)
except:
pmgr.register_text_doc(_('HTML'), HtmlDoc, 1, 0, 1, ".html", None)
pmgr.register_text_doc(_('HTML'), HtmlDoc, 0, 1, ".html", None)

View File

@ -534,4 +534,4 @@ try:
except:
print_label = None
pmgr.register_text_doc(_('LaTex'), LaTeXDoc, 1, 1, 0, ".tex", print_label)
pmgr.register_text_doc(_('LaTex'), LaTeXDoc, 1, 0, ".tex", print_label)

View File

@ -1158,8 +1158,8 @@ except:
print_label = None
pmgr.register_text_doc(_('Open Document Text'),
ODFDoc, 1, 1, 1, ".odt", print_label)
ODFDoc, 1, 1, ".odt", print_label)
pmgr.register_book_doc(_("Open Document Text"),
ODFDoc, 1, 1, 1, ".odt", print_label)
ODFDoc, 1, 1, ".odt", print_label)
pmgr.register_draw_doc(_("Open Document Text"),
ODFDoc, 1, 1, ".odt", print_label);

View File

@ -150,8 +150,8 @@ def register_docgen():
print_label = None
pmgr = PluginManager.get_instance()
pmgr.register_text_doc(mtype, PdfDoc, 1, 1, 1, ".pdf", print_label)
pmgr.register_text_doc(mtype, PdfDoc, 1, 1, ".pdf", print_label)
pmgr.register_draw_doc(mtype, PdfDoc, 1, 1, ".pdf", print_label)
pmgr.register_book_doc(mtype, PdfDoc, 1, 1, 1, ".pdf", print_label)
pmgr.register_book_doc(mtype, PdfDoc, 1, 1, ".pdf", print_label)
register_docgen()

View File

@ -449,6 +449,6 @@ try:
print_label=_("Open in %s") % mprog[1]
else:
print_label=None
pmgr.register_text_doc(mtype, RTFDoc, 1, 1, 1, ".rtf", print_label)
pmgr.register_text_doc(mtype, RTFDoc, 1, 1, ".rtf", print_label)
except:
pmgr.register_text_doc(_('RTF document'), RTFDoc, 1, 1, 1, ".rtf", None)
pmgr.register_text_doc(_('RTF document'), RTFDoc, 1, 1, ".rtf", None)

View File

@ -1103,9 +1103,6 @@ class BookReportDialog(DocReportDialog):
def setup_other_frames(self): pass
def parse_style_frame(self): pass
def doc_uses_tables(self):
return 1
def get_title(self):
return _("Book Report")
@ -1121,8 +1118,7 @@ class BookReportDialog(DocReportDialog):
this text report. This menu will be generated based upon
whether the document requires table support, etc."""
self.format_menu = BookFormatComboBox()
self.format_menu.set(self.doc_uses_tables(),
self.doc_type_changed, None, active)
self.format_menu.set(self.doc_type_changed, None, active)
def make_document(self):
"""Create a document of the type requested by the user."""