diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index e5ce13f39..3febf461a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -3,6 +3,9 @@ * src/plugins/verify.glade: Use separate windows for errors and warnings. * src/plugins/Check.py: Convert to new API. + * src/plugins/DesGraph.py: Use correct constant. + * src/plugins/Eval.py: Convert to new API. + * src/plugins/Leak.py: Convert to new API. 2005-09-30 Alex Roitman * src/docgen/KwordDoc.py: Remove unused latin_utf8 import. diff --git a/gramps2/src/plugins/DesGraph.py b/gramps2/src/plugins/DesGraph.py index 71e7726dd..ecf1110ab 100644 --- a/gramps2/src/plugins/DesGraph.py +++ b/gramps2/src/plugins/DesGraph.py @@ -46,7 +46,6 @@ import Report import BaseDoc from SubstKeywords import SubstKeywords from ReportUtils import pt2cm -import const import ReportOptions #------------------------------------------------------------------------ @@ -341,7 +340,7 @@ class DescendantGraphOptions(ReportOptions.ReportOptions): from PluginMgr import register_report register_report( name = 'descendant_graph', - category = const.CATEGORY_DRAW, + category = Report.CATEGORY_DRAW, report_class = DescendantGraph, options_class = DescendantGraphOptions, modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI, diff --git a/gramps2/src/plugins/Eval.py b/gramps2/src/plugins/Eval.py index 58dbb6975..498509f3a 100644 --- a/gramps2/src/plugins/Eval.py +++ b/gramps2/src/plugins/Eval.py @@ -47,15 +47,17 @@ import gtk.glade # #------------------------------------------------------------------------ import Utils +import Tool #------------------------------------------------------------------------- # # Actual tool # #------------------------------------------------------------------------- -class EvalWindow: +class Eval(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,parent): self.parent = parent if self.parent.child_windows.has_key(self.__class__): self.parent.child_windows[self.__class__].present(None) @@ -124,6 +126,19 @@ class EvalWindow: self.ebuf.set_text("") self.error.set_text("") +#------------------------------------------------------------------------ +# +# +# +#------------------------------------------------------------------------ +class EvalOptions(Tool.ToolOptions): + """ + Defines options and provides handling interface. + """ + + def __init__(self,name,person_id=None): + Tool.ToolOptions.__init__(self,name,person_id) + #------------------------------------------------------------------------ # # @@ -131,12 +146,14 @@ class EvalWindow: #------------------------------------------------------------------------ from PluginMgr import register_tool -def runtool(database,person,callback,parent): - EvalWindow(parent) - register_tool( - runtool, - _("Python evaluation window"), - category=_("Debug"), + name = 'eval', + category = Tool.TOOL_DEBUG, + tool_class = Eval, + options_class = EvalOptions, + modes = Tool.MODE_GUI, + translated_name = _("Python evaluation window"), + author_name = "Donald N. Allingham", + author_email = "dallingham@users.sourceforge.net", description=_("Provides a window that can evaluate python code") ) diff --git a/gramps2/src/plugins/Leak.py b/gramps2/src/plugins/Leak.py index 7040c3039..040e0a9c3 100644 --- a/gramps2/src/plugins/Leak.py +++ b/gramps2/src/plugins/Leak.py @@ -47,15 +47,17 @@ import gc # #------------------------------------------------------------------------ import Utils +import Tool #------------------------------------------------------------------------- # # Actual tool # #------------------------------------------------------------------------- -class Leak: +class Leak(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,parent): self.parent = parent if self.parent.child_windows.has_key(self.__class__): self.parent.child_windows[self.__class__].present(None) @@ -120,6 +122,19 @@ class Leak: def apply_clicked(self,obj): self.display() +#------------------------------------------------------------------------ +# +# +# +#------------------------------------------------------------------------ +class LeakOptions(Tool.ToolOptions): + """ + Defines options and provides handling interface. + """ + + def __init__(self,name,person_id=None): + Tool.ToolOptions.__init__(self,name,person_id) + #------------------------------------------------------------------------ # # @@ -127,12 +142,14 @@ class Leak: #------------------------------------------------------------------------ from PluginMgr import register_tool -def runtool(database,person,callback,parent=None): - Leak(parent) - register_tool( - runtool, - _("Show uncollected objects"), - category=_("Debug"), + name = 'eval', + category = Tool.TOOL_DEBUG, + tool_class = Leak, + options_class = LeakOptions, + modes = Tool.MODE_GUI, + translated_name = _("Show uncollected objects"), + author_name = "Donald N. Allingham", + author_email = "dallingham@users.sourceforge.net", description=_("Provide a window listing all uncollected objects"), )