* src/TreeTips.py: Typo.
* src/plugins/ScratchPad.py: Convert to new API. * src/plugins/DumpGenderStats.py: Convert to new API. svn: r5279
This commit is contained in:
parent
8cfdeab55c
commit
95c876e51d
@ -1,3 +1,8 @@
|
||||
2005-10-06 Alex Roitman <shura@gramps-project.org>
|
||||
* src/TreeTips.py: Typo.
|
||||
* src/plugins/ScratchPad.py: Convert to new API.
|
||||
* src/plugins/DumpGenderStats.py: Convert to new API.
|
||||
|
||||
2005-10-06 Stefan Bjork <skalman@acc.umu.se>
|
||||
* src/plugins/rel_sv.py: Obviosly, level=1 to get_parents means
|
||||
parents, not level=0.
|
||||
|
@ -256,5 +256,5 @@ class TreeTips(gtk.Widget):
|
||||
return x, y
|
||||
|
||||
|
||||
if gtk.pygtk_version < (2.8.0):
|
||||
if gtk.pygtk_version < (2,8,0):
|
||||
gobject.type_register(TreeTips)
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
import gtk
|
||||
import ListModel
|
||||
import Tool
|
||||
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -31,24 +32,56 @@ _GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def DumpGenderStatsPlugin(database,active_person,callback,parent=None):
|
||||
stats_list = []
|
||||
for name in database.genderStats.stats.keys():
|
||||
stats_list.append((name,)+database.genderStats.stats[name]+(_GENDER[database.genderStats.guess_gender(name)],))
|
||||
class DumpGenderStats(Tool.Tool):
|
||||
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
||||
Tool.Tool.__init__(self,db,person,options_class,name)
|
||||
|
||||
titles = [(_('Name'),1,100), (_('Male'),2,70),
|
||||
(_('Female'),3,70), ('Unknown',4,70), (_('Guess'),5,70) ]
|
||||
treeview = gtk.TreeView()
|
||||
model = ListModel.ListModel(treeview,titles)
|
||||
for entry in stats_list:
|
||||
model.add(entry,entry[0])
|
||||
w = gtk.Window()
|
||||
w.set_position(gtk.WIN_POS_MOUSE)
|
||||
w.set_default_size(400,300)
|
||||
s=gtk.ScrolledWindow()
|
||||
s.add(treeview)
|
||||
w.add(s)
|
||||
w.show_all()
|
||||
stats_list = []
|
||||
|
||||
for name in db.genderStats.stats.keys():
|
||||
stats_list.append(
|
||||
(name,)
|
||||
+ db.genderStats.stats[name]
|
||||
+ (_GENDER[db.genderStats.guess_gender(name)],)
|
||||
)
|
||||
|
||||
if parent:
|
||||
titles = [
|
||||
(_('Name'),1,100), (_('Male'),2,70),
|
||||
(_('Female'),3,70), (_('Unknown'),4,70),
|
||||
(_('Guess'),5,70)
|
||||
]
|
||||
|
||||
treeview = gtk.TreeView()
|
||||
model = ListModel.ListModel(treeview,titles)
|
||||
for entry in stats_list:
|
||||
model.add(entry,entry[0])
|
||||
w = gtk.Window()
|
||||
w.set_transient_for(parent.topWindow)
|
||||
w.set_position(gtk.WIN_POS_MOUSE)
|
||||
w.set_default_size(400,300)
|
||||
s = gtk.ScrolledWindow()
|
||||
s.add(treeview)
|
||||
w.add(s)
|
||||
w.show_all()
|
||||
else:
|
||||
print "\t%s\t%s\t%s\t%s\t%s\n" % (
|
||||
'Name','Male','Female','Unknown','Guess')
|
||||
for entry in stats_list:
|
||||
print "\t%s\t%s\t%s\t%s\t%s" % entry
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class DumpGenderStatsOptions(Tool.ToolOptions):
|
||||
"""
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self,name,person_id=None):
|
||||
Tool.ToolOptions.__init__(self,name,person_id)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -58,8 +91,12 @@ def DumpGenderStatsPlugin(database,active_person,callback,parent=None):
|
||||
from PluginMgr import register_tool
|
||||
|
||||
register_tool(
|
||||
DumpGenderStatsPlugin,
|
||||
_("Dumps gender statistics"),
|
||||
category=_("Debug"),
|
||||
description=_("Will dump the statistics for the gender guessing from the first name.")
|
||||
name = 'dgenstats',
|
||||
category = Tool.TOOL_DEBUG,
|
||||
tool_class = DumpGenderStats,
|
||||
options_class = DumpGenderStatsOptions,
|
||||
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
||||
translated_name = _("Dumps gender statistics"),
|
||||
description = _("Will dump the statistics for the gender guessing "
|
||||
"from the first name.")
|
||||
)
|
||||
|
@ -48,10 +48,9 @@ from gnome import help_display
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import TreeTips
|
||||
|
||||
import Tool
|
||||
from DdTargets import DdTargets
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# icons used in the object listing
|
||||
@ -891,9 +890,25 @@ def place_title(db,event):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def ScratchPad(database,person,callback,parent=None):
|
||||
ScratchPadWindow(database,parent)
|
||||
|
||||
class ScratchPad(Tool.Tool):
|
||||
def __init__(self,db,person,options_class,name,callback=None,parent=None):
|
||||
Tool.Tool.__init__(self,db,person,options_class,name)
|
||||
|
||||
ScratchPadWindow(db,parent)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class ScratchPadOptions(Tool.ToolOptions):
|
||||
"""
|
||||
Defines options and provides handling interface.
|
||||
"""
|
||||
|
||||
def __init__(self,name,person_id=None):
|
||||
Tool.ToolOptions.__init__(self,name,person_id)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -902,9 +917,12 @@ def ScratchPad(database,person,callback,parent=None):
|
||||
from PluginMgr import register_tool
|
||||
|
||||
register_tool(
|
||||
ScratchPad,
|
||||
_("Scratch Pad"),
|
||||
category=_("Utilities"),
|
||||
description=_("The Scratch Pad provides a temporary note pad to store "
|
||||
"objects for easy reuse.")
|
||||
name = 'scratchpad',
|
||||
category = Tool.TOOL_UTILS,
|
||||
tool_class = ScratchPad,
|
||||
options_class = ScratchPadOptions,
|
||||
modes = Tool.MODE_GUI,
|
||||
translated_name = _("Scratch Pad"),
|
||||
description=_("The Scratch Pad provides a temporary note pad "
|
||||
"to store objects for easy reuse.")
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user