* src/plugins/PatchNames.py: Adapt to new wm.

* src/PluginUtils/_Tool.py (gui_tool): handle exception.


svn: r6449
This commit is contained in:
Alex Roitman 2006-04-26 05:09:44 +00:00
parent 15d24114c0
commit 4340fa7bd7
3 changed files with 15 additions and 13 deletions

View File

@ -1,4 +1,6 @@
2006-04-25 Alex Roitman <shura@gramps-project.org> 2006-04-25 Alex Roitman <shura@gramps-project.org>
* 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 * src/plugins/EventCmp.py (DisplayChart.on_write_table): Use
FileChooser dialog. FileChooser dialog.
* src/plugins/eventcmp.glade: remove unused dialog. * src/plugins/eventcmp.glade: remove unused dialog.

View File

@ -44,6 +44,7 @@ import const
import Utils import Utils
import GenericFilter import GenericFilter
import NameDisplay import NameDisplay
import Errors
from _Options import * from _Options import *
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -239,6 +240,8 @@ def gui_tool(dbstate, uistate, tool_class, options_class, translated_name,
try: try:
tool_class(dbstate, uistate, options_class, name, callback) tool_class(dbstate, uistate, options_class, name, callback)
except Errors.WindowActiveError:
pass
except: except:
log.error("Failed to start tool.", exc_info=True) log.error("Failed to start tool.", exc_info=True)

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # 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 # 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 # it under the terms of the GNU General Public License as published by
@ -48,7 +48,7 @@ import GrampsDisplay
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import Utils import Utils
import ManagedWindow import ManagedWindow
import Errors
from PluginUtils import Tool, register_tool from PluginUtils import Tool, register_tool
from QuestionDialog import OkDialog from QuestionDialog import OkDialog
@ -91,7 +91,9 @@ class PatchNames(Tool.Tool, ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, options_class, name, callback=None): def __init__(self, dbstate, uistate, options_class, name, callback=None):
Tool.Tool.__init__(self, dbstate, options_class, name) 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.cb = callback
self.trans = self.db.transaction_begin() self.trans = self.db.transaction_begin()
@ -162,6 +164,9 @@ class PatchNames(Tool.Tool, ManagedWindow.ManagedWindow):
OkDialog(_('No modifications made'), OkDialog(_('No modifications made'),
_("No titles or nicknames were found")) _("No titles or nicknames were found"))
def build_menu_names(self,obj):
return (self.label,None)
def toggled(self,cell,path_string): def toggled(self,cell,path_string):
path = tuple([int (i) for i in path_string.split(':')]) path = tuple([int (i) for i in path_string.split(':')])
row = self.model[path] row = self.model[path]
@ -174,16 +179,14 @@ class PatchNames(Tool.Tool, ManagedWindow.ManagedWindow):
glade_file = base + os.sep + "patchnames.glade" glade_file = base + os.sep + "patchnames.glade"
self.top = gtk.glade.XML(glade_file,"top","gramps") 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({ self.top.signal_autoconnect({
"destroy_passed_object" : self.close, "destroy_passed_object" : self.close,
"on_ok_clicked" : self.on_ok_clicked, "on_ok_clicked" : self.on_ok_clicked,
"on_help_clicked" : self.on_help_clicked, "on_help_clicked" : self.on_help_clicked,
"on_delete_event" : self.on_delete_event
}) })
self.list = self.top.get_widget("list") self.list = self.top.get_widget("list")
self.label = _('Name and title extraction tool') self.set_window(window,self.top.get_widget('title'),self.label)
Utils.set_titles(self.window,self.top.get_widget('title'),self.label)
self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING,
gobject.TYPE_STRING, 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""" """Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('tools-db') 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): def on_ok_clicked(self,obj):
for grp in self.nick_list: for grp in self.nick_list:
handle = self.nick_hash[grp[0]] handle = self.nick_hash[grp[0]]