Convert the "Not Related" plugin from a "view report" to a "tool" (although it would really make a great gramplet).
svn: r10423
This commit is contained in:
parent
e08a8cf205
commit
9988d5ecfa
@ -1,7 +1,8 @@
|
|||||||
#
|
#
|
||||||
# NotRelated.py - Plugin for Gramps
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Stephane Charette
|
# Copyright (C) 2007 Stephane Charette
|
||||||
|
# Copyright (C) 2008 Brian Matherly
|
||||||
#
|
#
|
||||||
# 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
|
||||||
@ -42,10 +43,9 @@ import gobject
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from PluginUtils import register_report
|
from PluginUtils import register_tool, Tool
|
||||||
from ReportBase import ReportUtils, CATEGORY_VIEW, MODE_GUI
|
from ReportBase import ReportUtils
|
||||||
from Editors import EditPerson, EditFamily
|
from Editors import EditPerson, EditFamily
|
||||||
from QuestionDialog import WarningDialog
|
|
||||||
import ManagedWindow
|
import ManagedWindow
|
||||||
import Utils
|
import Utils
|
||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
@ -64,9 +64,10 @@ WIKI_HELP_SEC = _('manual|Not_Related...')
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class NotRelated(ManagedWindow.ManagedWindow) :
|
class NotRelated(Tool.Tool, ManagedWindow.ManagedWindow) :
|
||||||
|
|
||||||
def __init__(self, dbstate, uistate) :
|
def __init__(self, dbstate, uistate, options_class, name, callback=None):
|
||||||
|
Tool.Tool.__init__(self, dbstate, options_class, name)
|
||||||
person = dbstate.get_active_person()
|
person = dbstate.get_active_person()
|
||||||
self.name = person.get_primary_name().get_regular_name()
|
self.name = person.get_primary_name().get_regular_name()
|
||||||
self.title = _('Not related to "%s"') % self.name
|
self.title = _('Not related to "%s"') % self.name
|
||||||
@ -406,18 +407,31 @@ class NotRelated(ManagedWindow.ManagedWindow) :
|
|||||||
|
|
||||||
def build_menu_names(self, obj):
|
def build_menu_names(self, obj):
|
||||||
return (self.title, None)
|
return (self.title, None)
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# NotRelatedOptions
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
class NotRelatedOptions(Tool.ToolOptions):
|
||||||
|
"""
|
||||||
|
Defines options and provides handling interface.
|
||||||
|
"""
|
||||||
|
def __init__(self, name, person_id=None):
|
||||||
|
""" Initialize the options class """
|
||||||
|
Tool.ToolOptions.__init__(self, name, person_id)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
register_report(
|
register_tool(
|
||||||
name = 'not_related',
|
name = 'not_related',
|
||||||
category = CATEGORY_VIEW,
|
category = Tool.TOOL_UTILS,
|
||||||
report_class = NotRelated,
|
tool_class = NotRelated,
|
||||||
options_class = None,
|
options_class = NotRelatedOptions,
|
||||||
modes = MODE_GUI,
|
modes = Tool.MODE_GUI,
|
||||||
translated_name = _("Not Related"),
|
translated_name = _("Not Related"),
|
||||||
status = _("Stable"),
|
status = _("Stable"),
|
||||||
author_name = "Stephane Charette",
|
author_name = "Stephane Charette",
|
||||||
|
Loading…
Reference in New Issue
Block a user