diff engine/extensions/pychan/events.py @ 255:51cc05d862f2

Merged editor_rewrite branch to trunk. This contains changes that may break compatibility against existing clients. For a list of changes that may affect your client, see: http://wiki.fifengine.de/Changes_to_pychan_and_FIFE_in_editor_rewrite_branch
author cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 08 Jun 2009 16:00:02 +0000
parents 92c7ce181881
children 48c99636453e
line wrap: on
line diff
--- a/engine/extensions/pychan/events.py	Wed Jun 03 19:29:52 2009 +0000
+++ b/engine/extensions/pychan/events.py	Mon Jun 08 16:00:02 2009 +0000
@@ -46,6 +46,7 @@
 import tools
 import traceback
 import weakref
+import fife_timer as timer
 
 EVENTS = [
 	"mouseEntered",
@@ -132,7 +133,9 @@
 			if name in self.events:
 				if self.debug: print "-"*self.indent, name
 				for f in self.events[name].itervalues():
-					f( event )
+					def delayed_f():
+						f( event )
+					timer.delayCall(0,delayed_f)
 
 		except:
 			print name, repr(event)
@@ -279,9 +282,9 @@
 			
 		self.callbacks[group_name][event_name] = callback
 			
-		
 		def captured_f(event):
-			tools.applyOnlySuitable(self_ref().callbacks[group_name][event_name],event=event,widget=self_ref().widget_ref())
+			if self_ref() is not None:
+				tools.applyOnlySuitable(self_ref().callbacks[group_name][event_name],event=event,widget=self_ref().widget_ref())
 
 		listener = self.getListener(event_name)