bug reports #2176, #2177, #2178; various Graphviz issues

svn: r10757
This commit is contained in:
Stéphane Charette 2008-05-24 08:40:46 +00:00
parent 59b7b0c550
commit d6e2b9d935
2 changed files with 35 additions and 33 deletions

View File

@ -2,6 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2007-2008 Brian G. Matherly # Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2008 Stephane Charette
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -195,14 +196,23 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc):
actually generate a file. actually generate a file.
""" """
if self.note: if self.note:
self.write( 'labelloc="%s";\n' % self.noteloc ) # build up the label
self.write( 'label="' ) label = u''
for line in self.note: for line in self.note: # for every line in the note...
self.write( '%s\\n' % line.replace('"', '\\\"') ) line = line.strip() # ...strip whitespace from this line...
self.write( '";\n') if line != '': # ...and if we still have a line...
self.write( 'fontsize="%d";\n' % self.notesize ) if label != '': # ...see if we need to insert a newline...
label += '\\n'
self.write( '}' ) label += line.replace('"', '\\\"')
# after all that, see if we have a label to display
if label != '':
self.write( '\n')
self.write( ' label="%s";\n' % label )
self.write( ' labelloc="%s";\n' % self.noteloc )
self.write( ' fontsize="%d";\n' % self.notesize )
self.write( '}\n\n' )
def add_node(self, id, label, shape="", color="", def add_node(self, id, label, shape="", color="",
style="", fillcolor="", url="", htmloutput=False ): style="", fillcolor="", url="", htmloutput=False ):
@ -286,6 +296,7 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc):
def start_subgraph(self,id): def start_subgraph(self,id):
self.write(' subgraph cluster_%s\n' % id) self.write(' subgraph cluster_%s\n' % id)
self.write(' {\n') self.write(' {\n')
self.write(' style="invis";\n') # no border around subgraph (#0002176)
def end_subgraph(self): def end_subgraph(self):
self.write(' }\n') self.write(' }\n')

View File

@ -123,44 +123,41 @@ class FamilyLinesOptions(MenuReportOptions):
category = _('Individuals') category = _('Individuals')
# ------------------------- # -------------------------
colourMales = ColourOption( _('Males'), '#e0e0ff') colourMales = ColourOption( _('Males'), '#e0e0ff')
colourMales.set_help( _('The colour to use to display men.')) colourMales.set_help( _('The colour to use to display men.'))
menu.add_option(category, 'FLcolourMales', colourMales) menu.add_option(category, 'FLcolourMales', colourMales)
colourFemales = ColourOption( _('Females'), '#ffe0e0') colourFemales = ColourOption( _('Females'), '#ffe0e0')
colourFemales.set_help( _('The colour to use to display women.')) colourFemales.set_help( _('The colour to use to display women.'))
menu.add_option(category, 'FLcolourFemales', colourFemales) menu.add_option(category, 'FLcolourFemales', colourFemales)
colourUnknown = ColourOption( _('Unknown'), '#e0e0e0') colourUnknown = ColourOption( _('Unknown'), '#e0e0e0')
colourUnknown.set_help( _('The colour to use when the gender is unknown.')) colourUnknown.set_help( _('The colour to use when the gender is unknown.'))
menu.add_option(category, 'FLcolourUnknown', colourUnknown) menu.add_option(category, 'FLcolourUnknown', colourUnknown)
colourFamily = ColourOption( _('Families'), '#ffffe0') colourFamily = ColourOption( _('Families'), '#ffffe0')
colourFamily.set_help( _('The colour to use to display families.')) colourFamily.set_help( _('The colour to use to display families.'))
menu.add_option(category, 'FLcolourFamilies', colourFamily) menu.add_option(category, 'FLcolourFamilies', colourFamily)
self.limit_parents = BooleanOption(_('Limit the number of parents'), self.limit_parents = BooleanOption(_('Limit the number of parents'),
False) False)
self.limit_parents.set_help( self.limit_parents.set_help( _('The maximum number of ancestors to include.'))
_('The maximum number of ancestors to include.'))
menu.add_option(category, 'FLlimitParents', self.limit_parents) menu.add_option(category, 'FLlimitParents', self.limit_parents)
self.limit_parents.connect('value-changed', self.limit_changed) self.limit_parents.connect('value-changed', self.limit_changed)
self.max_parents = NumberOption('', 50, 10, 9999) self.max_parents = NumberOption('', 50, 10, 9999)
self.max_parents.set_help( self.max_parents.set_help( _('The maximum number of ancestors to include.'))
_('The maximum number of ancestors to include.'))
menu.add_option(category, 'FLmaxParents', self.max_parents) menu.add_option(category, 'FLmaxParents', self.max_parents)
self.limit_children = BooleanOption(_('Limit the number of children'), self.limit_children = BooleanOption(_('Limit the number of children'),
False) False)
self.limit_children.set_help( self.limit_children.set_help( _('The maximum number of children to include.'))
_('The maximum number of children to include.'))
menu.add_option(category, 'FLlimitChildren', self.limit_children) menu.add_option(category, 'FLlimitChildren', self.limit_children)
self.limit_children.connect('value-changed', self.limit_changed) self.limit_children.connect('value-changed', self.limit_changed)
self.max_children = NumberOption('', 50, 10, 9999) self.max_children = NumberOption('', 50, 10, 9999)
self.max_children.set_help( self.max_children.set_help(
_('The maximum number of children to include.')) _('The maximum number of children to include.'))
menu.add_option(category, 'FLmaxChildren', self.max_children) menu.add_option(category, 'FLmaxChildren', self.max_children)
# -------------------- # --------------------
@ -168,15 +165,14 @@ class FamilyLinesOptions(MenuReportOptions):
# -------------------- # --------------------
self.include_images = BooleanOption( self.include_images = BooleanOption(
_('Include thumbnail images of people'), True) _('Include thumbnail images of people'), True)
self.include_images.set_help( self.include_images.set_help( _('The maximum number of children to include.'))
_('The maximum number of children to include.'))
menu.add_option(category, 'FLincludeImages', self.include_images) menu.add_option(category, 'FLincludeImages', self.include_images)
self.include_images.connect('value-changed', self.images_changed) self.include_images.connect('value-changed', self.images_changed)
self.image_location = EnumeratedListOption(_('Thumbnail location'), 0) self.image_location = EnumeratedListOption(_('Thumbnail location'), 0)
self.image_location.add_item(0, _('Above the name')) self.image_location.add_item(0, _('Above the name'))
self.image_location.add_item(1, _('Beside the name')) self.image_location.add_item(1, _('Beside the name'))
self.image_location.set_help( self.image_location.set_help(
_('Where the thumbnail image should appear relative to the name')) _('Where the thumbnail image should appear relative to the name'))
menu.add_option(category, 'FLimageOnTheSide', self.image_location) menu.add_option(category, 'FLimageOnTheSide', self.image_location)
@ -204,10 +200,6 @@ class FamilyLinesOptions(MenuReportOptions):
includeNumChildren.set_help( _('Whether to include the number of children for families with more than 1 child.')) includeNumChildren.set_help( _('Whether to include the number of children for families with more than 1 child.'))
menu.add_option(category, 'FLincludeNumChildren', includeNumChildren) menu.add_option(category, 'FLincludeNumChildren', includeNumChildren)
includeResearcher = BooleanOption( _('Include researcher and date'), True)
includeResearcher.set_help( _('Whether to include at the bottom the researcher''s name, e-mail, and the date the graph was generated.'))
menu.add_option(category, 'FLincludeResearcher', includeResearcher)
includePrivate = BooleanOption( _('Include private records'), False) includePrivate = BooleanOption( _('Include private records'), False)
includePrivate.set_help( _('Whether to include names, dates, and families that are marked as private.')) includePrivate.set_help( _('Whether to include names, dates, and families that are marked as private.'))
menu.add_option(category, 'FLincludePrivate', includePrivate) menu.add_option(category, 'FLincludePrivate', includePrivate)
@ -272,7 +264,6 @@ class FamilyLinesReport(Report):
self.includeDates = options.handler.options_dict['FLincludeDates' ] self.includeDates = options.handler.options_dict['FLincludeDates' ]
self.includePlaces = options.handler.options_dict['FLincludePlaces' ] self.includePlaces = options.handler.options_dict['FLincludePlaces' ]
self.includeNumChildren = options.handler.options_dict['FLincludeNumChildren' ] self.includeNumChildren = options.handler.options_dict['FLincludeNumChildren' ]
self.includeResearcher = options.handler.options_dict['FLincludeResearcher' ]
self.includePrivate = options.handler.options_dict['FLincludePrivate' ] self.includePrivate = options.handler.options_dict['FLincludePrivate' ]
# the gidlist is annoying for us to use since we always have to convert # the gidlist is annoying for us to use since we always have to convert
@ -287,7 +278,7 @@ class FamilyLinesReport(Report):
self.surnameColours = {} self.surnameColours = {}
tmp = options.handler.options_dict['FLsurnameColours'].split() tmp = options.handler.options_dict['FLsurnameColours'].split()
while len(tmp) > 1: while len(tmp) > 1:
surname = tmp.pop(0).encode('iso-8859-1','xmlcharrefreplace') surname = tmp.pop(0).encode('iso-8859-1', 'xmlcharrefreplace')
colour = tmp.pop(0) colour = tmp.pop(0)
self.surnameColours[surname] = colour self.surnameColours[surname] = colour
@ -298,7 +289,7 @@ class FamilyLinesReport(Report):
# this is where we'll do all of the work of figuring out who # this is where we'll do all of the work of figuring out who
# from the database is going to be output into the report # from the database is going to be output into the report
self.progress = Utils.ProgressMeter(_('Generating Family Lines'),_('Starting')) self.progress = Utils.ProgressMeter(_('Generating Family Lines'), _('Starting'))
# starting with the people of interest, we then add parents: # starting with the people of interest, we then add parents:
self.peopleToOutput.clear() self.peopleToOutput.clear()
@ -834,11 +825,11 @@ class FamilyLinesReport(Report):
fatherHandle = family.get_father_handle() fatherHandle = family.get_father_handle()
motherHandle = family.get_mother_handle() motherHandle = family.get_mother_handle()
self.doc.add_comment('')
if self.useSubgraphs and fatherHandle and motherHandle: if self.useSubgraphs and fatherHandle and motherHandle:
self.doc.start_subgraph(fgid) self.doc.start_subgraph(fgid)
self.doc.add_comment('')
# see if we have a father to link to this family # see if we have a father to link to this family
if fatherHandle: if fatherHandle:
if fatherHandle in self.peopleToOutput: if fatherHandle in self.peopleToOutput: