Author: KirkMcDonald
Date: 2008-01-05 01:10:43 +0000 (Sat, 05 Jan 2008)
New Revision: 752

Modified:
   trunk/pysoy/src/controllers/Keyboard.pxi
Log:
Allow raw callables to be assigned to Keyboard controller.

Modified: trunk/pysoy/src/controllers/Keyboard.pxi
===================================================================
--- trunk/pysoy/src/controllers/Keyboard.pxi    2008-01-05 01:00:29 UTC (rev 
751)
+++ trunk/pysoy/src/controllers/Keyboard.pxi    2008-01-05 01:10:43 UTC (rev 
752)
@@ -84,7 +84,9 @@
  
   def __setitem__(self, key, value) :
     if not isinstance(value, soy.actions.Action) :
-      raise TypeError('value not an instance of soy.actions.Action')
+      if not hasattr(value, '__call__'):
+        raise TypeError('value not either callable or an instance of 
soy.actions.Action')
+      value = soy.actions.Callback(value)
     if type(key) == str and len(key)==1 :
       if self._acts_keysym[ord(key)] :
         py.Py_DECREF(<soy.actions.Action> self._acts_keysym[ord(key)])

_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to