From ad372bbdcdf148c9041a02779ebf9a7ab797e246 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 18 Aug 2009 12:52:06 +0100 Subject: [PATCH] Make a generic graphical error function --- terminatorlib/util.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/terminatorlib/util.py b/terminatorlib/util.py index 6ff3521f..eb08b4ab 100755 --- a/terminatorlib/util.py +++ b/terminatorlib/util.py @@ -21,11 +21,21 @@ import sys # set this to true to enable debugging output DEBUG = True -def dbg (log = ""): +def dbg(log = ""): """Print a message if debugging is enabled""" if DEBUG: print >> sys.stderr, log -def err (log = ""): +def err(log = ""): """Print an error message""" print >> sys.stderr, log + +def gerr(message = None): + """Display a graphical error. This should only be used for serious + errors as it will halt execution""" + + import gtk + dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, + gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message) + dialog.run() +