* 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:
Alex Roitman 2005-10-06 19:15:49 +00:00
parent 8cfdeab55c
commit 95c876e51d
4 changed files with 92 additions and 32 deletions

View File

@ -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> 2005-10-06 Stefan Bjork <skalman@acc.umu.se>
* src/plugins/rel_sv.py: Obviosly, level=1 to get_parents means * src/plugins/rel_sv.py: Obviosly, level=1 to get_parents means
parents, not level=0. parents, not level=0.

View File

@ -256,5 +256,5 @@ class TreeTips(gtk.Widget):
return x, y return x, y
if gtk.pygtk_version < (2.8.0): if gtk.pygtk_version < (2,8,0):
gobject.type_register(TreeTips) gobject.type_register(TreeTips)

View File

@ -24,6 +24,7 @@
import gtk import gtk
import ListModel import ListModel
import Tool
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ] _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): class DumpGenderStats(Tool.Tool):
stats_list = [] def __init__(self,db,person,options_class,name,callback=None,parent=None):
for name in database.genderStats.stats.keys(): Tool.Tool.__init__(self,db,person,options_class,name)
stats_list.append((name,)+database.genderStats.stats[name]+(_GENDER[database.genderStats.guess_gender(name)],))
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)
]
titles = [(_('Name'),1,100), (_('Male'),2,70),
(_('Female'),3,70), ('Unknown',4,70), (_('Guess'),5,70) ]
treeview = gtk.TreeView() treeview = gtk.TreeView()
model = ListModel.ListModel(treeview,titles) model = ListModel.ListModel(treeview,titles)
for entry in stats_list: for entry in stats_list:
model.add(entry,entry[0]) model.add(entry,entry[0])
w = gtk.Window() w = gtk.Window()
w.set_transient_for(parent.topWindow)
w.set_position(gtk.WIN_POS_MOUSE) w.set_position(gtk.WIN_POS_MOUSE)
w.set_default_size(400,300) w.set_default_size(400,300)
s = gtk.ScrolledWindow() s = gtk.ScrolledWindow()
s.add(treeview) s.add(treeview)
w.add(s) w.add(s)
w.show_all() 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 from PluginMgr import register_tool
register_tool( register_tool(
DumpGenderStatsPlugin, name = 'dgenstats',
_("Dumps gender statistics"), category = Tool.TOOL_DEBUG,
category=_("Debug"), tool_class = DumpGenderStats,
description=_("Will dump the statistics for the gender guessing from the first name.") 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.")
) )

View File

@ -48,10 +48,9 @@ from gnome import help_display
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import TreeTips import TreeTips
import Tool
from DdTargets import DdTargets from DdTargets import DdTargets
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# icons used in the object listing # icons used in the object listing
@ -891,8 +890,24 @@ def place_title(db,event):
# #
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def ScratchPad(database,person,callback,parent=None): class ScratchPad(Tool.Tool):
ScratchPadWindow(database,parent) 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 from PluginMgr import register_tool
register_tool( register_tool(
ScratchPad, name = 'scratchpad',
_("Scratch Pad"), category = Tool.TOOL_UTILS,
category=_("Utilities"), tool_class = ScratchPad,
description=_("The Scratch Pad provides a temporary note pad to store " options_class = ScratchPadOptions,
"objects for easy reuse.") modes = Tool.MODE_GUI,
translated_name = _("Scratch Pad"),
description=_("The Scratch Pad provides a temporary note pad "
"to store objects for easy reuse.")
) )