* src/plugins/PatchNames.py: Convert to new API.
* src/plugins/RelCalc.py: Convert to new API. * src/plugins/ReorderIds.py: Convert to new API. * src/plugins/SoundGen.py: Convert to new API. * src/plugins/Rebuild.py: Convert to new API. svn: r5270
This commit is contained in:
parent
278b7751ba
commit
561716a398
@ -1,3 +1,10 @@
|
|||||||
|
2005-10-04 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/plugins/PatchNames.py: Convert to new API.
|
||||||
|
* src/plugins/RelCalc.py: Convert to new API.
|
||||||
|
* src/plugins/ReorderIds.py: Convert to new API.
|
||||||
|
* src/plugins/SoundGen.py: Convert to new API.
|
||||||
|
* src/plugins/Rebuild.py: Convert to new API.
|
||||||
|
|
||||||
2005-10-04 Don Allingham <don@gramps-project.org>
|
2005-10-04 Don Allingham <don@gramps-project.org>
|
||||||
* src/DateParser.py: handle non-matching dates as strings properly
|
* src/DateParser.py: handle non-matching dates as strings properly
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ from gnome import help_display
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import Utils
|
import Utils
|
||||||
|
import Tool
|
||||||
from QuestionDialog import OkDialog
|
from QuestionDialog import OkDialog
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -75,21 +76,16 @@ _sn_prefix_re = re.compile("^\s*(%s)\s+(.*)" % '|'.join(prefix_list),re.IGNORECA
|
|||||||
# to "Name" and add "Nickname" into the nickname field.
|
# to "Name" and add "Nickname" into the nickname field.
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def runTool(database,active_person,callback,parent=None):
|
|
||||||
try:
|
|
||||||
PatchNames(database,callback,parent)
|
|
||||||
except:
|
|
||||||
import DisplayTrace
|
|
||||||
DisplayTrace.DisplayTrace()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# PatchNames
|
# PatchNames
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class PatchNames:
|
class PatchNames(Tool.Tool):
|
||||||
|
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
||||||
|
Tool.Tool.__init__(self,db,person,options_class,name)
|
||||||
|
|
||||||
def __init__(self,db,callback,parent):
|
|
||||||
self.cb = callback
|
self.cb = callback
|
||||||
self.db = db
|
self.db = db
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
@ -336,12 +332,30 @@ class PatchNames:
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
class PatchNamesOptions(Tool.ToolOptions):
|
||||||
|
"""
|
||||||
|
Defines options and provides handling interface.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self,name,person_id=None):
|
||||||
|
Tool.ToolOptions.__init__(self,name,person_id)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
from PluginMgr import register_tool
|
from PluginMgr import register_tool
|
||||||
|
|
||||||
register_tool(
|
register_tool(
|
||||||
runTool,
|
name = 'patchnames',
|
||||||
_("Extract information from names"),
|
category = Tool.TOOL_DBPROC,
|
||||||
category=_("Database Processing"),
|
tool_class = PatchNames,
|
||||||
|
options_class = PatchNamesOptions,
|
||||||
|
modes = Tool.MODE_GUI,
|
||||||
|
translated_name = _("Extract information from names"),
|
||||||
|
author_name = "Donald N. Allingham",
|
||||||
|
author_email = "dallingham@users.sourceforge.net",
|
||||||
description=_("Searches the entire database and attempts to "
|
description=_("Searches the entire database and attempts to "
|
||||||
"extract titles, nicknames and surname prefixes "
|
"extract titles, nicknames and surname prefixes "
|
||||||
"that may be embedded in a person's given name field.")
|
"that may be embedded in a person's given name field.")
|
||||||
|
@ -47,6 +47,7 @@ import gtk.glade
|
|||||||
import RelLib
|
import RelLib
|
||||||
import Utils
|
import Utils
|
||||||
import const
|
import const
|
||||||
|
import Tool
|
||||||
from QuestionDialog import OkDialog
|
from QuestionDialog import OkDialog
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -54,40 +55,71 @@ from QuestionDialog import OkDialog
|
|||||||
# runTool
|
# runTool
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def runTool(database,active_person,callback,parent=None):
|
class Rebuild(Tool.Tool):
|
||||||
|
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
||||||
|
Tool.Tool.__init__(self,db,person,options_class,name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if database.readonly:
|
if db.readonly:
|
||||||
# TODO: split plugin in a check and repair part to support
|
# TODO: split plugin in a check and repair part to support
|
||||||
# checking of a read only database
|
# checking of a read only database
|
||||||
return
|
return
|
||||||
|
|
||||||
total = database.get_number_of_people() + database.get_number_of_families() + \
|
total = db.get_number_of_people() + \
|
||||||
database.get_number_of_places() + database.get_number_of_sources() + \
|
db.get_number_of_families() + \
|
||||||
database.get_number_of_media_objects()
|
db.get_number_of_places() + \
|
||||||
|
db.get_number_of_sources() + \
|
||||||
|
db.get_number_of_media_objects()
|
||||||
|
|
||||||
progress = Utils.ProgressMeter(_('Rebuilding Secondary Indices'))
|
db.disable_signals()
|
||||||
|
if parent:
|
||||||
|
progress = Utils.ProgressMeter(
|
||||||
|
_('Rebuilding Secondary Indices'))
|
||||||
progress.set_pass('',total)
|
progress.set_pass('',total)
|
||||||
database.disable_signals()
|
db.rebuild_secondary(progress.step)
|
||||||
database.rebuild_secondary(progress.step)
|
|
||||||
database.enable_signals()
|
|
||||||
progress.close()
|
progress.close()
|
||||||
OkDialog(_("Secondary indices rebuilt"),
|
OkDialog(_("Secondary indices rebuilt"),
|
||||||
_('All secondary indices have been rebuilt.'))
|
_('All secondary indices have been rebuilt.'))
|
||||||
|
else:
|
||||||
|
print "Rebuilding Secondary Indices..."
|
||||||
|
db.rebuild_secondary(self.empty)
|
||||||
|
print "All secondary indices have been rebuilt."
|
||||||
|
db.enable_signals()
|
||||||
except:
|
except:
|
||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
DisplayTrace.DisplayTrace()
|
DisplayTrace.DisplayTrace()
|
||||||
|
|
||||||
|
def empty(self):
|
||||||
|
pass
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
class RebuildOptions(Tool.ToolOptions):
|
||||||
|
"""
|
||||||
|
Defines options and provides handling interface.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self,name,person_id=None):
|
||||||
|
Tool.ToolOptions.__init__(self,name,person_id)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
from PluginMgr import register_tool
|
from PluginMgr import register_tool
|
||||||
|
|
||||||
register_tool(
|
register_tool(
|
||||||
runTool,
|
name = 'rebuild',
|
||||||
_("Rebuild secondary indices"),
|
category = Tool.TOOL_DBFIX,
|
||||||
category=_("Database Repair"),
|
tool_class = Rebuild,
|
||||||
|
options_class = RebuildOptions,
|
||||||
|
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
||||||
|
translated_name = _("Rebuild secondary indices"),
|
||||||
|
author_name = "Donald N. Allingham",
|
||||||
|
author_email = "dallingham@users.sourceforge.net",
|
||||||
description=_("Rebuilds secondary indices")
|
description=_("Rebuilds secondary indices")
|
||||||
)
|
)
|
||||||
|
@ -48,6 +48,7 @@ import NameDisplay
|
|||||||
import ListModel
|
import ListModel
|
||||||
import PluginMgr
|
import PluginMgr
|
||||||
import PeopleModel
|
import PeopleModel
|
||||||
|
import Tool
|
||||||
|
|
||||||
column_names = [
|
column_names = [
|
||||||
_('Name'),
|
_('Name'),
|
||||||
@ -67,24 +68,17 @@ column_names = [
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def runTool(database,person,callback,parent=None):
|
class RelCalc(Tool.Tool):
|
||||||
RelCalc(database,person,parent)
|
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
||||||
|
Tool.Tool.__init__(self,db,person,options_class,name)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class RelCalc:
|
|
||||||
"""
|
"""
|
||||||
Relationship calculator class.
|
Relationship calculator class.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,database,person,parent):
|
|
||||||
self.person = person
|
self.person = person
|
||||||
self.db = database
|
|
||||||
self.RelClass = PluginMgr.relationship_class
|
self.RelClass = PluginMgr.relationship_class
|
||||||
self.relationship = self.RelClass(database)
|
self.relationship = self.RelClass(self.db)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.win_key = self
|
self.win_key = self
|
||||||
|
|
||||||
@ -216,15 +210,32 @@ class RelCalc:
|
|||||||
|
|
||||||
text1.set_text("%s %s" % (rstr, commontext))
|
text1.set_text("%s %s" % (rstr, commontext))
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
class RelCalcOptions(Tool.ToolOptions):
|
||||||
|
"""
|
||||||
|
Defines options and provides handling interface.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self,name,person_id=None):
|
||||||
|
Tool.ToolOptions.__init__(self,name,person_id)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
PluginMgr.register_tool(
|
PluginMgr.register_tool(
|
||||||
runTool,
|
name = 'relcalc',
|
||||||
_("Relationship calculator"),
|
category = Tool.TOOL_UTILS,
|
||||||
category=_("Utilities"),
|
tool_class = RelCalc,
|
||||||
|
options_class = RelCalcOptions,
|
||||||
|
modes = Tool.MODE_GUI,
|
||||||
|
translated_name = _("Relationship calculator"),
|
||||||
|
author_name = "Donald N. Allingham",
|
||||||
|
author_email = "dallingham@users.sourceforge.net",
|
||||||
description=_("Calculates the relationship between two people")
|
description=_("Calculates the relationship between two people")
|
||||||
)
|
)
|
||||||
|
@ -40,64 +40,88 @@ from gettext import gettext as _
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import Utils
|
import Utils
|
||||||
import RelLib
|
import RelLib
|
||||||
|
import Tool
|
||||||
from QuestionDialog import WarningDialog
|
from QuestionDialog import WarningDialog
|
||||||
|
|
||||||
_findint = re.compile('^[^\d]*(\d+)[^\d]*')
|
_findint = re.compile('^[^\d]*(\d+)[^\d]*')
|
||||||
|
|
||||||
def runTool(db,active_person,callback,parent):
|
|
||||||
"""Changed person, family, object, source, and place ids"""
|
|
||||||
#FIXME -- Remove when the tool is back from the dead
|
|
||||||
#WarningDialog(_('Tool currently unavailable'),
|
|
||||||
# _('This tool has not yet been brought up to date '
|
|
||||||
# 'after transition to the database, sorry.'),parent.topWindow)
|
|
||||||
#return
|
|
||||||
|
|
||||||
#FIXME
|
|
||||||
try:
|
|
||||||
ReorderIds(db)
|
|
||||||
except:
|
|
||||||
import DisplayTrace
|
|
||||||
DisplayTrace.DisplayTrace()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Actual tool
|
# Actual tool
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class ReorderIds:
|
class ReorderIds(Tool.Tool):
|
||||||
|
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
||||||
def __init__(self,db):
|
Tool.Tool.__init__(self,db,person,options_class,name)
|
||||||
|
|
||||||
self.db = db
|
|
||||||
|
|
||||||
|
self.parent = parent
|
||||||
|
if parent:
|
||||||
self.progress = Utils.ProgressMeter(_('Reordering GRAMPS IDs'),'')
|
self.progress = Utils.ProgressMeter(_('Reordering GRAMPS IDs'),'')
|
||||||
|
else:
|
||||||
|
print "Reordering GRAMPS IDs..."
|
||||||
|
|
||||||
self.trans = db.transaction_begin()
|
self.trans = db.transaction_begin()
|
||||||
|
|
||||||
self.progress.set_pass(_('Reordering People IDs'),db.get_number_of_people())
|
if parent:
|
||||||
self.reorder(RelLib.Person, db.get_person_from_gramps_id, db.get_person_from_handle,
|
self.progress.set_pass(_('Reordering People IDs'),
|
||||||
db.find_next_person_gramps_id, db.get_person_cursor, db.commit_person,
|
db.get_number_of_people())
|
||||||
|
self.reorder(RelLib.Person,
|
||||||
|
db.get_person_from_gramps_id,
|
||||||
|
db.get_person_from_handle,
|
||||||
|
db.find_next_person_gramps_id,
|
||||||
|
db.get_person_cursor,
|
||||||
|
db.commit_person,
|
||||||
db.iprefix)
|
db.iprefix)
|
||||||
self.progress.set_pass(_('Reordering Family IDs'),db.get_number_of_families())
|
|
||||||
self.reorder(RelLib.Family,db.get_family_from_gramps_id, db.get_family_from_handle,
|
if parent:
|
||||||
db.find_next_family_gramps_id, db.get_family_cursor, db.commit_family,
|
self.progress.set_pass(_('Reordering Family IDs'),
|
||||||
|
db.get_number_of_families())
|
||||||
|
self.reorder(RelLib.Family,
|
||||||
|
db.get_family_from_gramps_id,
|
||||||
|
db.get_family_from_handle,
|
||||||
|
db.find_next_family_gramps_id,
|
||||||
|
db.get_family_cursor,
|
||||||
|
db.commit_family,
|
||||||
db.fprefix)
|
db.fprefix)
|
||||||
self.progress.set_pass(_('Reordering Media Object IDs'),db.get_number_of_media_objects())
|
if parent:
|
||||||
self.reorder(RelLib.MediaObject, db.get_object_from_gramps_id, db.get_object_from_handle,
|
self.progress.set_pass(_('Reordering Media Object IDs'),
|
||||||
db.find_next_object_gramps_id, db.get_media_cursor, db.commit_media_object,
|
db.get_number_of_media_objects())
|
||||||
|
self.reorder(RelLib.MediaObject,
|
||||||
|
db.get_object_from_gramps_id,
|
||||||
|
db.get_object_from_handle,
|
||||||
|
db.find_next_object_gramps_id,
|
||||||
|
db.get_media_cursor,
|
||||||
|
db.commit_media_object,
|
||||||
db.oprefix)
|
db.oprefix)
|
||||||
self.progress.set_pass(_('Reordering Source IDs'),db.get_number_of_sources())
|
if parent:
|
||||||
self.reorder(RelLib.Source, db.get_source_from_gramps_id, db.get_source_from_handle,
|
self.progress.set_pass(_('Reordering Source IDs'),
|
||||||
db.find_next_source_gramps_id, db.get_source_cursor, db.commit_source,
|
db.get_number_of_sources())
|
||||||
|
self.reorder(RelLib.Source,
|
||||||
|
db.get_source_from_gramps_id,
|
||||||
|
db.get_source_from_handle,
|
||||||
|
db.find_next_source_gramps_id,
|
||||||
|
db.get_source_cursor,
|
||||||
|
db.commit_source,
|
||||||
db.sprefix)
|
db.sprefix)
|
||||||
self.progress.set_pass(_('Reordering Place IDs'),db.get_number_of_places())
|
if parent:
|
||||||
self.reorder(RelLib.Place, db.get_place_from_gramps_id, db.get_place_from_handle,
|
self.progress.set_pass(_('Reordering Place IDs'),
|
||||||
db.find_next_place_gramps_id, db.get_place_cursor, db.commit_place,
|
db.get_number_of_places())
|
||||||
|
self.reorder(RelLib.Place,
|
||||||
|
db.get_place_from_gramps_id,
|
||||||
|
db.get_place_from_handle,
|
||||||
|
db.find_next_place_gramps_id,
|
||||||
|
db.get_place_cursor,
|
||||||
|
db.commit_place,
|
||||||
db.pprefix)
|
db.pprefix)
|
||||||
|
if parent:
|
||||||
self.progress.close()
|
self.progress.close()
|
||||||
|
else:
|
||||||
|
print "Done."
|
||||||
|
|
||||||
db.transaction_commit(self.trans,_("Reorder GRAMPS IDs"))
|
db.transaction_commit(self.trans,_("Reorder GRAMPS IDs"))
|
||||||
|
|
||||||
def reorder(self, class_type, find_from_id, find_from_handle, find_next_id, get_cursor, commit, prefix):
|
def reorder(self, class_type, find_from_id, find_from_handle,
|
||||||
|
find_next_id, get_cursor, commit, prefix):
|
||||||
dups = []
|
dups = []
|
||||||
newids = {}
|
newids = {}
|
||||||
key_list = []
|
key_list = []
|
||||||
@ -107,6 +131,7 @@ class ReorderIds:
|
|||||||
cursor = get_cursor()
|
cursor = get_cursor()
|
||||||
data = cursor.first()
|
data = cursor.first()
|
||||||
while data:
|
while data:
|
||||||
|
if self.parent:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
(handle,sdata) = data
|
(handle,sdata) = data
|
||||||
|
|
||||||
@ -144,13 +169,29 @@ class ReorderIds:
|
|||||||
# go through the duplicates, looking for the first availble
|
# go through the duplicates, looking for the first availble
|
||||||
# handle that matches the new scheme.
|
# handle that matches the new scheme.
|
||||||
|
|
||||||
self.progress.set_pass(_('Finding and assigning unused IDs'),len(dups))
|
if self.parent:
|
||||||
|
self.progress.set_pass(_('Finding and assigning unused IDs'),
|
||||||
|
len(dups))
|
||||||
for handle in dups:
|
for handle in dups:
|
||||||
|
if self.parent:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
obj = find_from_handle(handle)
|
obj = find_from_handle(handle)
|
||||||
obj.set_gramps_id(find_next_id())
|
obj.set_gramps_id(find_next_id())
|
||||||
commit(obj,self.trans)
|
commit(obj,self.trans)
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
class ReorderIdsOptions(Tool.ToolOptions):
|
||||||
|
"""
|
||||||
|
Defines options and provides handling interface.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self,name,person_id=None):
|
||||||
|
Tool.ToolOptions.__init__(self,name,person_id)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -159,8 +200,14 @@ class ReorderIds:
|
|||||||
from PluginMgr import register_tool
|
from PluginMgr import register_tool
|
||||||
|
|
||||||
register_tool(
|
register_tool(
|
||||||
runTool,
|
name = 'reorder_ids',
|
||||||
_("Reorder GRAMPS IDs"),
|
category = Tool.TOOL_DBPROC,
|
||||||
category=_("Database Processing"),
|
tool_class = ReorderIds,
|
||||||
description=_("Reorders the gramps IDs according to gramps' default rules.")
|
options_class = ReorderIdsOptions,
|
||||||
|
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
||||||
|
translated_name = _("Reorder GRAMPS IDs"),
|
||||||
|
author_name = "Donald N. Allingham",
|
||||||
|
author_email = "dallingham@users.sourceforge.net",
|
||||||
|
description=_("Reorders the gramps IDs "
|
||||||
|
"according to gramps' default rules.")
|
||||||
)
|
)
|
||||||
|
@ -47,21 +47,16 @@ from gnome import help_display
|
|||||||
import soundex
|
import soundex
|
||||||
import Utils
|
import Utils
|
||||||
import AutoComp
|
import AutoComp
|
||||||
|
import Tool
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def runTool(database,active_person,callback,parent=None):
|
class SoundGen(Tool.Tool):
|
||||||
SoundGen(database,active_person,parent)
|
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
||||||
|
Tool.Tool.__init__(self,db,person,options_class,name)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
class SoundGen:
|
|
||||||
def __init__(self,database,active_person,parent):
|
|
||||||
self.db = database
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
if self.parent.child_windows.has_key(self.__class__):
|
if self.parent.child_windows.has_key(self.__class__):
|
||||||
self.parent.child_windows[self.__class__].present(None)
|
self.parent.child_windows[self.__class__].present(None)
|
||||||
@ -101,8 +96,8 @@ class SoundGen:
|
|||||||
|
|
||||||
AutoComp.fill_combo(self.autocomp, names)
|
AutoComp.fill_combo(self.autocomp, names)
|
||||||
|
|
||||||
if active_person:
|
if person:
|
||||||
n = active_person.get_primary_name().get_surname()
|
n = person.get_primary_name().get_surname()
|
||||||
self.name.set_text(n)
|
self.name.set_text(n)
|
||||||
try:
|
try:
|
||||||
se_text = soundex.soundex(n)
|
se_text = soundex.soundex(n)
|
||||||
@ -147,6 +142,19 @@ class SoundGen:
|
|||||||
se_text = soundex.soundex('')
|
se_text = soundex.soundex('')
|
||||||
self.value.set_text(se_text)
|
self.value.set_text(se_text)
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
class SoundGenOptions(Tool.ToolOptions):
|
||||||
|
"""
|
||||||
|
Defines options and provides handling interface.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self,name,person_id=None):
|
||||||
|
Tool.ToolOptions.__init__(self,name,person_id)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -155,8 +163,13 @@ class SoundGen:
|
|||||||
from PluginMgr import register_tool
|
from PluginMgr import register_tool
|
||||||
|
|
||||||
register_tool(
|
register_tool(
|
||||||
runTool,
|
name = 'soundgen',
|
||||||
_("Generate SoundEx codes"),
|
category = Tool.TOOL_UTILS,
|
||||||
category=_("Utilities"),
|
tool_class = SoundGen,
|
||||||
|
options_class = SoundGenOptions,
|
||||||
|
modes = Tool.MODE_GUI,
|
||||||
|
translated_name = _("Generate SoundEx codes"),
|
||||||
|
author_name = "Donald N. Allingham",
|
||||||
|
author_email = "dallingham@users.sourceforge.net",
|
||||||
description=_("Generates SoundEx codes for names")
|
description=_("Generates SoundEx codes for names")
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user