From d6e2b9d935702c9ad15613e5544ccb8b124e127f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Charette?= Date: Sat, 24 May 2008 08:40:46 +0000 Subject: [PATCH] bug reports #2176, #2177, #2178; various Graphviz issues svn: r10757 --- src/ReportBase/_GraphvizReportDialog.py | 27 +++++++++++----- src/plugins/GVFamilyLines.py | 41 ++++++++++--------------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/ReportBase/_GraphvizReportDialog.py b/src/ReportBase/_GraphvizReportDialog.py index d9cd5cf9b..3496b2e54 100644 --- a/src/ReportBase/_GraphvizReportDialog.py +++ b/src/ReportBase/_GraphvizReportDialog.py @@ -2,6 +2,7 @@ # Gramps - a GTK+/GNOME based genealogy program # # 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 # 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. """ if self.note: - self.write( 'labelloc="%s";\n' % self.noteloc ) - self.write( 'label="' ) - for line in self.note: - self.write( '%s\\n' % line.replace('"', '\\\"') ) - self.write( '";\n') - self.write( 'fontsize="%d";\n' % self.notesize ) - - self.write( '}' ) + # build up the label + label = u'' + for line in self.note: # for every line in the note... + line = line.strip() # ...strip whitespace from this line... + if line != '': # ...and if we still have a line... + if label != '': # ...see if we need to insert a newline... + label += '\\n' + 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="", style="", fillcolor="", url="", htmloutput=False ): @@ -286,6 +296,7 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc): def start_subgraph(self,id): self.write(' subgraph cluster_%s\n' % id) self.write(' {\n') + self.write(' style="invis";\n') # no border around subgraph (#0002176) def end_subgraph(self): self.write(' }\n') diff --git a/src/plugins/GVFamilyLines.py b/src/plugins/GVFamilyLines.py index 950b417b8..350d18c8e 100644 --- a/src/plugins/GVFamilyLines.py +++ b/src/plugins/GVFamilyLines.py @@ -123,44 +123,41 @@ class FamilyLinesOptions(MenuReportOptions): category = _('Individuals') # ------------------------- - colourMales = ColourOption( _('Males'), '#e0e0ff') + colourMales = ColourOption( _('Males'), '#e0e0ff') colourMales.set_help( _('The colour to use to display men.')) menu.add_option(category, 'FLcolourMales', colourMales) - colourFemales = ColourOption( _('Females'), '#ffe0e0') + colourFemales = ColourOption( _('Females'), '#ffe0e0') colourFemales.set_help( _('The colour to use to display women.')) 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.')) menu.add_option(category, 'FLcolourUnknown', colourUnknown) - colourFamily = ColourOption( _('Families'), '#ffffe0') + colourFamily = ColourOption( _('Families'), '#ffffe0') colourFamily.set_help( _('The colour to use to display families.')) menu.add_option(category, 'FLcolourFamilies', colourFamily) self.limit_parents = BooleanOption(_('Limit the number of parents'), False) - self.limit_parents.set_help( - _('The maximum number of ancestors to include.')) + self.limit_parents.set_help( _('The maximum number of ancestors to include.')) menu.add_option(category, 'FLlimitParents', self.limit_parents) self.limit_parents.connect('value-changed', self.limit_changed) self.max_parents = NumberOption('', 50, 10, 9999) - self.max_parents.set_help( - _('The maximum number of ancestors to include.')) + self.max_parents.set_help( _('The maximum number of ancestors to include.')) menu.add_option(category, 'FLmaxParents', self.max_parents) self.limit_children = BooleanOption(_('Limit the number of children'), False) - self.limit_children.set_help( - _('The maximum number of children to include.')) + self.limit_children.set_help( _('The maximum number of children to include.')) menu.add_option(category, 'FLlimitChildren', self.limit_children) self.limit_children.connect('value-changed', self.limit_changed) self.max_children = NumberOption('', 50, 10, 9999) 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) # -------------------- @@ -168,15 +165,14 @@ class FamilyLinesOptions(MenuReportOptions): # -------------------- self.include_images = BooleanOption( - _('Include thumbnail images of people'), True) - self.include_images.set_help( - _('The maximum number of children to include.')) + _('Include thumbnail images of people'), True) + self.include_images.set_help( _('The maximum number of children to include.')) menu.add_option(category, 'FLincludeImages', self.include_images) self.include_images.connect('value-changed', self.images_changed) self.image_location = EnumeratedListOption(_('Thumbnail location'), 0) - self.image_location.add_item(0, _('Above the name')) - self.image_location.add_item(1, _('Beside the name')) + self.image_location.add_item(0, _('Above the name')) + self.image_location.add_item(1, _('Beside the name')) self.image_location.set_help( _('Where the thumbnail image should appear relative to the name')) 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.')) 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.set_help( _('Whether to include names, dates, and families that are marked as private.')) menu.add_option(category, 'FLincludePrivate', includePrivate) @@ -272,7 +264,6 @@ class FamilyLinesReport(Report): self.includeDates = options.handler.options_dict['FLincludeDates' ] self.includePlaces = options.handler.options_dict['FLincludePlaces' ] self.includeNumChildren = options.handler.options_dict['FLincludeNumChildren' ] - self.includeResearcher = options.handler.options_dict['FLincludeResearcher' ] self.includePrivate = options.handler.options_dict['FLincludePrivate' ] # the gidlist is annoying for us to use since we always have to convert @@ -287,7 +278,7 @@ class FamilyLinesReport(Report): self.surnameColours = {} tmp = options.handler.options_dict['FLsurnameColours'].split() 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) 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 # 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: self.peopleToOutput.clear() @@ -834,11 +825,11 @@ class FamilyLinesReport(Report): fatherHandle = family.get_father_handle() motherHandle = family.get_mother_handle() + self.doc.add_comment('') + if self.useSubgraphs and fatherHandle and motherHandle: self.doc.start_subgraph(fgid) - self.doc.add_comment('') - # see if we have a father to link to this family if fatherHandle: if fatherHandle in self.peopleToOutput: