@classmethod
def post(cls):
super(QuitGameEvent, cls).post()
+
+
+class InvalidateTheWorld(NajaEvent):
+ # This is used to signal to all the widgets that the world has changed
+ # and cached state may need to be recreated
+ TYPE = "INVALIDATE"
+
+ @classmethod
+ def post(cls):
+ super(InvalidateTheWorld, cls).post()
import pygame
+from naja.events import InvalidateTheWorld
class Widget(object):
def handle_event(self, ev):
'''Return True if the event has been handled'''
+ if InvalidateTheWorld.matches(ev):
+ # Invalidate has special handling. Widgets should never return
+ # True for for this event
+ self._prepared = False
+ return False
return False