write out .dot file in ISO-8859 versus UTF-8
svn: r9645
This commit is contained in:
parent
fe2bd2834e
commit
83e05324d2
@ -1,3 +1,7 @@
|
|||||||
|
2007-12-30 Stéphane Charette <stephanecharette@gmail.com>
|
||||||
|
* src/ReportBase/_GraphvizReportDialog.py: write out the .dot file
|
||||||
|
using ISO-8859 instead of UTF-8 (allows for things like accented chars)
|
||||||
|
|
||||||
2007-12-30 Raphael Ackermann <raphael.ackermann@gmail.com>
|
2007-12-30 Raphael Ackermann <raphael.ackermann@gmail.com>
|
||||||
* src/docgen/HtmlDoc.py: Fix undefined variables.
|
* src/docgen/HtmlDoc.py: Fix undefined variables.
|
||||||
|
|
||||||
|
@ -155,36 +155,39 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc):
|
|||||||
sizew = sizew * self.hpages
|
sizew = sizew * self.hpages
|
||||||
sizeh = sizeh * self.vpages
|
sizeh = sizeh * self.vpages
|
||||||
|
|
||||||
self.dot.write( 'digraph GRAMPS_graph\n' )
|
self.write( 'digraph GRAMPS_graph\n' )
|
||||||
self.dot.write( '{\n' )
|
self.write( '{\n' )
|
||||||
self.dot.write( ' bgcolor=white;\n' )
|
self.write( ' bgcolor=white;\n' )
|
||||||
self.dot.write( ' center="true"; \n' )
|
self.write( ' center="true"; \n' )
|
||||||
self.dot.write( ' charset="iso-8859-1";\n' )
|
self.write( ' charset="iso-8859-1";\n' )
|
||||||
self.dot.write( ' concentrate="false";\n' )
|
self.write( ' concentrate="false";\n' )
|
||||||
self.dot.write( ' dpi="%d";\n' % self.dpi )
|
self.write( ' dpi="%d";\n' % self.dpi )
|
||||||
self.dot.write( ' graph [fontsize=%d];\n' % self.fontsize )
|
self.write( ' graph [fontsize=%d];\n' % self.fontsize )
|
||||||
self.dot.write( ' mclimit="99";\n' )
|
self.write( ' mclimit="99";\n' )
|
||||||
self.dot.write( ' nodesep="%.2f";\n' % self.nodesep )
|
self.write( ' nodesep="%.2f";\n' % self.nodesep )
|
||||||
self.dot.write( ' outputorder="edgesfirst";\n' )
|
self.write( ' outputorder="edgesfirst";\n' )
|
||||||
self.dot.write( ' page="%3.2f,%3.2f";\n' % (pwidth, pheight) )
|
self.write( ' page="%3.2f,%3.2f";\n' % (pwidth, pheight) )
|
||||||
self.dot.write( ' pagedir="%s";\n' % self.pagedir )
|
self.write( ' pagedir="%s";\n' % self.pagedir )
|
||||||
self.dot.write( ' rankdir="%s";\n' % self.rankdir )
|
self.write( ' rankdir="%s";\n' % self.rankdir )
|
||||||
self.dot.write( ' ranksep="%.2f";\n' % self.ranksep )
|
self.write( ' ranksep="%.2f";\n' % self.ranksep )
|
||||||
self.dot.write( ' ratio="%s";\n' % self.ratio )
|
self.write( ' ratio="%s";\n' % self.ratio )
|
||||||
self.dot.write( ' rotate="%d";\n' % rotate )
|
self.write( ' rotate="%d";\n' % rotate )
|
||||||
self.dot.write( ' searchsize="100";\n' )
|
self.write( ' searchsize="100";\n' )
|
||||||
self.dot.write( ' size="%3.2f,%3.2f"; \n' % (sizew, sizeh) )
|
self.write( ' size="%3.2f,%3.2f"; \n' % (sizew, sizeh) )
|
||||||
self.dot.write( ' splines="true";\n' )
|
self.write( ' splines="true";\n' )
|
||||||
self.dot.write( '\n' )
|
self.write( '\n' )
|
||||||
self.dot.write( ' edge [len=0.5 style=solid arrowhead=none '
|
self.write( ' edge [len=0.5 style=solid arrowhead=none '
|
||||||
'arrowtail=normal fontsize=%d];\n' % self.fontsize )
|
'arrowtail=normal fontsize=%d];\n' % self.fontsize )
|
||||||
if self.fontfamily:
|
if self.fontfamily:
|
||||||
self.dot.write( ' node [style=filled fontname="%s" fontsize=%d];\n'
|
self.write( ' node [style=filled fontname="%s" fontsize=%d];\n'
|
||||||
% ( self.fontfamily, self.fontsize ) )
|
% ( self.fontfamily, self.fontsize ) )
|
||||||
else:
|
else:
|
||||||
self.dot.write( ' node [style=filled fontsize=%d];\n'
|
self.write( ' node [style=filled fontsize=%d];\n'
|
||||||
% self.fontsize )
|
% self.fontsize )
|
||||||
self.dot.write( '\n' )
|
self.write( '\n' )
|
||||||
|
|
||||||
|
def write(self, text):
|
||||||
|
self.dot.write(text.encode('iso-8859-1','xmlcharrefreplace'))
|
||||||
|
|
||||||
def open(self, filename):
|
def open(self, filename):
|
||||||
self.filename = os.path.normpath(os.path.abspath(filename))
|
self.filename = os.path.normpath(os.path.abspath(filename))
|
||||||
@ -195,14 +198,14 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc):
|
|||||||
actually generate a file.
|
actually generate a file.
|
||||||
"""
|
"""
|
||||||
if self.note:
|
if self.note:
|
||||||
self.dot.write( 'labelloc="%s";\n' % self.noteloc )
|
self.write( 'labelloc="%s";\n' % self.noteloc )
|
||||||
self.dot.write( 'label="' )
|
self.write( 'label="' )
|
||||||
for line in self.note:
|
for line in self.note:
|
||||||
self.dot.write( '%s\\n' % line.replace('"', '\\\"') )
|
self.write( '%s\\n' % line.replace('"', '\\\"') )
|
||||||
self.dot.write( '";\n')
|
self.write( '";\n')
|
||||||
self.dot.write( 'fontsize="%d";\n' % self.notesize )
|
self.write( 'fontsize="%d";\n' % self.notesize )
|
||||||
|
|
||||||
self.dot.write( '}' )
|
self.write( '}' )
|
||||||
|
|
||||||
def add_node(self, id, label, shape="", color = "",
|
def add_node(self, id, label, shape="", color = "",
|
||||||
style="", fillcolor="", url="" ):
|
style="", fillcolor="", url="" ):
|
||||||
@ -237,7 +240,7 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc):
|
|||||||
|
|
||||||
line += '];\n'
|
line += '];\n'
|
||||||
|
|
||||||
self.dot.write(line)
|
self.write(line)
|
||||||
|
|
||||||
def add_link(self, id1, id2, style="", head="", tail=""):
|
def add_link(self, id1, id2, style="", head="", tail=""):
|
||||||
"""
|
"""
|
||||||
@ -245,32 +248,32 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc):
|
|||||||
|
|
||||||
Implementes BaseDoc.GVDoc.add_link().
|
Implementes BaseDoc.GVDoc.add_link().
|
||||||
"""
|
"""
|
||||||
self.dot.write(' "%s" -> "%s"' % (id1, id2))
|
self.write(' "%s" -> "%s"' % (id1, id2))
|
||||||
|
|
||||||
if style or head or tail:
|
if style or head or tail:
|
||||||
self.dot.write(' [')
|
self.write(' [')
|
||||||
|
|
||||||
if style:
|
if style:
|
||||||
self.dot.write('style=%s' % style)
|
self.write('style=%s' % style)
|
||||||
if head:
|
if head:
|
||||||
if style:
|
if style:
|
||||||
self.dot.write(', ')
|
self.write(', ')
|
||||||
self.dot.write('arrowhead=%s' % head)
|
self.write('arrowhead=%s' % head)
|
||||||
if tail:
|
if tail:
|
||||||
if style or head:
|
if style or head:
|
||||||
self.dot.write(', ')
|
self.write(', ')
|
||||||
self.dot.write('arrowtail=%s' % tail)
|
self.write('arrowtail=%s' % tail)
|
||||||
|
|
||||||
self.dot.write(']')
|
self.write(']')
|
||||||
|
|
||||||
self.dot.write(';\n')
|
self.write(';\n')
|
||||||
|
|
||||||
def start_subgraph(self,id):
|
def start_subgraph(self,id):
|
||||||
self.dot.write(' subgraph cluster_%s\n' % id)
|
self.write(' subgraph cluster_%s\n' % id)
|
||||||
self.dot.write(' {\n')
|
self.write(' {\n')
|
||||||
|
|
||||||
def end_subgraph(self):
|
def end_subgraph(self):
|
||||||
self.dot.write(' }\n')
|
self.write(' }\n')
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user