* src/plugins/ChangeNames.py: Convert to the new scheme.
svn: r5235
This commit is contained in:
parent
e93db84c8a
commit
c3af4c65a0
@ -1,3 +1,6 @@
|
|||||||
|
2005-09-26 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/plugins/ChangeNames.py: Convert to the new scheme.
|
||||||
|
|
||||||
2005-09-24 Don Allingham <don@gramps-project.org>
|
2005-09-24 Don Allingham <don@gramps-project.org>
|
||||||
* src/data/tips.xml: removed the tip mentioning column sorting
|
* src/data/tips.xml: removed the tip mentioning column sorting
|
||||||
in people view.
|
in people view.
|
||||||
|
@ -46,47 +46,36 @@ from gnome import help_display
|
|||||||
# gramps modules
|
# gramps modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
import const
|
||||||
import Utils
|
import Utils
|
||||||
from QuestionDialog import OkDialog
|
from QuestionDialog import OkDialog
|
||||||
|
import Tool
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# Search each name in the database, and compare the firstname against the
|
|
||||||
# form of "Name (Nickname)". If it matches, change the first name entry
|
|
||||||
# to "Name" and add "Nickname" into the nickname field.
|
|
||||||
#
|
|
||||||
#-------------------------------------------------------------------------
|
|
||||||
def runTool(database,active_person,callback,parent=None):
|
|
||||||
try:
|
|
||||||
ChangeNames(database,callback,parent)
|
|
||||||
except:
|
|
||||||
import DisplayTrace
|
|
||||||
DisplayTrace.DisplayTrace()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# ChangeNames
|
# ChangeNames
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class ChangeNames:
|
class ChangeNames(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.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)
|
||||||
return
|
return
|
||||||
self.win_key = self.__class__
|
self.win_key = self.__class__
|
||||||
self.name_list = []
|
|
||||||
self.progress = Utils.ProgressMeter(_('Checking family names'),'')
|
self.progress = Utils.ProgressMeter(_('Checking family names'),'')
|
||||||
|
|
||||||
|
|
||||||
self.progress.set_pass(_('Searching family names'),
|
self.progress.set_pass(_('Searching family names'),
|
||||||
len(self.db.get_surname_list()))
|
len(self.db.get_surname_list()))
|
||||||
|
self.name_list = []
|
||||||
for name in self.db.get_surname_list():
|
for name in self.db.get_surname_list():
|
||||||
if name != name.capitalize():
|
if name != name.capitalize():
|
||||||
self.name_list.append(name)
|
self.name_list.append(name)
|
||||||
|
if self.parent:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
|
|
||||||
if self.name_list:
|
if self.name_list:
|
||||||
@ -199,6 +188,19 @@ class ChangeNames:
|
|||||||
self.close(obj)
|
self.close(obj)
|
||||||
self.cb(None,1)
|
self.cb(None,1)
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
class ChangeNamesOptions(Tool.ToolOptions):
|
||||||
|
"""
|
||||||
|
Defines options and provides handling interface.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self,name,person_id=None):
|
||||||
|
Tool.ToolOptions.__init__(self,name,person_id)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -207,9 +209,15 @@ class ChangeNames:
|
|||||||
from PluginMgr import register_tool
|
from PluginMgr import register_tool
|
||||||
|
|
||||||
register_tool(
|
register_tool(
|
||||||
runTool,
|
name = 'chname',
|
||||||
_("Fix capitalization of family names"),
|
category = const.TOOL_DBPROC,
|
||||||
category=_("Database Processing"),
|
tool_class = ChangeNames,
|
||||||
|
options_class = ChangeNamesOptions,
|
||||||
|
modes = Tool.MODE_GUI,
|
||||||
|
translated_name = _("Fix capitalization of family names"),
|
||||||
|
status = _("Beta"),
|
||||||
|
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 "
|
||||||
"fix capitalization of the names.")
|
"fix capitalization of the names.")
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user