def setUpClass(cls): super(TestMessageDecorated, cls).setUpClass() handler = EchoHandlerDecorator() conn = GEventDBusConnection(DBUS_BUS_SESSION) conn.add_handler(handler) cls.server_name = conn.get_unique_name() cls.client = GEventDBusConnection(DBUS_BUS_SESSION)
</method> <!-- Add more methods/signals if you want --> </interface> </node>""" self.set_response("s", [xml]) conn = GEventDBusConnection(DBUS_BUS_SESSION) handler = GEventHandler() conn.add_handler(handler) print('Listening for signals, with gevent dispatcher.') print('In another terminal, issue:') print() print( ' $ dbus-send --session --type=signal --dest={} /com/example/TDBus com.example.Hello.Hello' .format(conn.get_unique_name())) print( ' $ dbus-send --session --print-reply --type=method_call --dest={} /com/example/TDBus com.example.Hello.HelloMethod' .format(conn.get_unique_name())) print() print('Press CTRL-c to exit.') print() from gevent.hub import get_hub try: get_hub().switch() except KeyboardInterrupt: pass
def test_get_unique_name(self): conn = GEventDBusConnection(DBUS_BUS_SESSION) name = conn.get_unique_name() assert name.startswith(':') conn.close()
</method> <signal name="Hello"> <arg type="as" name="arrayofstrings" direction="in" /> </signal> <!-- Add more methods/signals if you want --> </interface> </node>""" self.set_response("s", [xml]) conn = GEventDBusConnection(DBUS_BUS_SESSION) handler = GEventHandler() conn.add_handler(handler) print 'Listening for signals, with gevent dispatcher.' print 'In another terminal, issue:' print print ' $ dbus-send --session --type=signal --dest={} /com/example/TDBus com.example.Hello.Hello'.format(conn.get_unique_name()) print ' $ dbus-send --session --print-reply --type=method_call --dest={} /com/example/TDBus com.example.Hello.HelloMethod'.format(conn.get_unique_name()) print print 'Press CTRL-c to exit.' print from gevent.hub import get_hub try: get_hub().switch() except KeyboardInterrupt: pass
<signal name="Hello"> <arg type="as" name="arrayofstrings" direction="in" /> </signal> <!-- Add more methods/signals if you want --> </interface> </node>""" self.set_response("s", [xml]) conn = GEventDBusConnection(DBUS_BUS_SESSION) handler = GEventHandler() conn.add_handler(handler) print 'Listening for signals, with gevent dispatcher.' print 'In another terminal, issue:' print print ' $ dbus-send --session --type=signal --dest={} /com/example/TDBus com.example.Hello.Hello'.format( conn.get_unique_name()) print ' $ dbus-send --session --print-reply --type=method_call --dest={} /com/example/TDBus com.example.Hello.HelloMethod'.format( conn.get_unique_name()) print print 'Press CTRL-c to exit.' print from gevent.hub import get_hub try: get_hub().switch() except KeyboardInterrupt: pass