From f28b8831863b68dcb0922e26051cbd6506f50145 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 21 Feb 2002 06:09:20 +0000 Subject: [PATCH] Output format preferences in config dialog is now dynamic svn: r787 --- gramps/src/Config.py | 8 +++++--- gramps/src/Plugins.py | 15 ++++++++++++++- gramps/src/Report.py | 6 +++--- gramps/src/const.py | 7 ------- gramps/src/gramps.glade | 2 +- gramps/src/preferences.glade | 5 +---- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/gramps/src/Config.py b/gramps/src/Config.py index 9ec7092f6..a5659c244 100644 --- a/gramps/src/Config.py +++ b/gramps/src/Config.py @@ -28,6 +28,7 @@ import string import os import PaperMenu +import Plugins #------------------------------------------------------------------------- # @@ -569,6 +570,8 @@ class GrampsPreferences: self.apply = self.top.get_widget("apply") self.tree = self.top.get_widget("tree") self.panel = self.top.get_widget("panel") + self.ofmt = self.top.get_widget("output_format") + self.build_tree() self.build() self.build_ext() @@ -684,13 +687,12 @@ class GrampsPreferences: menu.set_active(lastnamegen) lastnamegen_obj.set_menu(menu) - output_obj = self.top.get_widget("output_format") menu = gtk.GtkMenu() choice = 0 choice = 0 index = 0 - for name in const.output_formats: + for name in Plugins.get_text_doc_list(): if name == output_preference: choice = index item = gtk.GtkMenuItem(name) @@ -700,7 +702,7 @@ class GrampsPreferences: menu.append(item) index = index + 1 menu.set_active(choice) - output_obj.set_menu(menu) + self.ofmt.set_menu(menu) date_option = self.top.get_widget("date_format") date_menu = gtk.GtkMenu() diff --git a/gramps/src/Plugins.py b/gramps/src/Plugins.py index 0fe6704a8..28dbe2c94 100644 --- a/gramps/src/Plugins.py +++ b/gramps/src/Plugins.py @@ -276,7 +276,7 @@ def load_plugins(dir): a = __import__(plugin) _success.append(a) except: - print _("Note: failed to load the plugin module: %s") % plugin + print _("Note: %s support could not be loaded") % plugin #------------------------------------------------------------------------- # @@ -493,6 +493,19 @@ 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_text_doc_list(): + + l = [] + _textdoc.sort() + for item in _textdoc: + l.append(item[0]) + return l + #------------------------------------------------------------------------- # # get_draw_doc_menu diff --git a/gramps/src/Report.py b/gramps/src/Report.py index 448e926e5..7382945b9 100644 --- a/gramps/src/Report.py +++ b/gramps/src/Report.py @@ -373,11 +373,11 @@ class ReportDialog: this report. This menu will be generated based upon the type of document (text, draw, graph, etc. - a subclass), whether or not the document requires table support, etc.""" - assert 0, _("The make_doc_menu function must be overridden.") + assert 0, "The make_doc_menu function must be overridden." def make_document(self): """Create a document of the type selected by the user.""" - assert 0, _("The make_document function must be overridden.") + assert 0, "The make_document function must be overridden." def doc_type_changed(self, obj): """This routine is called when the user selects a new file @@ -850,7 +850,7 @@ class ReportDialog: routine should either write the data directly to the file, or better yet, should create a subclass of a Report that will write the data to a file.""" - assert 0, _("The make_report function must be overridden.") + assert 0, "The make_report function must be overridden." #------------------------------------------------------------------------ # diff --git a/gramps/src/const.py b/gramps/src/const.py index ace1369cc..151a37243 100644 --- a/gramps/src/const.py +++ b/gramps/src/const.py @@ -110,13 +110,6 @@ unknown = _("unknown") # #------------------------------------------------------------------------- -output_formats = [ - "OpenOffice", - "AbiWord", - "PDF", - "HTML" - ] - childRelations = { _("Birth") : "Birth", _("Adopted") : "Adopted", diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index 9a77ccb3a..82860856f 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -824,7 +824,7 @@ on_apply_filter_clicked Thu, 06 Sep 2001 23:02:43 GMT - False + True True 0 diff --git a/gramps/src/preferences.glade b/gramps/src/preferences.glade index de24b4b7c..9dca7700e 100644 --- a/gramps/src/preferences.glade +++ b/gramps/src/preferences.glade @@ -2413,10 +2413,7 @@ GtkOptionMenu output_format True - OpenOffice -HTML -PDF -AbiWord + 0