diff --git a/src/Errors.py b/src/Errors.py index cb3307382..66139bed4 100644 --- a/src/Errors.py +++ b/src/Errors.py @@ -21,6 +21,7 @@ class ReportError(Exception): """Error used to report Report errors""" def __init__(self,value): + Exception.__init__(self) self.value = value def __str__(self): @@ -29,6 +30,7 @@ class ReportError(Exception): class GedcomError(Exception): """Error used to report GEDCOM errors""" def __init__(self,value): + Exception.__init__(self) self.value = value def __str__(self): @@ -37,6 +39,7 @@ class GedcomError(Exception): class PluginError(Exception): """Error used to report plugin errors""" def __init__(self,value): + Exception.__init__(self) self.value = value def __str__(self): diff --git a/src/GenericFilter.py b/src/GenericFilter.py index 28453190c..52f79beda 100644 --- a/src/GenericFilter.py +++ b/src/GenericFilter.py @@ -774,7 +774,7 @@ class GenericFilterList: except: return - f.write("\n") + f.write("\n") f.write('\n') for i in self.filter_list: f.write(' \n') self.f.write('\n') - tar = TarFile(self.filename) + try: + tar = TarFile(self.filename) + except IOError, msg: + text = _("Could not open %s") % self.filename + Errors.ReportError(text + "\n" + str(msg)) + return + except: + Errors.ReportError(_("Could not open %s") % self.filename) + return + tar.add_file("documentinfo.xml",self.mtime,self.m) tar.add_file("maindoc.xml",self.mtime,self.f) for file in self.photo_list: diff --git a/src/docgen/OpenOfficeDoc.py b/src/docgen/OpenOfficeDoc.py index 5d3938ec0..b8a03fc45 100644 --- a/src/docgen/OpenOfficeDoc.py +++ b/src/docgen/OpenOfficeDoc.py @@ -71,6 +71,8 @@ class OpenOfficeDoc(TextDoc.TextDoc): self.filename = filename + ".sxw" else: self.filename = filename + + self.filename = os.path.normpath(os.path.abspath(filename)) try: self.content_xml = tempfile.mktemp() diff --git a/src/plugins/AncestorChart.py b/src/plugins/AncestorChart.py index 8326fefd7..60aba1ee7 100644 --- a/src/plugins/AncestorChart.py +++ b/src/plugins/AncestorChart.py @@ -46,6 +46,7 @@ import TextDoc import Report import Errors import FontScale +from QuestionDialog import ErrorDialog from SubstKeywords import SubstKeywords from intl import gettext as _ @@ -255,6 +256,8 @@ class AncestorChartDialog(Report.DrawReportDialog): MyReport = AncestorChart(self.db, self.person, self.target_path, self.max_gen, self.doc, self.report_text) MyReport.write_report() + except Errors.ReportError, msg: + ErrorDialog(str(msg)) except: import DisplayTrace DisplayTrace.DisplayTrace() diff --git a/src/plugins/AncestorReport.py b/src/plugins/AncestorReport.py index 7ad5e900b..45a756bda 100644 --- a/src/plugins/AncestorReport.py +++ b/src/plugins/AncestorReport.py @@ -28,14 +28,6 @@ import os import string -#------------------------------------------------------------------------ -# -# GNOME/GTK -# -#------------------------------------------------------------------------ -import gtk -import gnome.ui - #------------------------------------------------------------------------ # # gramps modules @@ -44,6 +36,8 @@ import gnome.ui import Report import TextDoc import RelLib +import Errors +from QuestionDialog import ErrorDialog from intl import gettext as _ #------------------------------------------------------------------------ @@ -60,11 +54,7 @@ class AncestorReport(Report.Report): self.max_generations = max self.pgbrk = pgbrk self.doc = doc - - try: - self.doc.open(output) - except IOError,msg: - gnome.ui.GnomeErrorDialog(_("Could not open %s") % output + "\n" + msg) + self.doc.open(output) def filter(self,person,index): if person == None or index >= (1 << 30): @@ -277,11 +267,12 @@ class AncestorReportDialog(Report.TextReportDialog): MyReport = AncestorReport(self.db, self.person, self.target_path, self.max_gen, self.doc, self.pg_brk) MyReport.write_report() + except Errors.ReportError, msg: + ErrorDialog(str(msg)) except: import DisplayTrace DisplayTrace.DisplayTrace() - #------------------------------------------------------------------------ # # diff --git a/src/plugins/DesGraph.py b/src/plugins/DesGraph.py index 6f00e14b4..fe1cee9e1 100644 --- a/src/plugins/DesGraph.py +++ b/src/plugins/DesGraph.py @@ -48,6 +48,7 @@ import Errors from SubstKeywords import SubstKeywords from intl import gettext as _ +from QuestionDialog import ErrorDialog #------------------------------------------------------------------------ # @@ -341,6 +342,8 @@ class DescendantReportDialog(Report.DrawReportDialog): MyReport = DescendantReport(self.db,self.report_text, self.person, self.target_path, self.doc) MyReport.write_report() + except Errors.ReportError, msg: + ErrorDialog(str(msg)) except: import DisplayTrace DisplayTrace.DisplayTrace() diff --git a/src/plugins/DescendReport.py b/src/plugins/DescendReport.py index a19cdff9d..86f9cbe35 100644 --- a/src/plugins/DescendReport.py +++ b/src/plugins/DescendReport.py @@ -36,6 +36,9 @@ import string #------------------------------------------------------------------------ import Report import TextDoc +import Errors + +from QuestionDialog import ErrorDialog from intl import gettext as _ #------------------------------------------------------------------------ @@ -161,6 +164,8 @@ class DescendantReportDialog(Report.TextReportDialog): MyReport.setup() MyReport.report() MyReport.end() + except Errors.ReportError, msg: + ErrorDialog(str(msg)) except: import DisplayTrace DisplayTrace.DisplayTrace() diff --git a/src/plugins/DetAncestralReport.py b/src/plugins/DetAncestralReport.py index 823481d6a..dc684acce 100644 --- a/src/plugins/DetAncestralReport.py +++ b/src/plugins/DetAncestralReport.py @@ -1,4 +1,3 @@ - # # Gramps - a GTK+/GNOME based genealogy program # @@ -24,7 +23,10 @@ import RelLib import os import sort +import Errors + from intl import gettext as _ +from QuestionDialog import ErrorDialog from Report import * from TextDoc import * @@ -733,10 +735,15 @@ class DetAncestorReportDialog(TextReportDialog): """Create the object that will produce the Detailed Ancestral Report. All user dialog has already been handled and the output file opened.""" - MyReport = DetAncestorReport(self.db, self.person, self.target_path, - self.max_gen, self.pg_brk, self.doc) - MyReport.write_report() - + try: + MyReport = DetAncestorReport(self.db, self.person, self.target_path, + self.max_gen, self.pg_brk, self.doc) + MyReport.write_report() + except Errors.ReportError, msg: + ErrorDialog(str(msg)) + except: + import DisplayTrace + DisplayTrace.DisplayTrace() #------------------------------------------------------------------------ # diff --git a/src/plugins/DetDescendantReport.py b/src/plugins/DetDescendantReport.py index 7e42f2146..80e6582e5 100644 --- a/src/plugins/DetDescendantReport.py +++ b/src/plugins/DetDescendantReport.py @@ -26,11 +26,13 @@ import os import sort from intl import gettext as _ +import Errors from Report import * from TextDoc import * import gtk import gnome.ui +from QuestionDialog import ErrorDialog #------------------------------------------------------------------------ # @@ -761,10 +763,15 @@ class DetDescendantReportDialog(TextReportDialog): """Create the object that will produce the Detailed Ancestral Report. All user dialog has already been handled and the output file opened.""" - MyReport = DetDescendantReport(self.db, self.person, self.target_path, - self.max_gen, self.pg_brk, self.doc) - MyReport.write_report() - + try: + MyReport = DetDescendantReport(self.db, self.person, self.target_path, + self.max_gen, self.pg_brk, self.doc) + MyReport.write_report() + except Errors.ReportError, msg: + ErrorDialog(str(msg)) + except: + import DisplayTrace + DisplayTrace.DisplayTrace() def add_user_options(self): diff --git a/src/plugins/FamilyGroup.py b/src/plugins/FamilyGroup.py index 31f106153..b85e9bc26 100644 --- a/src/plugins/FamilyGroup.py +++ b/src/plugins/FamilyGroup.py @@ -35,7 +35,9 @@ import os import RelLib import Report import TextDoc +import Errors from intl import gettext as _ +from QuestionDialog import ErrorDialog #------------------------------------------------------------------------ # @@ -438,9 +440,15 @@ class FamilyGroupDialog(Report.TextReportDialog): """Create the object that will produce the Ancestor Chart. All user dialog has already been handled and the output file opened.""" - MyReport = FamilyGroup(self.db, self.report_menu, self.target_path, self.doc) - MyReport.setup() - MyReport.write_report() + try: + MyReport = FamilyGroup(self.db, self.report_menu, self.target_path, self.doc) + MyReport.setup() + MyReport.write_report() + except Errors.ReportError, msg: + ErrorDialog(str(msg)) + except: + import DisplayTrace + DisplayTrace.DisplayTrace() #------------------------------------------------------------------------ # diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index a5f1cede9..cd4f959cf 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -37,6 +37,8 @@ import TextDoc import StyleEditor import Report import GenericFilter +import Errors +from QuestionDialog import ErrorDialog from intl import gettext as _ #------------------------------------------------------------------------ @@ -532,10 +534,17 @@ class IndivSummaryDialog(Report.TextReportDialog): opened.""" act = self.use_srcs.get_active() - MyReport = IndivComplete(self.db, self.person, self.target_path, - self.doc, self.filter, act) - MyReport.setup() - MyReport.write_report() + try: + MyReport = IndivComplete(self.db, self.person, self.target_path, + self.doc, self.filter, act) + MyReport.setup() + MyReport.write_report() + except Errors.ReportError, msg: + ErrorDialog(str(msg)) + except: + import DisplayTrace + DisplayTrace.DisplayTrace() + def get_report_generations(self): """Return the default number of generations to start the diff --git a/src/plugins/IndivSummary.py b/src/plugins/IndivSummary.py index 39085fc2b..4cca6bfa3 100644 --- a/src/plugins/IndivSummary.py +++ b/src/plugins/IndivSummary.py @@ -45,6 +45,8 @@ import const import TextDoc import StyleEditor import Report +import Errors +from QuestionDialog import ErrorDialog from intl import gettext as _ #------------------------------------------------------------------------ @@ -373,9 +375,15 @@ class IndivSummaryDialog(Report.TextReportDialog): """Create the object that will produce the Ancestor Chart. All user dialog has already been handled and the output file opened.""" - MyReport = IndivSummary(self.db, self.person, self.target_path, self.doc) - MyReport.setup() - MyReport.write_report() + try: + MyReport = IndivSummary(self.db, self.person, self.target_path, self.doc) + MyReport.setup() + MyReport.write_report() + except Errors.ReportError, msg: + ErrorDialog(str(msg)) + except: + import DisplayTrace + DisplayTrace.DisplayTrace() #------------------------------------------------------------------------ #