For those of you using my exception dialog, I would like to share with
you this fix, which solves some very annoying problems of spawning many
exception dialogs at the same time.

  Regards.

-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
--- ChangeLog	28 Sep 2003 17:21:03 -0000	1.139
+++ ChangeLog	28 Sep 2003 18:10:54 -0000
@@ -1,6 +1,11 @@
 2003-09-28  Gustavo J. A. M. Carneiro  <[EMAIL PROTECTED]>
 
+	* src/common/gtkexcepthook.py: Don't display more than one
+	exception dialog at the same time.  If more exceptions occur from
+	the gtk main loop, use the standard exception handler instead of
+	displaying dozens of new windows.
+
 	* src/xygraph/Numexp_XYGraph/control.py
 	(XYGraphControl.selection_changed): Use "1" instead of "True" and
 	"0" instead of "False", otherwise bonobo.ui doesn't understand the
--- src/common/gtkexcepthook.py	28 Aug 2003 19:49:15 -0000	1.2
+++ src/common/gtkexcepthook.py	28 Sep 2003 18:10:54 -0000
@@ -4,7 +4,16 @@ from gettext import gettext as _
 from cStringIO import *
 import traceback
 
+_exception_in_progress = 0
+
 def _info(type, value, tb):
+    global _exception_in_progress
+    if _exception_in_progress:
+	# Exceptions have piled up, so we use the default exception
+	# handler for such exceptions
+	_excepthook_save(type, value, tb)
+	return
+    _exception_in_progress = 1
     dialog = gtk.MessageDialog(parent=None,
 			       flags=0,
 			       type=gtk.MESSAGE_WARNING,
@@ -48,8 +57,10 @@ def _info(type, value, tb):
 	    dialog.action_area.get_children()[1].set_sensitive(0)
 	else: break
     dialog.destroy()
+    _exception_in_progress = 0
     
 
+_excepthook_save = sys.excepthook
 sys.excepthook = _info
 
 
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to