From 720b43b977de8e406727a50b2ee874d236048f2c Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sat, 28 Feb 2004 03:51:59 +0000 Subject: [PATCH] More windows svn: r2919 --- gramps2/src/Plugins.py | 48 +++++++++++++++++++++++++++----------- gramps2/src/gramps_main.py | 4 ++-- gramps2/src/plugins.glade | 1 + 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/gramps2/src/Plugins.py b/gramps2/src/Plugins.py index 1038cbb6e..b3ef8da5b 100644 --- a/gramps2/src/Plugins.py +++ b/gramps2/src/Plugins.py @@ -116,21 +116,26 @@ class PluginDialog: """Displays the dialog box that allows the user to select the report that is desired.""" - def __init__(self,db,active,list,msg,label=None,button_label=None,tool_tip=None): + def __init__(self,parent,db,active,list,msg,label=None,button_label=None,tool_tip=None): """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.""" + self.parent = parent + if self.parent.child_windows.has_key(msg): + self.parent.child_windows[msg].present(None) + return self.db = db self.active = active self.update = None self.imap = {} + self.msg = msg self.dialog = gtk.glade.XML(const.pluginsFile,"report","gramps") self.dialog.signal_autoconnect({ "on_report_apply_clicked" : self.on_apply_clicked, - "on_report_ok_clicked" : self.on_ok_clicked, - "destroy_passed_object" : Utils.destroy_passed_object + "destroy_passed_object" : self.close, + "on_delete_event" : self.on_delete_event, }) self.tree = self.dialog.get_widget("tree") @@ -174,6 +179,29 @@ class PluginDialog: self.run_tool = None self.build_tree(list) + self.add_itself_to_menu() + self.top.show() + + def on_delete_event(self,obj,b): + self.remove_itself_from_menu() + + def close(self,ok=0): + self.remove_itself_from_menu() + self.top.destroy() + + def add_itself_to_menu(self): + self.parent.child_windows[self.msg] = self + self.win_menu_item = gtk.MenuItem(self.msg) + self.win_menu_item.connect("activate",self.present) + self.win_menu_item.show() + self.parent.winsmenu.append(self.win_menu_item) + + def remove_itself_from_menu(self): + del self.parent.child_windows[self.msg] + self.win_menu_item.destroy() + + def present(self,obj): + self.top.present() def on_apply_clicked(self,obj): """Execute the selected report""" @@ -184,12 +212,6 @@ class PluginDialog: else: self.run_tool(self.db,self.active) - def on_ok_clicked(self,obj): - """Execute the selected report and close the dialog window""" - - Utils.destroy_passed_object(obj) - self.on_apply_clicked(obj) - def on_node_selected(self,obj): """Updates the informational display on the right hand side of the dialog box with the description of the selected report""" @@ -271,11 +293,11 @@ class ReportPlugins(PluginDialog): """Displays the dialog box that allows the user to select the report that is desired.""" - def __init__(self,db,active): + def __init__(self,parent,db,active): """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,db,active,_reports,_("Report Selection"), + PluginDialog.__init__(self,parent,db,active,_reports,_("Report Selection"), _("Select a report from those available on the left."), _("_Generate"), _("Generate selected report")) @@ -288,12 +310,12 @@ class ToolPlugins(PluginDialog): """Displays the dialog box that allows the user to select the tool that is desired.""" - def __init__(self,db,active,update): + def __init__(self,parent,db,active,update): """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,db,active,_tools,_("Tool Selection"), + PluginDialog.__init__(self,parent,db,active,_tools,_("Tool Selection"), _("Select a tool from those available on the left."), _("_Run"), _("Run selected tool")) self.update = update diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index ee4d65c9c..16e567b53 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -961,12 +961,12 @@ class Gramps: def on_tools_clicked(self,obj): if self.active_person: - Plugins.ToolPlugins(self.db,self.active_person, + Plugins.ToolPlugins(self,self.db,self.active_person, self.tool_callback) def on_reports_clicked(self,obj): if self.active_person: - Plugins.ReportPlugins(self.db,self.active_person) + Plugins.ReportPlugins(self,self.db,self.active_person) def on_ok_button1_clicked(self,obj): diff --git a/gramps2/src/plugins.glade b/gramps2/src/plugins.glade index 2515bc5f1..48144d79b 100644 --- a/gramps2/src/plugins.glade +++ b/gramps2/src/plugins.glade @@ -97,6 +97,7 @@ True False gramps.png +