nettoyage / implémentation de la méthode update.
[minwii.git] / src / logging / PickleableEvent.py
1 import pygame
2 import copy
3 import pickle
4
5 from pygame.event import Event
6
7 class PickleableEvent(object):
8 "A pygame.Event that can be serialized."
9
10 def __init__(self,type,dict):
11 self.__dict__ = copy.copy(dict)
12 self.type = type
13 self.event = Event(self.type,dict)
14
15 def __getstate__(self):
16 d = []
17 d.append(self.type)
18 d.append(copy.copy(self.event.dict))
19 return d
20
21 def __setstate__(self, d):
22 self.__dict__ = copy.copy(d[1])
23 self.type = d[0]
24 self.event = Event(d[0],d[1])