def libjoystick(experiment, **kwargs): """ A factory that returns a back-end specific joystick module. Arguments: experiment -- The experiment object. Keyword arguments: **kwargs -- A keyword-argument dictionary. """ if experiment.get(u'canvas_backend') == u'psycho': raise osexception( u'The joystick plug-in does not yet support the psycho back-end') backend = u'legacy' cls = plugins.load_cls(__file__, cls=backend, mod=backend, pkg=u'_libjoystick') return cls(experiment, **kwargs)
def libjoystick(experiment, **kwargs): """ desc: A factory that returns a back-end specific joystick module. arguments: experiment: The experiment object. keyword-dict: kwargs: Keyords to be passed on the joystick init. """ if experiment.var.canvas_backend == u'psycho': raise osexception( u'The joystick plug-in does not yet support the psycho back-end') backend = u'legacy' cls = plugins.load_cls(__file__, cls=backend, mod=backend, pkg=u'_libjoystick') return cls(experiment, **kwargs)
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenSesame. If not, see <http://www.gnu.org/licenses/>. """ import pygame from pygame.locals import * from pygame.joystick import Joystick from libopensesame.exceptions import osexception from libopensesame import plugins basejoystick = plugins.load_cls(__file__, cls=u'basejoystick', mod=u'basejoystick') class legacy(basejoystick): def __init__(self, experiment, device=0, joybuttonlist=None, timeout=None): """See _libjoystick.basejoystick""" self.js = pygame.joystick.Joystick(device) self.js.init() self.experiment = experiment self.set_joybuttonlist(joybuttonlist) self.set_timeout(timeout) def get_joybutton(self, joybuttonlist=None, timeout=None):
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenSesame. If not, see <http://www.gnu.org/licenses/>. """ from libopensesame.py3compat import * import pygame from pygame.locals import * from pygame.joystick import Joystick from libopensesame.exceptions import osexception from libopensesame import plugins basejoystick = plugins.load_cls(__file__, cls=u"basejoystick", mod=u"basejoystick") class legacy(basejoystick): def __init__(self, experiment, device=0, joybuttonlist=None, timeout=None): """See _libjoystick.basejoystick""" self.js = pygame.joystick.Joystick(device) self.js.init() self.experiment = experiment self.set_joybuttonlist(joybuttonlist) self.set_timeout(timeout) def get_joybutton(self, joybuttonlist=None, timeout=None):