From 0774bf2a8e7abfce3dc93c03dc8f41e941d27f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Charette?= Date: Sat, 24 May 2008 08:59:32 +0000 Subject: [PATCH] bug reports #2176, #2177, #2178; various Graphviz issues, merged up from gramps30 svn: r10758 --- src/ReportBase/_GraphvizReportDialog.py | 27 +++++++++++++++++-------- src/plugins/GVFamilyLines.py | 24 +++++++--------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/ReportBase/_GraphvizReportDialog.py b/src/ReportBase/_GraphvizReportDialog.py index d9c765ada..03857562a 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 @@ -200,14 +201,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, node_id, label, shape="", color="", style="", fillcolor="", url="", htmloutput=False): @@ -292,6 +302,7 @@ class GVDocBase(BaseDoc.BaseDoc, BaseDoc.GVDoc): """ Implement BaseDoc.GVDoc.start_subgraph() """ self.write(' subgraph cluster_%s\n' % graph_id) self.write(' {\n') + self.write(' style="invis";\n') # no border around subgraph (#0002176) def end_subgraph(self): """ Implement BaseDoc.GVDoc.end_subgraph() """ diff --git a/src/plugins/GVFamilyLines.py b/src/plugins/GVFamilyLines.py index 01163c3c0..d43468908 100644 --- a/src/plugins/GVFamilyLines.py +++ b/src/plugins/GVFamilyLines.py @@ -165,19 +165,19 @@ class FamilyLinesOptions(MenuReportOptions): self.max_parents = NumberOption('', 50, 10, 9999) self.max_parents.set_help( - _('The maximum number of ancestors to include.')) + _('The maximum number of ancestors to include.')) menu.add_option(category, 'maxparents', 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.')) + _('The maximum number of children to include.')) menu.add_option(category, 'limitchildren', 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, 'maxchildren', self.max_children) color = EnumeratedListOption(_("Graph coloring"), "filled") @@ -194,7 +194,7 @@ class FamilyLinesOptions(MenuReportOptions): # -------------------- self.include_images = BooleanOption( - _('Include thumbnail images of people'), True) + _('Include thumbnail images of people'), True) self.include_images.set_help( _('The maximum number of children to include.')) menu.add_option(category, 'incimages', self.include_images) @@ -235,13 +235,6 @@ class FamilyLinesOptions(MenuReportOptions): 'than 1 child.')) menu.add_option(category, 'incchildcnt', include_num_children) - include_researcher = BooleanOption( - _('Include researcher and date'), True) - include_researcher.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, 'incresearcher', include_researcher) - include_private = BooleanOption(_('Include private records'), False) include_private.set_help(_('Whether to include names, dates, and ' \ 'families that are marked as private.')) @@ -357,9 +350,6 @@ class FamilyLinesReport(Report): _opt = menu.get_option_by_name('incchildcnt') self._incchildcount = _opt.get_value() - _opt = menu.get_option_by_name('incresearcher') - self._incresearcher = _opt.get_value() - _opt = menu.get_option_by_name('incprivate') self._incprivate = _opt.get_value() @@ -376,7 +366,7 @@ class FamilyLinesReport(Report): _opt = menu.get_option_by_name('surnamecolors') tmp = _opt.get_value().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._surnamecolors[surname] = colour @@ -995,11 +985,11 @@ class FamilyLinesReport(Report): father_handle = family.get_father_handle() mother_handle = family.get_mother_handle() + self.doc.add_comment('') + if self._usesubgraphs and father_handle and mother_handle: self.doc.start_subgraph(fgid) - self.doc.add_comment('') - # see if we have a father to link to this family if father_handle: if father_handle in self._people: