From dfb71b6cd2153382e6b94757488d5d4103e064bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Charette?= Date: Sun, 22 Feb 2009 20:24:08 +0000 Subject: [PATCH] =?UTF-8?q?fix=20bug=20#2709,=20merged=20from=20gramps31?= =?UTF-8?q?=20(thanks=20J=C3=A9r=C3=B4me=20for=20the=20patch)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn: r12080 --- src/plugins/tool/NotRelated.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/tool/NotRelated.py b/src/plugins/tool/NotRelated.py index 7aa50f55e..29638516e 100644 --- a/src/plugins/tool/NotRelated.py +++ b/src/plugins/tool/NotRelated.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2007 Stephane Charette +# Copyright (C) 2007-2009 Stephane Charette # Copyright (C) 2008 Brian Matherly # # This program is free software; you can redistribute it and/or modify @@ -46,6 +46,7 @@ import gobject from PluginUtils import Tool from gen.plug import PluginManager from ReportBase import ReportUtils +from PluginUtils import Tool from Editors import EditPerson, EditFamily import ManagedWindow import Utils @@ -65,10 +66,14 @@ WIKI_HELP_SEC = _('manual|Not_Related...') # # #------------------------------------------------------------------------ -class NotRelated(Tool.Tool, ManagedWindow.ManagedWindow) : +class NotRelated(Tool.ActivePersonTool, ManagedWindow.ManagedWindow) : def __init__(self, dbstate, uistate, options_class, name, callback=None): - Tool.Tool.__init__(self, dbstate, options_class, name) + Tool.ActivePersonTool.__init__(self, dbstate, options_class, name) + + if self.fail: # bug #2709 -- fail if we have no active person + return + person = dbstate.get_active_person() self.name = person.get_primary_name().get_regular_name() self.title = _('Not related to "%s"') % self.name @@ -212,7 +217,7 @@ class NotRelated(Tool.Tool, ManagedWindow.ManagedWindow) : EditPerson(self.dbstate, self.uistate, [], person) except Errors.WindowActiveError: pass -# + def on_help_clicked(self, obj): """Display the relevant portion of GRAMPS manual""" GrampsDisplay.help(WIKI_HELP_PAGE , WIKI_HELP_SEC)