* src/plugins/Check.py: Convert to new API.
svn: r5262
This commit is contained in:
parent
66922b94cc
commit
2eef51be37
@ -2,6 +2,7 @@
|
|||||||
* src/plugins/Verify.py: Convert to new API.
|
* src/plugins/Verify.py: Convert to new API.
|
||||||
* src/plugins/verify.glade: Use separate windows for errors and
|
* src/plugins/verify.glade: Use separate windows for errors and
|
||||||
warnings.
|
warnings.
|
||||||
|
* src/plugins/Check.py: Convert to new API.
|
||||||
|
|
||||||
2005-09-30 Alex Roitman <shura@gramps-project.org>
|
2005-09-30 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/docgen/KwordDoc.py: Remove unused latin_utf8 import.
|
* src/docgen/KwordDoc.py: Remove unused latin_utf8 import.
|
||||||
|
@ -48,6 +48,7 @@ import gtk.glade
|
|||||||
import RelLib
|
import RelLib
|
||||||
import Utils
|
import Utils
|
||||||
import const
|
import const
|
||||||
|
import Tool
|
||||||
from QuestionDialog import OkDialog, MissingMediaDialog
|
from QuestionDialog import OkDialog, MissingMediaDialog
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -55,46 +56,51 @@ from QuestionDialog import OkDialog, MissingMediaDialog
|
|||||||
# runTool
|
# runTool
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def runTool(database,active_person,callback,parent=None):
|
class Check(Tool.Tool):
|
||||||
|
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
||||||
|
Tool.Tool.__init__(self,db,person,options_class,name)
|
||||||
|
|
||||||
try:
|
# def runTool(database,active_person,callback,parent=None):
|
||||||
if database.readonly:
|
cli = int(parent == None)
|
||||||
# TODO: split plugin in a check and repair part to support
|
|
||||||
# checking of a read only database
|
|
||||||
return
|
|
||||||
|
|
||||||
trans = database.transaction_begin()
|
|
||||||
trans.set_batch(True)
|
|
||||||
database.disable_signals()
|
|
||||||
checker = CheckIntegrity(database,parent,trans)
|
|
||||||
checker.cleanup_missing_photos(0)
|
|
||||||
|
|
||||||
prev_total = -1
|
try:
|
||||||
total = 0
|
if db.readonly:
|
||||||
|
# TODO: split plugin in a check and repair part to support
|
||||||
|
# checking of a read only database
|
||||||
|
return
|
||||||
|
|
||||||
while prev_total != total:
|
trans = db.transaction_begin()
|
||||||
prev_total = total
|
trans.set_batch(True)
|
||||||
|
db.disable_signals()
|
||||||
|
checker = CheckIntegrity(db,parent,trans)
|
||||||
|
checker.cleanup_missing_photos(cli)
|
||||||
|
|
||||||
|
prev_total = -1
|
||||||
|
total = 0
|
||||||
|
|
||||||
|
while prev_total != total:
|
||||||
|
prev_total = total
|
||||||
|
|
||||||
checker.check_for_broken_family_links()
|
checker.check_for_broken_family_links()
|
||||||
checker.check_parent_relationships()
|
checker.check_parent_relationships()
|
||||||
checker.cleanup_empty_families(0)
|
checker.cleanup_empty_families(cli)
|
||||||
checker.cleanup_duplicate_spouses()
|
checker.cleanup_duplicate_spouses()
|
||||||
|
|
||||||
total = checker.family_errors()
|
total = checker.family_errors()
|
||||||
|
|
||||||
checker.check_events()
|
checker.check_events()
|
||||||
checker.check_place_references()
|
checker.check_place_references()
|
||||||
checker.check_source_references()
|
checker.check_source_references()
|
||||||
database.transaction_commit(trans, _("Check Integrity"))
|
db.transaction_commit(trans, _("Check Integrity"))
|
||||||
database.enable_signals()
|
db.enable_signals()
|
||||||
database.request_rebuild()
|
db.request_rebuild()
|
||||||
|
|
||||||
errs = checker.build_report(0)
|
errs = checker.build_report(cli)
|
||||||
if errs:
|
if errs:
|
||||||
Report(checker.text.getvalue(),parent)
|
Report(checker.text.getvalue(),parent)
|
||||||
except:
|
except:
|
||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
DisplayTrace.DisplayTrace()
|
DisplayTrace.DisplayTrace()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -843,6 +849,19 @@ class Report:
|
|||||||
def present_result(self,obj):
|
def present_result(self,obj):
|
||||||
self.window.present()
|
self.window.present()
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
class CheckOptions(Tool.ToolOptions):
|
||||||
|
"""
|
||||||
|
Defines options and provides handling interface.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self,name,person_id=None):
|
||||||
|
Tool.ToolOptions.__init__(self,name,person_id)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -851,8 +870,13 @@ class Report:
|
|||||||
from PluginMgr import register_tool
|
from PluginMgr import register_tool
|
||||||
|
|
||||||
register_tool(
|
register_tool(
|
||||||
runTool,
|
name = 'check',
|
||||||
_("Check and repair database"),
|
category = Tool.TOOL_DBFIX,
|
||||||
category=_("Database Repair"),
|
tool_class = Check,
|
||||||
|
options_class = CheckOptions,
|
||||||
|
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
||||||
|
translated_name = _("Check and repair database"),
|
||||||
|
author_name = "Donald N. Allingham",
|
||||||
|
author_email = "dallingham@users.sourceforge.net",
|
||||||
description=_("Checks the database for integrity problems, fixing the problems that it can")
|
description=_("Checks the database for integrity problems, fixing the problems that it can")
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user