Mercurial > fife-parpg
comparison engine/extensions/pychan/tools.py @ 129:9a1529f9625e
* Indentation patch by GreyGhost
author | mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 07 Aug 2008 15:46:46 +0000 |
parents | 4a0efb7baf70 |
children | 31718fa356f8 |
comparison
equal
deleted
inserted
replaced
128:6e1fd3571440 | 129:9a1529f9625e |
---|---|
26 | 26 |
27 def callbackWithArguments(callback,*args,**kwargs): | 27 def callbackWithArguments(callback,*args,**kwargs): |
28 """ | 28 """ |
29 Curries a function with extra arguments to | 29 Curries a function with extra arguments to |
30 create a suitable callback. | 30 create a suitable callback. |
31 | 31 |
32 If you don't know what this means, don't worry. | 32 If you don't know what this means, don't worry. |
33 It is designed for the case where you need | 33 It is designed for the case where you need |
34 different buttons to execute basically the same code | 34 different buttons to execute basically the same code |
35 with different argumnets. | 35 with different argumnets. |
36 | 36 |
37 Usage:: | 37 Usage:: |
38 # The target callback | 38 # The target callback |
39 def printStuff(text): | 39 def printStuff(text): |
40 print text | 40 print text |
41 # Mapping the events | 41 # Mapping the events |
46 """ | 46 """ |
47 def real_callback(): | 47 def real_callback(): |
48 callback(*args,**kwargs) | 48 callback(*args,**kwargs) |
49 return real_callback | 49 return real_callback |
50 | 50 |
51 | |
52 def this_is_deprecated(func,message=None): | 51 def this_is_deprecated(func,message=None): |
53 if message is None: | 52 if message is None: |
54 message = repr(func) | 53 message = repr(func) |
55 def wrapped_func(*args,**kwargs): | 54 def wrapped_func(*args,**kwargs): |
56 print "PyChan: You are using the DEPRECATED functionality: %s" % message | 55 print "PyChan: You are using the DEPRECATED functionality: %s" % message |