From e310468f60603140f5fe03c1cba1739170630c90 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 24 Feb 2002 15:50:42 +0000 Subject: [PATCH] Plugin information is stored for display later instead of being dumped to the terminal window svn: r797 --- gramps/src/Plugins.py | 32 +++++++++++++-- gramps/src/const.py | 1 + gramps/src/gramps.glade | 13 +++++++ gramps/src/gramps_main.py | 6 ++- gramps/src/plugstat.glade | 82 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 gramps/src/plugstat.glade diff --git a/gramps/src/Plugins.py b/gramps/src/Plugins.py index 80aea7d44..8775abf06 100644 --- a/gramps/src/Plugins.py +++ b/gramps/src/Plugins.py @@ -70,6 +70,7 @@ _attempt = [] _loaddir = [] _textdoc = [] _drawdoc = [] +_failmsg = [] #------------------------------------------------------------------------- # @@ -184,6 +185,29 @@ class ToolPlugins: self.dialog.get_widget("pluginTitle").set_text(title) self.run_tool = obj.get_data(TASK) + +class PluginStatus: + def __init__(self): + import cStringIO + + self.glade = libglade.GladeXML(const.plugfile,"plugstat") + self.top = self.glade.get_widget("plugstat") + window = self.glade.get_widget("text") + + info = cStringIO.StringIO() + for (file,msgs) in _failmsg: + error = str(msgs[0]) + if error[0:11] == "exceptions.": + error = error[11:] + msg = msgs[1] + trc = msgs[2] + info.write("%s\n\t%s: %s\n\n" % (file,error,msg) ) + + info.seek(0) + window.show_string(info.read()) + self.top.run_and_close() + + #------------------------------------------------------------------------- # # build_tree @@ -276,7 +300,7 @@ def load_plugins(dir): a = __import__(plugin) _success.append(a) except: - print _("Note: %s support could not be loaded") % plugin + _failmsg.append((file,sys.exc_info())) #------------------------------------------------------------------------- # @@ -295,7 +319,7 @@ def reload_plugins(obj): try: reload(plugin) except: - print _("Note: failed to load the plugin module: %s") % plugin + _failmsg.append((file,sys.exc_info())) # attempt to load the plugins that have failed in the past @@ -303,7 +327,7 @@ def reload_plugins(obj): try: __import__(plugin) except: - print _("Note: failed to load the plugin module: %s") % plugin + _failmsg.append((file,sys.exc_info())) # attempt to load any new files found for dir in _loaddir: @@ -320,7 +344,7 @@ def reload_plugins(obj): a = __import__(plugin) _success.append(a) except: - print _("Note: failed to load the plugin module: %s") % plugin + _failmsg.append((file,sys.exc_info())) #------------------------------------------------------------------------- # diff --git a/gramps/src/const.py b/gramps/src/const.py index 151a37243..f9b3a6877 100644 --- a/gramps/src/const.py +++ b/gramps/src/const.py @@ -73,6 +73,7 @@ srcselFile = "%s/srcsel.glade" % rootDir findFile = "%s/find.glade" % rootDir mergeFile = "%s/mergedata.glade" % rootDir traceFile = "%s/trace.glade" % rootDir +plugfile = "%s/plugstat.glade" % rootDir pluginsDir = "%s/plugins" % rootDir docgenDir = "%s/docgen" % rootDir filtersDir = "%s/filters" % rootDir diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index 82860856f..341ed6f79 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -498,6 +498,19 @@ False + + GtkMenuItem + show_plugin_status + Shows the status of plugins that failed to load + + activate + on_show_plugin_status + Sun, 24 Feb 2002 15:33:38 GMT + + + False + + GtkPixmapMenuItem about1 diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 659e84f6b..84b780d78 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -274,6 +274,7 @@ class Gramps: "on_revert_activate" : self.on_revert_activate, "on_save_activate" : self.on_save_activate, "on_save_as_activate" : self.on_save_as_activate, + "on_show_plugin_status" : self.on_show_plugin_status, "on_source_list_button_press_event" : self.source_view.on_button_press_event, "on_sources_activate" : self.on_sources_activate, "on_spouselist_changed" : self.on_spouselist_changed, @@ -284,7 +285,10 @@ class Gramps: "on_gramps_mailing_lists_activate" : self.on_gramps_mailing_lists_activate, "on_writing_extensions_activate" : self.on_writing_extensions_activate, }) - + + def on_show_plugin_status(self,obj): + Plugins.PluginStatus() + def build_plugin_menus(self): export_menu = self.gtop.get_widget("export1") import_menu = self.gtop.get_widget("import1") diff --git a/gramps/src/plugstat.glade b/gramps/src/plugstat.glade new file mode 100644 index 000000000..af48f2710 --- /dev/null +++ b/gramps/src/plugstat.glade @@ -0,0 +1,82 @@ + + + + + Project1 + project1 + + src + pixmaps + C + True + True + + + + GnomeDialog + plugstat + Plugin Status - GRAMPS + GTK_WINDOW_DIALOG + GTK_WIN_POS_NONE + False + False + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox1 + 450 + 350 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button3 + True + True + GNOME_STOCK_BUTTON_CLOSE + + + + + GnomeLess + text + 450 + 350 + + 0 + True + True + + + + + +