From 7eb354d22c8721b29d6835361c6d83142c036afb Mon Sep 17 00:00:00 2001 From: ccremers Date: Thu, 14 Dec 2006 14:08:08 +0000 Subject: [PATCH] - Correction to previous commit: added required files. --- gui/Gui/Error.py | 21 +++++++++++++++++++ gui/Scyther/Error.py | 49 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 gui/Gui/Error.py create mode 100644 gui/Scyther/Error.py diff --git a/gui/Gui/Error.py b/gui/Gui/Error.py new file mode 100644 index 0000000..8916b7e --- /dev/null +++ b/gui/Gui/Error.py @@ -0,0 +1,21 @@ +#!/usr/bin/python + +#--------------------------------------------------------------------------- + +""" Import externals """ +import wx +import sys + +#--------------------------------------------------------------------------- + +""" Import scyther-gui components """ + +#--------------------------------------------------------------------------- + +def ShowAndExit(text): + title = "Error" + dlg = wx.MessageDialog(None, text, title, wx.ID_OK | wx.ICON_ERROR) + result = dlg.ShowModal() + dlg.Destroy() + sys.exit() + diff --git a/gui/Scyther/Error.py b/gui/Scyther/Error.py new file mode 100644 index 0000000..c512163 --- /dev/null +++ b/gui/Scyther/Error.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +# +# Scyther interface error classes +# + +#--------------------------------------------------------------------------- + +class Error(Exception): + """Base class for exceptions in this module.""" + pass + +class InputError(Error): + """Exception raised for errors in the input. + + Attributes: + expression -- input expression in which the error occurred + message -- explanation of the error + """ + + def __init__(self, expression, message): + self.expression = expression + self.message = message + +class BinaryError(Error): + """Raised when the Scyther executable is not found. + + Attributes: + file -- file location at which we should have been able to find it. + """ + + def __init__(self, file): + self.file = file + + def __str__(self): + return "Could not find Scyther executable at '%s'" % (self.file) + + +class UnknownPlatformError(Error): + """Raised when the platform is not supported yet. + + Attributes: + platform -- string describing the platform. + """ + + def __init__(self, platform): + self.platform = platform + + def __str__(self): + return "The %s platform is currently unsupported." % self.platform