1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """
25 FIFE Backwards Combatibility Layer
26 ==================================
27
28 This module can be imported if you want to
29 run code that wasn't adapted to API changes in FIFE.
30
31 2008.1
32 ------
33
34 - Animation.addFrame now expects a fife.ResourcePtr instead of an fife.Image
35 - Pool.getIndex is just an alias for Pool.addResourceFromFile.
36 - EventManager.setNonConsumableKeys is superseeded by EventManager.setKeyFilter
37
38 """
39 from __future__ import print_function
40
41 from fife import fife
42
43
44
46 print("fife_compat: Deprecation warning - See revision %d " % revision)
47 print(" - ",message)
48
50 if message is None:
51 message = repr(func) + " is deprecated."
52 def wrapped_func(*args,**kwargs):
53 deprecated(revision,message)
54 return func(*args,**kwargs)
55 return wrapped_func
56
62
63 def isFiltered(self, event):
64 return event.getKey().getValue() in self.keys
65
66 def _setNonConsumableKeys(self,keys):
67 deprecated(2636, "Write an IKeyFilter instead of using EventManager.setNonConsumableKeys.\n" +
68 "You probably don't need it anyway")
69 self.compat_keyfilter = CompatKeyFilter(keys)
70 self.compat_keyfilter.__disown__()
71 self.setKeyFilter(self.compat_keyfilter)
72
73 def _getNonConsumableKeys(self,keys):
74 deprecated(2636, "Write an IKeyFilter instead of using EventManager.getNonConsumableKeys.")
75 return self.compat_keyfilter.keys
76
77 fife.EventManager.setNonConsumableKeys = _setNonConsumableKeys
78 fife.EventManager.getNonConsumableKeys = _getNonConsumableKeys
79
80 _compat_NonConsumableKeys()
81