* src/plugins/GraphViz.py (GraphViz.__init__): Better error handling.

svn: r7052
This commit is contained in:
Alex Roitman 2006-07-20 19:49:27 +00:00
parent f3fed49b9f
commit 705f6e2365
2 changed files with 14 additions and 20 deletions

View File

@ -1,4 +1,5 @@
2006-07-20 Alex Roitman <shura@gramps-project.org>
* src/plugins/GraphViz.py (GraphViz.__init__): Better error handling.
* src/plugins/IndivComplete.py: Use NameDisplay.
* src/plugins/FamilyGroup.py: Use NameDisplay.
* src/GrampsCfg.py (add_name_panel): Minor UI improvements;

View File

@ -244,30 +244,23 @@ class GraphViz:
the_buffer = self.get_report()
encoding_problem = False
try:
self.f = open(options_class.get_output(),'w')
self.f.write(the_buffer)
except UnicodeEncodeError:
if self.latin:
self.f = open(options_class.get_output(),'w')
if self.latin:
try:
self.f.write(the_buffer.encode('iso-8859-1', 'strict'))
except UnicodeEncodeError:
self.f = open(options_class.get_output(),'w')
self.f.write(the_buffer.encode('iso-8859-1', 'replace'))
encoding_problem = True
else:
raise Errors.ReporError(
_("Your data contains characters that cannot "
"be displayed. Most likely this is caused "
"by the incorrect character encoding."))
ErrorDialog(
_("Your data contains characters that cannot be "
"converted to latin-1. These characters were "
"replaced with the question marks in the output. "
"To get these characters properly displayed, "
"unselect latin-1 option and try again."))
else:
self.f.write(the_buffer)
self.f.close()
if encoding_problem:
ErrorDialog(
_("Your data contains characters that cannot be "
"converted to latin-1. These characters were "
"replaced with the question marks in the output. "
"To get these characters properly displayed, "
"unselect latin-1 option and try again."))
def get_report(self):
"return string of the .dot file contents"
self.person_handles = self.filter.apply(self.database,