From bdf5731502c1962b027a77327c35b1d32ba5afff Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 26 Apr 2006 05:09:44 +0000 Subject: [PATCH] * src/plugins/PatchNames.py: Adapt to new wm. * src/PluginUtils/_Tool.py (gui_tool): handle exception. svn: r6449 --- ChangeLog | 2 ++ src/PluginUtils/_Tool.py | 3 +++ src/plugins/PatchNames.py | 23 ++++++++++------------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 222b521a4..1145826c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ 2006-04-25 Alex Roitman + * src/plugins/PatchNames.py: Adapt to new wm. + * src/PluginUtils/_Tool.py (gui_tool): handle exception. * src/plugins/EventCmp.py (DisplayChart.on_write_table): Use FileChooser dialog. * src/plugins/eventcmp.glade: remove unused dialog. diff --git a/src/PluginUtils/_Tool.py b/src/PluginUtils/_Tool.py index 7fd1b4058..5254704a8 100644 --- a/src/PluginUtils/_Tool.py +++ b/src/PluginUtils/_Tool.py @@ -44,6 +44,7 @@ import const import Utils import GenericFilter import NameDisplay +import Errors from _Options import * #------------------------------------------------------------------------- @@ -239,6 +240,8 @@ def gui_tool(dbstate, uistate, tool_class, options_class, translated_name, try: tool_class(dbstate, uistate, options_class, name, callback) + except Errors.WindowActiveError: + pass except: log.error("Failed to start tool.", exc_info=True) diff --git a/src/plugins/PatchNames.py b/src/plugins/PatchNames.py index 11b4bb297..891489e30 100644 --- a/src/plugins/PatchNames.py +++ b/src/plugins/PatchNames.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2005 Donald N. Allingham +# Copyright (C) 2000-2006 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ import GrampsDisplay #------------------------------------------------------------------------- import Utils import ManagedWindow - +import Errors from PluginUtils import Tool, register_tool from QuestionDialog import OkDialog @@ -91,7 +91,9 @@ class PatchNames(Tool.Tool, ManagedWindow.ManagedWindow): def __init__(self, dbstate, uistate, options_class, name, callback=None): Tool.Tool.__init__(self, dbstate, options_class, name) - ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) + self.label = _('Name and title extraction tool') + ManagedWindow.ManagedWindow.__init__(self, uistate, [], + self.__class__) self.cb = callback self.trans = self.db.transaction_begin() @@ -162,6 +164,9 @@ class PatchNames(Tool.Tool, ManagedWindow.ManagedWindow): OkDialog(_('No modifications made'), _("No titles or nicknames were found")) + def build_menu_names(self,obj): + return (self.label,None) + def toggled(self,cell,path_string): path = tuple([int (i) for i in path_string.split(':')]) row = self.model[path] @@ -174,16 +179,14 @@ class PatchNames(Tool.Tool, ManagedWindow.ManagedWindow): glade_file = base + os.sep + "patchnames.glade" self.top = gtk.glade.XML(glade_file,"top","gramps") - self.window = self.top.get_widget('top') + window = self.top.get_widget('top') self.top.signal_autoconnect({ "destroy_passed_object" : self.close, "on_ok_clicked" : self.on_ok_clicked, "on_help_clicked" : self.on_help_clicked, - "on_delete_event" : self.on_delete_event }) self.list = self.top.get_widget("list") - self.label = _('Name and title extraction tool') - Utils.set_titles(self.window,self.top.get_widget('title'),self.label) + self.set_window(window,self.top.get_widget('title'),self.label) self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, @@ -272,12 +275,6 @@ class PatchNames(Tool.Tool, ManagedWindow.ManagedWindow): """Display the relevant portion of GRAMPS manual""" GrampsDisplay.help('tools-db') - def on_delete_event(self,obj,b): - pass - - def close(self,obj): - self.window.destroy() - def on_ok_clicked(self,obj): for grp in self.nick_list: handle = self.nick_hash[grp[0]]