Mercurial > fife-parpg
annotate engine/extensions/fife_compat.py @ 154:d29593182f40
- modified clicklabel to provide a mouse listener for hover events
- modified clicklabel.i to make new methods available for python
- added LabelListener to pychan wrapper, as well as two new methods to Label class to set enter / exit callbacks
NOTE:
author | chewie@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 11 Oct 2008 14:13:56 +0000 |
parents | 679ed3e15513 |
children | bb9902910067 |
rev | line source |
---|---|
151
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 """ |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 FIFE Backwards Combatibility Layer |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 ================================== |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
6 This module can be imported if you want to |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
7 run code that wasn't adapted to API changes in FIFE. |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
8 |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
9 2008.1 |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 ------ |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
11 |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 - Animation.addFrame now expects a fife.ResourcePtr instead of an fife.Image |
152
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
13 - Pool.getIndex is just an alias for Pool.addResourceFromFile. |
151
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
14 |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 """ |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
16 |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
17 import fife |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 |
152
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
19 # Utility functions |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
20 |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
21 def deprecated(revision,message): |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
22 print "fife_compat: Deprecation warning - See revision %d " % revision |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
23 print " - ",message |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
24 |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
25 def this_is_deprecated(func,revision=0,message=None): |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
26 if message is None: |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
27 message = repr(func) + " is deprecated." |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
28 def wrapped_func(*args,**kwargs): |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
29 deprecated(revision,message) |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
30 return func(*args,**kwargs) |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
31 return wrapped_func |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
32 |
151
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 # 2008.1 compatibility functions |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
35 def decorate_addFrame(f): |
152
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
36 |
151
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
37 def addFrame(self,image_ptr, delay): |
152
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
38 if not isinstance(image_ptr,fife.ResourcePtr): |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
39 image_ptr = fife.ResourcePtr(image_ptr) |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
40 deprecated(2616,"Animation.addFrame doesn't accept Image* anymore ") |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
41 return f(self,image_ptr,delay) |
151
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
42 return addFrame |
afcd83f7fac8
Backwards compatibility module fife_compat.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
43 |
152
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
44 fife.Animation.addFrame = decorate_addFrame(fife.Animation.addFrame) |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
45 fife.Pool.getIndex = this_is_deprecated( |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
46 fife.Pool.addResourceFromFile, |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
47 revision = 2617, |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
48 message = "Use addResourceFromFile instead of getIndex" |
679ed3e15513
Deprecation: getIndex is now thrown out.
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
151
diff
changeset
|
49 ) |