Plugin information is stored for display later instead of being

dumped to the terminal window


svn: r797
This commit is contained in:
Don Allingham 2002-02-24 15:50:42 +00:00
parent e78176cb80
commit e310468f60
5 changed files with 129 additions and 5 deletions

View File

@ -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()))
#-------------------------------------------------------------------------
#

View File

@ -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

View File

@ -498,6 +498,19 @@
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>show_plugin_status</name>
<tooltip>Shows the status of plugins that failed to load</tooltip>
<signal>
<name>activate</name>
<handler>on_show_plugin_status</handler>
<last_modification_time>Sun, 24 Feb 2002 15:33:38 GMT</last_modification_time>
</signal>
<label>_Show Plugin Status</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkPixmapMenuItem</class>
<name>about1</name>

View File

@ -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")

82
gramps/src/plugstat.glade Normal file
View File

@ -0,0 +1,82 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>Project1</name>
<program_name>project1</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
</project>
<widget>
<class>GnomeDialog</class>
<name>plugstat</name>
<title>Plugin Status - GRAMPS</title>
<type>GTK_WINDOW_DIALOG</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox1</name>
<width>450</width>
<height>350</height>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area1</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button3</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
</widget>
</widget>
<widget>
<class>GnomeLess</class>
<name>text</name>
<width>450</width>
<height>350</height>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
</widget>
</widget>
</GTK-Interface>