2006-12-01 13:53:51 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
|
|
|
# Copyright (C) 2000-2006 Donald N. Allingham
|
2008-05-19 00:54:28 +05:30
|
|
|
# Copyright (C) 2008 Brian G. Matherly
|
2006-12-01 13:53:51 +05:30
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
# Written by Alex Roitman
|
|
|
|
|
|
|
|
"Rebuild reference map tables"
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
from gettext import gettext as _
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Set up logging
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
import logging
|
|
|
|
log = logging.getLogger(".RebuildRefMap")
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gtk modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2008-05-19 00:54:28 +05:30
|
|
|
from PluginUtils import Tool, PluginManager
|
2006-12-01 13:53:51 +05:30
|
|
|
from QuestionDialog import OkDialog
|
2006-12-01 21:56:34 +05:30
|
|
|
from BasicUtils import UpdateCallback
|
2006-12-01 13:53:51 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# runTool
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-12-01 21:56:34 +05:30
|
|
|
class RebuildRefMap(Tool.Tool,UpdateCallback):
|
2006-12-01 13:53:51 +05:30
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, options_class, name, callback=None):
|
|
|
|
|
|
|
|
Tool.Tool.__init__(self, dbstate, options_class, name)
|
|
|
|
|
|
|
|
if self.db.readonly:
|
|
|
|
return
|
|
|
|
|
|
|
|
self.db.disable_signals()
|
|
|
|
if uistate:
|
2006-12-01 21:56:34 +05:30
|
|
|
self.callback = uistate.pulse_progressbar
|
|
|
|
uistate.set_busy_cursor(1)
|
|
|
|
uistate.progress.show()
|
|
|
|
uistate.push_message(dbstate, _("Rebuilding reference maps..."))
|
|
|
|
else:
|
|
|
|
self.callback = None
|
|
|
|
print "Rebuilding reference maps..."
|
|
|
|
|
|
|
|
UpdateCallback.__init__(self,self.callback)
|
|
|
|
self.set_total(6)
|
|
|
|
self.db.reindex_reference_map(self.update)
|
|
|
|
self.reset()
|
|
|
|
|
|
|
|
if uistate:
|
|
|
|
uistate.set_busy_cursor(0)
|
|
|
|
uistate.progress.hide()
|
2006-12-01 13:53:51 +05:30
|
|
|
OkDialog(_("Reference maps rebuilt"),
|
|
|
|
_('All reference maps have been rebuilt.'))
|
|
|
|
else:
|
|
|
|
print "All reference maps have been rebuilt."
|
|
|
|
self.db.enable_signals()
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
class RebuildRefMapOptions(Tool.ToolOptions):
|
|
|
|
"""
|
|
|
|
Defines options and provides handling interface.
|
|
|
|
"""
|
|
|
|
|
2008-02-24 19:25:55 +05:30
|
|
|
def __init__(self, name,person_id=None):
|
|
|
|
Tool.ToolOptions.__init__(self, name,person_id)
|
2006-12-01 13:53:51 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2008-05-19 00:54:28 +05:30
|
|
|
pmgr = PluginManager.get_instance()
|
|
|
|
pmgr.register_tool(
|
2006-12-01 13:53:51 +05:30
|
|
|
name = 'rebuild_refmap',
|
|
|
|
category = Tool.TOOL_DBFIX,
|
|
|
|
tool_class = RebuildRefMap,
|
|
|
|
options_class = RebuildRefMapOptions,
|
|
|
|
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
2008-01-29 02:52:06 +05:30
|
|
|
translated_name = _("Rebuild Reference Maps"),
|
2008-03-02 04:17:48 +05:30
|
|
|
status= _("Stable"),
|
2006-12-01 13:53:51 +05:30
|
|
|
author_name = "Alex Roitman",
|
|
|
|
author_email = "shura@gramps-project.org",
|
2008-03-02 04:17:48 +05:30
|
|
|
description = _("Rebuilds reference maps")
|
2006-12-01 13:53:51 +05:30
|
|
|
)
|