Fixes 0003155: GraphViz arrow directions are odd

Patch by Bob Ham <rah@bash.sh>

+ 1 typo in WebCal.py

svn: r12919
This commit is contained in:
Raphael Ackermann 2009-08-08 14:28:19 +00:00
parent 24750e0272
commit 69f05f43aa
5 changed files with 35 additions and 35 deletions

View File

@ -4,6 +4,7 @@
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2009 Stephane Charette
# Copyright (C) 2009 Gary Burton
# Contribution 2009 by Bob Ham <rah@bash.sh>
#
# 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
@ -59,7 +60,7 @@ from gen.plug.menu import NumberOption, TextOption, EnumeratedListOption, \
#-------------------------------------------------------------------------------
#
# Private Contstants
# Private Constants
#
#-------------------------------------------------------------------------------
_FONTS = [ { 'name' : _("Default"), 'value' : "" },
@ -148,7 +149,7 @@ def _run_long_process_in_thread(func, header):
#-------------------------------------------------------------------------------
class GVDocBase(BaseDoc, GVDoc):
"""
Base document generator for all Graphiz document generators. Classes that
Base document generator for all Graphviz document generators. Classes that
inherit from this class will only need to implement the close function.
The close function will generate the actual file of the appropriate type.
"""
@ -220,8 +221,7 @@ class GVDocBase(BaseDoc, GVDoc):
self.write( ' size="%3.2f,%3.2f"; \n' % (sizew, sizeh) )
self.write( ' splines="true";\n' )
self.write( '\n' )
self.write( ' edge [len=0.5 style=solid arrowhead=none '
'arrowtail=normal fontsize=%d];\n' % self.fontsize )
self.write( ' edge [len=0.5 style=solid fontsize=%d];\n' % self.fontsize )
if self.fontfamily:
self.write( ' node [style=filled fontname="%s" fontsize=%d];\n'
% ( self.fontfamily, self.fontsize ) )
@ -302,7 +302,7 @@ class GVDocBase(BaseDoc, GVDoc):
"""
Add a link between two nodes.
Implementes GVDoc.add_link().
Implements GVDoc.add_link().
"""
self.write(' %s -> %s' % (id1, id2))
@ -329,7 +329,7 @@ class GVDocBase(BaseDoc, GVDoc):
"""
Add a comment.
Implementes GVDoc.add_comment().
Implements GVDoc.add_comment().
"""
tmp = comment.split('\n')
for line in tmp:
@ -907,7 +907,7 @@ class GraphvizReportDialog(ReportDialog):
"""A class of ReportDialog customized for graphviz based reports."""
def __init__(self, dbstate, uistate, opt, name, translated_name):
"""Initialize a dialog to request that the user select options
for a graphiz report. See the ReportDialog class for
for a graphviz report. See the ReportDialog class for
more information."""
self.category = CATEGORY_GRAPHVIZ
ReportDialog.__init__(self, dbstate, uistate, opt,

View File

@ -4,9 +4,10 @@
# Copyright (C) 2007-2008 Stephane Charette
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2009 Gary Burton
# Contribution 2009 by Bob Ham <rah@bash.sh>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pubilc License as published by
# 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.
#
@ -850,7 +851,7 @@ class FamilyLinesReport(Report):
media.get_path()),
rectangle=mediaList[0].get_rectangle())
# put the label together and ouput this person
# put the label together and output this person
label = u""
lineDelimiter = '\\n'
if bUseHtmlOutput:
@ -1017,14 +1018,14 @@ class FamilyLinesReport(Report):
if father_handle in self._people:
father = self._db.get_person_from_handle(father_handle)
comment = "father: %s" % father.get_primary_name().get_regular_name()
self.doc.add_link(fgid, father.get_gramps_id(), comment=comment)
self.doc.add_link(father.get_gramps_id(), fgid, comment=comment)
# see if we have a mother to link to this family
if mother_handle:
if mother_handle in self._people:
mother = self._db.get_person_from_handle(mother_handle)
comment = "mother: %s" % mother.get_primary_name().get_regular_name()
self.doc.add_link(fgid, mother.get_gramps_id(), comment=comment)
self.doc.add_link(mother.get_gramps_id(), fgid, comment=comment)
if self._usesubgraphs and father_handle and mother_handle:
self.doc.end_subgraph()
@ -1034,7 +1035,7 @@ class FamilyLinesReport(Report):
if childRef.ref in self._people:
child = self._db.get_person_from_handle(childRef.ref)
comment = "child: %s" % child.get_primary_name().get_regular_name()
self.doc.add_link(child.get_gramps_id(), fgid, comment=comment)
self.doc.add_link(fgid, child.get_gramps_id(), comment=comment)
#------------------------------------------------------------------------

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2008 Stephane Charette <stephanecharette@gmail.com>
# Contribution 2009 by Bob Ham <rah@bash.sh>
#
# 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
@ -110,15 +111,14 @@ class HourGlassReport(Report):
def traverse_down(self, person, gen):
"""
Resursively find the descendants of the given person.
Recursively find the descendants of the given person.
"""
if gen > self.max_descend:
return
for family_handle in person.get_family_handle_list():
family = self.__db.get_family_from_handle(family_handle)
self.add_family(family)
self.doc.add_link( person.get_gramps_id(), family.get_gramps_id(),
head='normal', tail='none' )
self.doc.add_link( person.get_gramps_id(), family.get_gramps_id() )
for child_ref in family.get_child_ref_list():
child_handle = child_ref.get_reference_handle()
if child_handle not in self.__used_people:
@ -127,13 +127,12 @@ class HourGlassReport(Report):
child = self.__db.get_person_from_handle(child_handle)
self.add_person(child)
self.doc.add_link(family.get_gramps_id(),
child.get_gramps_id(),
head='normal', tail='none' )
child.get_gramps_id() )
self.traverse_down(child, gen+1)
def traverse_up(self, person, gen):
"""
Resursively find the ancestors of the given person.
Recursively find the ancestors of the given person.
"""
if gen > self.max_ascend:
return

