[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r6053 - trunk/gnue-forms/src/uidrivers/gtk2
From: |
johannes |
Subject: |
r6053 - trunk/gnue-forms/src/uidrivers/gtk2 |
Date: |
Fri, 23 Jul 2004 07:56:15 -0500 (CDT) |
Author: johannes
Date: 2004-07-23 07:56:14 -0500 (Fri, 23 Jul 2004)
New Revision: 6053
Modified:
trunk/gnue-forms/src/uidrivers/gtk2/ErrorHandler.py
Log:
Fixed error handler
Modified: trunk/gnue-forms/src/uidrivers/gtk2/ErrorHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/ErrorHandler.py 2004-07-23 12:16:02 UTC
(rev 6052)
+++ trunk/gnue-forms/src/uidrivers/gtk2/ErrorHandler.py 2004-07-23 12:56:14 UTC
(rev 6053)
@@ -1,6 +1,9 @@
+# GNU Enterprise Forms - GTK UI driver - Errorhandler
#
-# This file is part of GNU Enterprise.
+# Copyright 2001-2004 Free Software Foundation
#
+# This file is part of GNU Enterprise
+#
# GNU Enterprise is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
@@ -16,83 +19,70 @@
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
-# Copyright 2000-2004 Free Software Foundation
-#
-# FILE:
-# gtk2/ErrorHandler.py
-#
-# DESCRIPTION:
-# Standart Error and Exception handler
-#
-# NOTES:
-#
+# $Id$
-import string, sys
import gtk
+import sys
-from gnue.common.utils.TextUtils import lineWrap
-#from GFwxApp import getWxApp
-def handleStartupError(errortext):
+# -----------------------------------------------------------------------------
+# Handle an error on startup of an application
+# -----------------------------------------------------------------------------
+
+def handleStartupError (errortext):
print
print '-' * 60
- print _("Error: %s") % errortext
+ print u_("Error: %s") % errortext
print '-' * 60
- print
+ _StartupErrorDisplay ("%s" % errortext)
- _StartupErrorDisplay(str(errortext))
sys.exit()
-def handleUncaughtException(extype, exvalue, traceback):
+def handleUncaughtException (extype, exvalue, traceback):
# If we throw an exception, we don't want circular calls
sys.excepthook = sys._orig_excepthook
- _ExceptionDisplay(extype, exvalue, traceback)
+ _ExceptionDisplay (extype, exvalue, traceback)
# Restore exception handler
sys.excepthook = handleUncaughtException
-#
-#
-#
-class _StartupErrorDisplay(gtk.MessageDialog):
+# =============================================================================
+# This class provides a message box for startup errors
+# =============================================================================
+
+class _StartupErrorDisplay (gtk.MessageDialog):
def __init__(self, errortext):
- message = _('Unable to start GNUe Forms:') + '\n\n %s' % errortext
+ message = u_('Unable to start GNUe Forms:\n\n%s') % errortext
- message = lineWrap(message,60)
-
- gtk.MessageDialog.__init__(self, None, gtk.DIALOG_MODAL|\
- gtk.DIALOG_DESTROY_WITH_PARENT, \
- gtk.MESSAGE_ERROR,\
- gtk.BUTTONS_CLOSE, message)
- self.show_all()
- self.connect('response',lambda dialog, \
-# response: self.destroy())
- response: gtk.mainquit())
+ gtk.MessageDialog.__init__ (self, None,
+ gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+ gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, message)
- gtk.main()
+ self.show_all ()
+ self.connect ('response', lambda dialog, response: gtk.mainquit ())
+ gtk.main ()
-#
-#
-#
-class _ExceptionDisplay(gtk.MessageDialog):
+
+# =============================================================================
+# This class provides a message box for uncaught exceptions
+# =============================================================================
+
+class _ExceptionDisplay (gtk.MessageDialog):
def __init__(self, extype, exvalue, traceback):
- message = _('Exception occured in GNUe Forms:') + \
- '\n\n Type %s' % extype +\
- '\n Value %s' % exvalue
-
- message = lineWrap(message,60)
-
- gtk.MessageDialog.__init__(self, None, gtk.DIALOG_MODAL|\
- gtk.DIALOG_DESTROY_WITH_PARENT, \
- gtk.MESSAGE_ERROR, \
- gtk.BUTTONS_CLOSE, message)
- self.show_all()
- self.connect('response',lambda dialog, \
- response: self.dialog.destroy())
+ message = u_("Exception occured in GNUe Forms:\n\n"
+ "Type %(type)s\nValue %(value)s") \
+ % {'type': extype,
+ 'value': exvalue}
+
+ gtk.MessageDialog.__init__ (self, None,
+ gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+ gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, message)
+ self.show_all ()
+ self.connect ('response', lambda dialog, response: dialog.destroy ())
Property changes on: trunk/gnue-forms/src/uidrivers/gtk2/ErrorHandler.py
___________________________________________________________________
Name: svn:keywords
+ Id
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r6053 - trunk/gnue-forms/src/uidrivers/gtk2,
johannes <=