From ee076d94bd6f2b40ff80fa2067e7a1ba3798ff31 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 11 Nov 2005 04:53:58 +0000 Subject: [PATCH] * src/GraphLayout.py: removed, incorporated into DesGraph * src/Makefile.am: removed GraphLayout.py * src/Plugins.py: don't enter into menus if not in debug mode * src/plugins/CmdRef.py: don't enter into menus if not in debug mode * src/plugins/Eval.py: don't enter into menus if not in debug mode * src/plugins/Leak.py: don't enter into menus if not in debug mode * src/plugins/TestcaseGenerator.py: don't enter into menus if not in debug mode * src/plugins/DumpGenderStats.py: don't enter into menus if not * src/AncestorChart.py: Move to unsupported * src/DesGraph.py: Move to unsupported * src/AncestorChart2.py: More consistent name * src/DescendChart.py: More consistent name svn: r5398 --- gramps2/ChangeLog | 15 ++++ gramps2/src/GraphLayout.py | 91 ------------------------ gramps2/src/Makefile.am | 1 - gramps2/src/Plugins.py | 22 +++--- gramps2/src/plugins/AncestorChart.py | 1 + gramps2/src/plugins/AncestorChart2.py | 2 +- gramps2/src/plugins/CmdRef.py | 31 ++++---- gramps2/src/plugins/DesGraph.py | 69 +++++++++++++++++- gramps2/src/plugins/DescendChart.py | 2 +- gramps2/src/plugins/DumpGenderStats.py | 25 ++++--- gramps2/src/plugins/Eval.py | 28 ++++---- gramps2/src/plugins/Leak.py | 28 ++++---- gramps2/src/plugins/TestcaseGenerator.py | 32 +++++---- 13 files changed, 176 insertions(+), 171 deletions(-) delete mode 100644 gramps2/src/GraphLayout.py diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 2402b563b..13568940c 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,18 @@ +2005-11-10 Don Allingham + * src/GraphLayout.py: removed, incorporated into DesGraph + * src/Makefile.am: removed GraphLayout.py + * src/Plugins.py: don't enter into menus if not in debug mode + * src/plugins/CmdRef.py: don't enter into menus if not in debug mode + * src/plugins/Eval.py: don't enter into menus if not in debug mode + * src/plugins/Leak.py: don't enter into menus if not in debug mode + * src/plugins/TestcaseGenerator.py: don't enter into menus if not + in debug mode + * src/plugins/DumpGenderStats.py: don't enter into menus if not + * src/AncestorChart.py: Move to unsupported + * src/DesGraph.py: Move to unsupported + * src/AncestorChart2.py: More consistent name + * src/DescendChart.py: More consistent name + 2005-11-10 Alex Roitman * src/po/nl.po: Typo. * src/plugins/IndivSummary.py: Move to Unsupported (duplicates diff --git a/gramps2/src/GraphLayout.py b/gramps2/src/GraphLayout.py deleted file mode 100644 index 141a8f673..000000000 --- a/gramps2/src/GraphLayout.py +++ /dev/null @@ -1,91 +0,0 @@ -# -# Gramps - a GTK+/GNOME based genealogy program -# -# Copyright (C) 2000-2004 Donald N. Allingham -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -# $Id$ - - -import sets -import Errors -import NameDisplay - -class GraphLayout: - - def __init__(self,database,plist,person_handle): - self.database = database - self.plist = plist - self.person_handle = person_handle - self.v = [] - self.e = [] - self.maxx = 0 - self.maxy = 0 - - def max_size(self): - return (self.maxx,self.maxy) - - def layout(self): - return ([],[]) - -class DescendLine(GraphLayout): - - def layout(self): - self.elist = [(0,0)] - try: - self.space_for(self.person_handle) - except RuntimeError,msg: - person = self.database.get_person_from_handle(self.person_handle) - raise Errors.DatabaseError( - _("Database error: %s is defined as his or her own ancestor") % - NameDisplay.displayer.display(person)) - - return (self.v,self.e[1:]) - - def space_for(self,person_handle,level=1.0,pos=1.0): - - person = self.database.get_person_from_handle(person_handle) - - last = self.elist[-1] - self.elist.append((level,pos)) - self.e.append((last[0],last[1],level,pos)) - self.v.append((person_handle,level,pos)) - if level > self.maxx: - self.maxx = level - if pos > self.maxy: - self.maxy = pos - - for family_handle in person.get_family_handle_list(): - family = self.database.get_family_from_handle(family_handle) - for child_handle in family.get_child_handle_list(): - self.space_for(child_handle,level+1.0,pos) - pos = pos + max(self.depth(child_handle),1) - if pos > self.maxy: - self.maxy = pos - self.elist.pop() - - def depth(self,person_handle,val=0): - person = self.database.get_person_from_handle(person_handle) - for family_handle in person.get_family_handle_list(): - family = self.database.get_family_from_handle(family_handle) - clist = family.get_child_handle_list() - val = val + len(clist) - for child_handle in clist: - d = self.depth(child_handle) - if d > 0: - val = val + d - 1 #first child is always on the same - return val #row as the parent, so subtract 1 diff --git a/gramps2/src/Makefile.am b/gramps2/src/Makefile.am index e477d1ebb..b271120d8 100644 --- a/gramps2/src/Makefile.am +++ b/gramps2/src/Makefile.am @@ -65,7 +65,6 @@ gdir_PYTHON = \ GrampsMime.py\ gramps_main.py\ gramps.py\ - GraphLayout.py\ ImageSelect.py\ ImgManip.py\ latin_ansel.py\ diff --git a/gramps2/src/Plugins.py b/gramps2/src/Plugins.py index 8c75a29f1..f179a2743 100644 --- a/gramps2/src/Plugins.py +++ b/gramps2/src/Plugins.py @@ -731,13 +731,15 @@ class ReloadOptions(Tool.ToolOptions): # Register the plugin reloading tool # #------------------------------------------------------------------------- -PluginMgr.register_tool( - name = 'reload', - category = Tool.TOOL_DEBUG, - tool_class = Reload, - options_class = ReloadOptions, - modes = Tool.MODE_GUI, - translated_name = _("Reload plugins"), - description=_("Attempt to reload plugins. " - "Note: This tool itself is not reloaded!"), - ) + +if __debug__: + PluginMgr.register_tool( + name = 'reload', + category = Tool.TOOL_DEBUG, + tool_class = Reload, + options_class = ReloadOptions, + modes = Tool.MODE_GUI, + translated_name = _("Reload plugins"), + description=_("Attempt to reload plugins. " + "Note: This tool itself is not reloaded!"), + ) diff --git a/gramps2/src/plugins/AncestorChart.py b/gramps2/src/plugins/AncestorChart.py index bffb46e5e..59f00486b 100644 --- a/gramps2/src/plugins/AncestorChart.py +++ b/gramps2/src/plugins/AncestorChart.py @@ -273,4 +273,5 @@ register_report( author_name = "Donald N. Allingham", author_email = "don@gramps-project.org", description = _("Produces a graphical ancestral tree graph"), + unsupported = True, ) diff --git a/gramps2/src/plugins/AncestorChart2.py b/gramps2/src/plugins/AncestorChart2.py index 1b70d9107..cdd506384 100644 --- a/gramps2/src/plugins/AncestorChart2.py +++ b/gramps2/src/plugins/AncestorChart2.py @@ -519,7 +519,7 @@ register_report( report_class = AncestorChart, options_class = AncestorChartOptions, modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI, - translated_name = _("Ancestor Chart (Wall Chart)"), + translated_name = _("Ancestor Graph"), status = _("Stable"), author_name = "Donald N. Allingham", author_email = "don@gramps-project.org", diff --git a/gramps2/src/plugins/CmdRef.py b/gramps2/src/plugins/CmdRef.py index a225e6345..6204bbb2a 100644 --- a/gramps2/src/plugins/CmdRef.py +++ b/gramps2/src/plugins/CmdRef.py @@ -242,18 +242,21 @@ class CmdRefOptions(Tool.ToolOptions): # # #------------------------------------------------------------------------ -from PluginMgr import register_tool -register_tool( - name = 'cmdref', - category = Tool.TOOL_DEBUG, - tool_class = CmdRef, - options_class = CmdRefOptions, - modes = Tool.MODE_GUI | Tool.MODE_CLI, - translated_name = _("Generate Commandline Plugin Reference"), - status = _("Stable"), - author_name = "Martin Hawlisch", - author_email = "martin@hawlisch.de", - description=_("Generates a DocBook XML file that contains " - "a parameter reference of Reports and Tools.") - ) +if __debug__: + + from PluginMgr import register_tool + + register_tool( + name = 'cmdref', + category = Tool.TOOL_DEBUG, + tool_class = CmdRef, + options_class = CmdRefOptions, + modes = Tool.MODE_GUI | Tool.MODE_CLI, + translated_name = _("Generate Commandline Plugin Reference"), + status = _("Stable"), + author_name = "Martin Hawlisch", + author_email = "martin@hawlisch.de", + description=_("Generates a DocBook XML file that contains " + "a parameter reference of Reports and Tools.") + ) diff --git a/gramps2/src/plugins/DesGraph.py b/gramps2/src/plugins/DesGraph.py index 520f7d053..e663863e4 100644 --- a/gramps2/src/plugins/DesGraph.py +++ b/gramps2/src/plugins/DesGraph.py @@ -41,7 +41,6 @@ import gtk # GRAMPS modules # #------------------------------------------------------------------------ -import GraphLayout import Report import BaseDoc from SubstKeywords import SubstKeywords @@ -57,6 +56,71 @@ _BORN = _('b.') _DIED = _('d.') _sep = 0.5 +class GraphLayout: + + def __init__(self,database,plist,person_handle): + self.database = database + self.plist = plist + self.person_handle = person_handle + self.v = [] + self.e = [] + self.maxx = 0 + self.maxy = 0 + + def max_size(self): + return (self.maxx,self.maxy) + + def layout(self): + return ([],[]) + +class DescendLine(GraphLayout): + + def layout(self): + self.elist = [(0,0)] + try: + self.space_for(self.person_handle) + except RuntimeError,msg: + person = self.database.get_person_from_handle(self.person_handle) + raise Errors.DatabaseError( + _("Database error: %s is defined as his or her own ancestor") % + NameDisplay.displayer.display(person)) + + return (self.v,self.e[1:]) + + def space_for(self,person_handle,level=1.0,pos=1.0): + + person = self.database.get_person_from_handle(person_handle) + + last = self.elist[-1] + self.elist.append((level,pos)) + self.e.append((last[0],last[1],level,pos)) + self.v.append((person_handle,level,pos)) + if level > self.maxx: + self.maxx = level + if pos > self.maxy: + self.maxy = pos + + for family_handle in person.get_family_handle_list(): + family = self.database.get_family_from_handle(family_handle) + for child_handle in family.get_child_handle_list(): + self.space_for(child_handle,level+1.0,pos) + pos = pos + max(self.depth(child_handle),1) + if pos > self.maxy: + self.maxy = pos + self.elist.pop() + + def depth(self,person_handle,val=0): + person = self.database.get_person_from_handle(person_handle) + for family_handle in person.get_family_handle_list(): + family = self.database.get_family_from_handle(family_handle) + clist = family.get_child_handle_list() + val = val + len(clist) + for child_handle in clist: + d = self.depth(child_handle) + if d > 0: + val = val + d - 1 #first child is always on the same + return val #row as the parent, so subtract 1 + #------------------------------------------------------------------------ # # DescendantGraph @@ -91,7 +155,7 @@ class DescendantGraph(Report.Report): self.lines = 0 plist = self.database.get_person_handles(sort_handles=False) - self.layout = GraphLayout.DescendLine(self.database,plist,person.get_handle()) + self.layout = DescendLine(self.database,plist,person.get_handle()) (self.v,self.e) = self.layout.layout() self.text = {} @@ -348,4 +412,5 @@ register_report( author_name = "Donald N. Allingham", author_email = "don@gramps-project.org", description = _("Generates a graph of descendants of the active person"), + unsupported = True, ) diff --git a/gramps2/src/plugins/DescendChart.py b/gramps2/src/plugins/DescendChart.py index e0e9cb4f3..f13765b2b 100644 --- a/gramps2/src/plugins/DescendChart.py +++ b/gramps2/src/plugins/DescendChart.py @@ -470,7 +470,7 @@ register_report( report_class = DescendChart, options_class = DescendChartOptions, modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI, - translated_name = _("Descendant Wall Chart"), + translated_name = _("Descendant Graph"), status = _("Stable"), author_name = "Donald N. Allingham", author_email = "don@gramps-project.org", diff --git a/gramps2/src/plugins/DumpGenderStats.py b/gramps2/src/plugins/DumpGenderStats.py index 42d3d0d6f..499305540 100644 --- a/gramps2/src/plugins/DumpGenderStats.py +++ b/gramps2/src/plugins/DumpGenderStats.py @@ -88,15 +88,18 @@ class DumpGenderStatsOptions(Tool.ToolOptions): # # #------------------------------------------------------------------------- -from PluginMgr import register_tool -register_tool( - 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.") - ) +if __debug__: + + from PluginMgr import register_tool + + register_tool( + 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.") + ) diff --git a/gramps2/src/plugins/Eval.py b/gramps2/src/plugins/Eval.py index 13d44da2c..65563fe7b 100644 --- a/gramps2/src/plugins/Eval.py +++ b/gramps2/src/plugins/Eval.py @@ -144,17 +144,19 @@ class EvalOptions(Tool.ToolOptions): # # #------------------------------------------------------------------------ -from PluginMgr import register_tool -register_tool( - name = 'eval', - category = Tool.TOOL_DEBUG, - tool_class = Eval, - options_class = EvalOptions, - modes = Tool.MODE_GUI, - translated_name = _("Python evaluation window"), - status = _("Stable"), - author_name = "Donald N. Allingham", - author_email = "don@gramps-project.org", - description=_("Provides a window that can evaluate python code") - ) +if __debug__: + from PluginMgr import register_tool + + register_tool( + name = 'eval', + category = Tool.TOOL_DEBUG, + tool_class = Eval, + options_class = EvalOptions, + modes = Tool.MODE_GUI, + translated_name = _("Python evaluation window"), + status = _("Stable"), + author_name = "Donald N. Allingham", + author_email = "don@gramps-project.org", + description=_("Provides a window that can evaluate python code") + ) diff --git a/gramps2/src/plugins/Leak.py b/gramps2/src/plugins/Leak.py index 5269ca26c..990775059 100644 --- a/gramps2/src/plugins/Leak.py +++ b/gramps2/src/plugins/Leak.py @@ -140,17 +140,19 @@ class LeakOptions(Tool.ToolOptions): # # #------------------------------------------------------------------------ -from PluginMgr import register_tool -register_tool( - name = 'eval', - category = Tool.TOOL_DEBUG, - tool_class = Leak, - options_class = LeakOptions, - modes = Tool.MODE_GUI, - translated_name = _("Show uncollected objects"), - status = _("Stable"), - author_name = "Donald N. Allingham", - author_email = "don@gramps-project.org", - description=_("Provide a window listing all uncollected objects"), - ) +if __debug__: + from PluginMgr import register_tool + + register_tool( + name = 'eval', + category = Tool.TOOL_DEBUG, + tool_class = Leak, + options_class = LeakOptions, + modes = Tool.MODE_GUI, + translated_name = _("Show uncollected objects"), + status = _("Stable"), + author_name = "Donald N. Allingham", + author_email = "don@gramps-project.org", + description=_("Provide a window listing all uncollected objects"), + ) diff --git a/gramps2/src/plugins/TestcaseGenerator.py b/gramps2/src/plugins/TestcaseGenerator.py index c5c785a1a..3e6b6fb29 100644 --- a/gramps2/src/plugins/TestcaseGenerator.py +++ b/gramps2/src/plugins/TestcaseGenerator.py @@ -1377,18 +1377,22 @@ class TestcaseGeneratorOptions(Tool.ToolOptions): # # #------------------------------------------------------------------------- -from PluginMgr import register_tool -register_tool( - name = 'testcasegenerator', - category = Tool.TOOL_DEBUG, - tool_class = TestcaseGenerator, - options_class = TestcaseGeneratorOptions, - modes = Tool.MODE_GUI | Tool.MODE_CLI, - translated_name = _("Generate Testcases for persons and families"), - status = _("Beta"), - author_name = "Martin Hawlisch", - author_email = "martin@hawlisch.de", - description = _("The testcase generator will generate some persons and families" - " that have broken links in the database or data that is in conflict to a relation.") - ) +if __debug__: + from PluginMgr import register_tool + + register_tool( + name = 'testcasegenerator', + category = Tool.TOOL_DEBUG, + tool_class = TestcaseGenerator, + options_class = TestcaseGeneratorOptions, + modes = Tool.MODE_GUI | Tool.MODE_CLI, + translated_name = _("Generate Testcases for persons and families"), + status = _("Beta"), + author_name = "Martin Hawlisch", + author_email = "martin@hawlisch.de", + description = _("The testcase generator will generate some persons " + "and families that have broken links in the database " + "or data that is in conflict to a relation.") + ) +