View File

@ -10,6 +10,7 @@
# Contributions by Lorenzo Cappelletti <lorenzo.cappelletti@email.it>
# Copyright (C) 2008 Stephane Charette <stephanecharette@gmail.com>
# Copyright (C) 2009 Gary Burton
# Contribution 2009 by Bob Ham <rah@bash.sh>
#
# 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
@ -140,14 +141,14 @@ class RelGraphReport(Report):
}
arrow_str = menu.get_option_by_name('arrow').get_value()
if arrow_str.find('a') + 1:
self.arrowheadstyle = 'normal'
else:
if arrow_str.find('d') == -1:
self.arrowheadstyle = 'none'
if arrow_str.find('d') + 1:
else:
self.arrowheadstyle = None
if arrow_str.find('a') != -1:
self.arrowtailstyle = 'normal'
else:
self.arrowtailstyle = 'none'
self.arrowtailstyle = None
filter_option = options_class.menu.get_option_by_name('filter')
self._filter = filter_option.get_filter()
@ -194,14 +195,14 @@ class RelGraphReport(Report):
style = 'solid'
adopted = ((int(frel) != gen.lib.ChildRefType.BIRTH) or
(int(mrel) != gen.lib.ChildRefType.BIRTH))
# If birth relation to father is NONE, mening there is no father and
# If birth relation to father is NONE, meaning there is no father and
# if birth relation to mother is BIRTH then solid line
if ((int(frel) == gen.lib.ChildRefType.NONE) and
(int(mrel) == gen.lib.ChildRefType.BIRTH)):
adopted = False
if adopted and self.adoptionsdashed:
style = 'dotted'
self.doc.add_link( p_id, family.get_gramps_id(), style,
self.doc.add_link( family.get_gramps_id(), p_id, style,
self.arrowheadstyle, self.arrowtailstyle )
def add_parent_link(self, p_id, parent_handle, rel):
@ -210,7 +211,7 @@ class RelGraphReport(Report):
if (int(rel) != gen.lib.ChildRefType.BIRTH) and self.adoptionsdashed:
style = 'dotted'
parent = self.database.get_person_from_handle(parent_handle)
self.doc.add_link( p_id, parent.get_gramps_id(), style,
self.doc.add_link( parent.get_gramps_id(), p_id, style,
self.arrowheadstyle, self.arrowtailstyle )
def add_persons_and_families(self):
@ -244,7 +245,6 @@ class RelGraphReport(Report):
family_list = person.get_family_handle_list()
for fam_handle in family_list:
family = self.database.get_family_from_handle(fam_handle)
fam_id = family.get_gramps_id()
if fam_handle not in families_done:
families_done[fam_handle] = 1
self.__add_family(fam_handle)
@ -253,7 +253,7 @@ class RelGraphReport(Report):
# control over the layout of the whole graph but
# may leave spouses not positioned together.
if not self.use_subgraphs:
self.doc.add_link(fam_id, p_id, "",
self.doc.add_link(p_id, family.get_gramps_id(), "",
self.arrowheadstyle,
self.arrowtailstyle)
@ -291,14 +291,14 @@ class RelGraphReport(Report):
m_handle = fam.get_mother_handle()
if f_handle:
father = self.database.get_person_from_handle(f_handle)
self.doc.add_link(fam_id,
father.get_gramps_id(), "",
self.doc.add_link(father.get_gramps_id(),
fam_id, "",
self.arrowheadstyle,
self.arrowtailstyle)
if m_handle:
mother = self.database.get_person_from_handle(m_handle)
self.doc.add_link(fam_id,
mother.get_gramps_id(), "",
self.doc.add_link(mother.get_gramps_id(),
fam_id, "",
self.arrowheadstyle,
self.arrowtailstyle)
self.doc.end_subgraph()
@ -360,7 +360,7 @@ class RelGraphReport(Report):
#
# This isn't a free-form HTML format here...just a few keywords that
# happen to be
# simillar to keywords commonly seen in HTML. For additional
# similar to keywords commonly seen in HTML. For additional
# information on what
# is allowed, see:
#
@ -397,7 +397,7 @@ class RelGraphReport(Report):
label += '</TD></TR></TABLE>'
return label
else :
# non html label is enclosed by "" so excape other "
# non html label is enclosed by "" so escape other "
return label.replace('"', '\\\"')
def get_date_strings(self, person):

View File

@ -7,7 +7,7 @@
# Copyright (C) 2008 Jason Simanek
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pubilc License as published by
# 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.
#