From abfb1ec422a42bc8ef2f1889978a0ad85570b70a Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 27 Apr 2006 21:32:44 +0000 Subject: [PATCH] 2006-04-27 Alex Roitman * src/ViewManager.py (reports_clicked, tools_clicked): handle exception. * src/PluginUtils/_Plugins.py (PluginDialog.on_apply_clicked): Correctly call gui_tool, fix wm. svn: r6475 --- gramps2/ChangeLog | 6 ++++++ gramps2/src/PluginUtils/_Plugins.py | 25 ++++++++++++------------- gramps2/src/ViewManager.py | 12 +++++++++--- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 88bfe6e13..42970cca7 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,9 @@ +2006-04-27 Alex Roitman + * src/ViewManager.py (reports_clicked, tools_clicked): handle + exception. + * src/PluginUtils/_Plugins.py (PluginDialog.on_apply_clicked): + Correctly call gui_tool, fix wm. + 2006-04-27 Don Allingham * src/ViewManager.py: fix top on Config.set calls * data/gramps.schemas.in: remove toolbar, now unused diff --git a/gramps2/src/PluginUtils/_Plugins.py b/gramps2/src/PluginUtils/_Plugins.py index 9df6d8314..466beb395 100644 --- a/gramps2/src/PluginUtils/_Plugins.py +++ b/gramps2/src/PluginUtils/_Plugins.py @@ -83,8 +83,8 @@ class PluginDialog(ManagedWindow.ManagedWindow): """Displays the dialog box that allows the user to select the report that is desired.""" - def __init__(self,state, uistate, track, item_list,categories,msg,label=None, - button_label=None,tool_tip=None,content=REPORTS): + def __init__(self,state, uistate, track, item_list,categories,msg, + label=None,button_label=None,tool_tip=None,content=REPORTS): """Display the dialog box, and build up the list of available reports. This is used to build the selection tree on the left hand side of the dailog box.""" @@ -94,7 +94,7 @@ class PluginDialog(ManagedWindow.ManagedWindow): self.msg = msg self.content = content - ManagedWindow.ManagedWindow.__init__(self, uistate, [], None) + ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) self.state = state self.uistate = uistate @@ -102,14 +102,14 @@ class PluginDialog(ManagedWindow.ManagedWindow): self.dialog = gtk.glade.XML(const.plugins_glade,"report","gramps") self.dialog.signal_autoconnect({ "on_report_apply_clicked" : self.on_apply_clicked, - "destroy_passed_object" : self.close_window, + "destroy_passed_object" : self.close, }) self.tree = self.dialog.get_widget("tree") - self.window = self.dialog.get_widget("report") + window = self.dialog.get_widget("report") self.title = self.dialog.get_widget("title") - Utils.set_titles(self.window, self.title, msg ) + self.set_window(window, self.title, msg ) self.store = gtk.TreeStore(gobject.TYPE_STRING) self.selection = self.tree.get_selection() @@ -122,8 +122,6 @@ class PluginDialog(ManagedWindow.ManagedWindow): if label: self.description.set_text(label) self.status = self.dialog.get_widget("report_status") - - Utils.set_title_label(self.dialog,msg) self.author_name = self.dialog.get_widget("author_name") self.author_email = self.dialog.get_widget("author_email") @@ -144,10 +142,10 @@ class PluginDialog(ManagedWindow.ManagedWindow): self.item = None self.build_plugin_tree(item_list,categories) - self.window.show() + self.show() - def close_window(self, obj): - self.close() + def build_menu_names(self,obj): + return (self.msg,None) def on_apply_clicked(self,obj): """Execute the selected report""" @@ -157,9 +155,9 @@ class PluginDialog(ManagedWindow.ManagedWindow): _Report.report(self.state.db,self.state.active, item_class,options_class,title,name,category) else: - _Tool.gui_tool(self.state.db,self.state.active, + _Tool.gui_tool(self.state,self.uistate, item_class,options_class,title,name,category, - self.state.db.request_rebuild,self.parent) + self.state.db.request_rebuild) def on_node_selected(self,obj): """Updates the informational display on the right hand side of @@ -255,6 +253,7 @@ class ReportPlugins(PluginDialog): """Display the dialog box, and build up the list of available reports. This is used to build the selection tree on the left hand side of the dailog box.""" + PluginDialog.__init__( self, dbstate, diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index ee6b261ea..c4b2b9bd9 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -945,10 +945,16 @@ class ViewManager: self.bookmarks.edit() def reports_clicked(self, obj): - Plugins.ReportPlugins(self.state, self.uistate, []) + try: + Plugins.ReportPlugins(self.state, self.uistate, []) + except Errors.WindowActiveError: + pass def tools_clicked(self, obj): - Plugins.ToolPlugins(self.state, self.uistate, []) + try: + Plugins.ToolPlugins(self.state, self.uistate, []) + except Errors.WindowActiveError: + pass def scratchpad(self, obj): import ScratchPad @@ -1133,7 +1139,7 @@ class ViewManager: f.write('') f.write('') - return (unicode(f.getvalue()), actions) + return (f.getvalue(), actions) def by_menu_name(a, b): return cmp(a[2], b[2])