From a78ca88de88b8ca8a51d14947f73cfab8cf3fb35 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 21 Apr 2006 20:34:26 +0000 Subject: [PATCH] Fix warnboxes svn: r6401 --- ChangeLog | 5 +++ src/Editors/_EditMedia.py | 4 +- src/Editors/_EditSource.py | 4 +- src/PluginUtils/_PluginStatus.py | 64 +++++++++++++++++++++++++++----- 4 files changed, 61 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index f062398be..d1e57c562 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-21 Don Allingham + * src/Editors/_EditSource.py: remove warnbox + * src/Editors/_EditMedia.py: remove warnbox + * src/PluginUtils/_PluginStatus.py: add viewing of exceptions + 2006-04-21 Martin Hawlisch * src/DataViews/_PedigreeView.py: Set dirty flag to force redrawing when changing tree style diff --git a/src/Editors/_EditMedia.py b/src/Editors/_EditMedia.py index 1f1d89bad..d15fdf1ab 100644 --- a/src/Editors/_EditMedia.py +++ b/src/Editors/_EditMedia.py @@ -154,9 +154,7 @@ class EditMedia(EditPrimary): self.backref_list = self._add_tab( notebook, MediaBackRefList(self.dbstate,self.uistate,self.track, - self.db.find_backlink_handles(self.obj.handle), - self.enable_warnbox - )) + self.db.find_backlink_handles(self.obj.handle))) notebook.show_all() self.glade.get_widget('vbox').pack_start(notebook,True) diff --git a/src/Editors/_EditSource.py b/src/Editors/_EditSource.py index e188bca79..61c6c90c5 100644 --- a/src/Editors/_EditSource.py +++ b/src/Editors/_EditSource.py @@ -135,9 +135,7 @@ class EditSource(EditPrimary): self.backref_tab = self._add_tab( notebook, SourceBackRefList(self.dbstate, self.uistate, self.track, - self.db.find_backlink_handles(self.obj.handle), - self.enable_warnbox - )) + self.db.find_backlink_handles(self.obj.handle))) notebook.show_all() self.glade.get_widget('vbox').pack_start(notebook,True) diff --git a/src/PluginUtils/_PluginStatus.py b/src/PluginUtils/_PluginStatus.py index d7715a07e..9f1362ba5 100644 --- a/src/PluginUtils/_PluginStatus.py +++ b/src/PluginUtils/_PluginStatus.py @@ -26,6 +26,7 @@ # #------------------------------------------------------------------------- import gtk +import traceback #------------------------------------------------------------------------- # @@ -44,7 +45,7 @@ import _PluginMgr as PluginMgr class PluginStatus(ManagedWindow.ManagedWindow): """Displays a dialog showing the status of loaded plugins""" - def __init__(self,state,uistate,track=[]): + def __init__(self, state, uistate, track=[]): self.title = _("Plugin Status") ManagedWindow.ManagedWindow.__init__(self, uistate, track, self) @@ -58,12 +59,16 @@ class PluginStatus(ManagedWindow.ManagedWindow): ) self.window.set_size_request(600,400) self.window.connect('delete-event',self.close) - + self.window.connect('response', self.close) + scrolled_window = gtk.ScrolledWindow() self.list = gtk.TreeView() - self.model = gtk.ListStore(str, str, str) + self.model = gtk.ListStore(str, str, str, object) + self.selection = self.list.get_selection() + self.list.set_model(self.model) - + self.list.set_rules_hint(True) + self.list.connect('button-press-event', self.button_press) self.list.append_column( gtk.TreeViewColumn(_('Status'), gtk.CellRendererText(), markup=0)) @@ -81,22 +86,61 @@ class PluginStatus(ManagedWindow.ManagedWindow): for i in PluginMgr.failmsg_list: err = i[1][0] + if err == Errors.UnavailableError: self.model.append(row=[ '%s' % _('Unavailable'), - i[0], str(i[1][1])]) + i[0], str(i[1][1]), None]) else: self.model.append(row=[ '%s' % _('Fail'), - i[0], str(i[1][1])]) + i[0], str(i[1][1]), i[1]]) for i in PluginMgr.success_list: self.model.append(row=[ '%s' % _("OK"), - i[0], '']) + i[0], '', None]) - self.window.run() - self.window.destroy() + + def button_press(self, obj, event): + if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: + model, node = self.selection.get_selected() + data = model.get_value(node, 3) + if data: + PluginTrace(self.uistate, self.track, data) + + def build_menu_names(self,obj): + return (self.title, _('Tracebacks')) + +class PluginTrace(ManagedWindow.ManagedWindow): + """Displays a dialog showing the status of loaded plugins""" + + def __init__(self, uistate, track, data): + + self.title = _("Plugin Status Details") + print uistate, track, data + ManagedWindow.ManagedWindow.__init__(self, uistate, track, self) + + self.set_window( + gtk.Dialog("%s - GRAMPS" % self.title, + uistate.window, + gtk.DIALOG_DESTROY_WITH_PARENT, + (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) + ) + ) + self.window.set_size_request(600,400) + self.window.connect('delete-event',self.close) + self.window.connect('response', self.close) + + scrolled_window = gtk.ScrolledWindow() + self.text = gtk.TextView() + scrolled_window.add(self.text) + self.text.get_buffer().set_text( + "".join(traceback.format_exception(data[0],data[1],data[2]))) + + self.window.vbox.add(scrolled_window) + self.window.show_all() def build_menu_names(self,obj): - return (self.title,None) + return (self.title, None) +