def _keyboard_push_key_cb(self, instance, key): if key & 0x80: SpiceClientGLib.inputs_key_release(self._inputs_channel, key & ~0x80) else: SpiceClientGLib.inputs_key_press(self._inputs_channel, key)
lambda a, b: opened_event.set()) char_device_instance.port_event(SpiceServerGLib.PortEvent.OPENED) await opened_event.wait() # When port_channel.write_async(b"efghi", None, lambda s, r, u: port_channel.write_finish(r), None) await write_event.wait() # Then self.assertEqual(b"efghi", written_data.get_data()) # XXX Temporary: patch SpiceClientGLib.PortChannel if method-name fix has not been applied if not hasattr(SpiceClientGLib.PortChannel, "event"): SpiceClientGLib.PortChannel.event = lambda self, a: SpiceClientGLib.port_event( self, a) SpiceClientGLib.PortChannel.write_async = lambda self, a, b, c, d: SpiceClientGLib.port_write_async( self, a, b, c, d) SpiceClientGLib.PortChannel.write_finish = lambda self, a: SpiceClientGLib.port_write_finish( self, a) if not hasattr(SpiceClientGLib.InputsChannel, "position"): SpiceClientGLib.InputsChannel.position = lambda self, a, b, c, d: SpiceClientGLib.inputs_position( self, a, b, c, d) SpiceClientGLib.InputsChannel.key_press = lambda self, a: SpiceClientGLib.inputs_key_press( self, a) if __name__ == "__main__": unittest.main()