Ejemplo n.º 1
0
def get_dbus_method(method_name):
    dbus_loop = DBusGMainLoop()
    connection = BusConnection(mainloop=dbus_loop)
    bus_name = "org.gnome.SessionManager"
    object_path = "/org/gnome/SessionManager"
    session_object = connection.get_object(bus_name, object_path)
    interface = dbus.Interface(session_object, bus_name)
    method = interface.get_dbus_method(method_name)
    return method
Ejemplo n.º 2
0
def get_dbus_method(method_name):
    dbus_loop = DBusGMainLoop()
    connection = BusConnection(mainloop=dbus_loop)
    bus_name = "com.canonical.Unity"
    object_path = "/com/canonical/Unity/Session"
    session_object = connection.get_object(bus_name, object_path)
    interface = dbus.Interface(session_object, bus_name + ".Session")
    method = interface.get_dbus_method(method_name)
    return method
Ejemplo n.º 3
0
def get_bus(address_or_type=BusConnection.TYPE_SESSION):
    """ Returns a given bus, either from the local system or from a remote one, thanks to D-Bus TCP support.

    The parameter is used the same way as in D-Bus class :py:class:`BusConnection`. Refer to original
    documentation for details.

    :param address_or_type: request bus identification
    :return: the requested bus
    :rtype: BusConnection
    """
    os.environ.update(get_bus_config())
    return BusConnection(address_or_type)
Ejemplo n.º 4
0
def get_remote_bus(host, port):
    """ Returns a bus exposed by a remote host.

    This is a convenience wrapper of the :py:class:`BusConnection` create, building the bus address
    for a TCP connection.

    :param str host: host name or IP
    :param int port: port on which the remote host is listening
    :return: the requested bus
    :rtype: BusConnection
    """
    return BusConnection("tcp:host=%s,port=%d" % (host, port))
Ejemplo n.º 5
0
def main():
    file_path = Path("./ocean3.mp4")
    size = Size(800, 600)

    print("Starting streamer... ", flush=True)

    mainloop = GLib.MainLoop()
    DBusGMainLoop(set_as_default=True)

    bus = BusConnection(getenv("DBUS_ADDRESS") or DBUS_ADDRESS)
    bus_name = BusName(BUS_NAME, bus)

    StreamerObject(bus, bus_name, file_path, size)

    mainloop.run()
Ejemplo n.º 6
0
    def __init__(self, bus_address):
        """
        Register the org.freedesktop.Notifications service and an object implementing the corresponding interface
        on the given bus. Make sure that the org.freedesktop.Notifications service doesn't exist on the bus yet.

        :param bus_address:
            Address of the desired bus. D-BUS addresses are of the form 'unix:*=*'
        """
        # maximum notification ID is the biggest number that can be represented by 32 bits (uint32)
        self.__max_id = 4294967295
        # start notification IDs at 1 since 0 is not allowed
        self.__id_count = 1

        # get bus name of service on the defined bus connection and create service object
        self.__bus_name = dbus.service.BusName(self.service,
                                               bus=BusConnection(bus_address))
        self.__service_object = dbus.service.Object.__init__(
            self, self.__bus_name, self.object_path)
Ejemplo n.º 7
0
def main():
    size = Size(800, 600)

    mainloop = GLib.MainLoop()
    DBusGMainLoop(set_as_default=True)

    sleep(10)

    bus = BusConnection(getenv("DBUS_ADDRESS") or DBUS_ADDRESS)
    remote_object = bus.get_object(BUS_NAME, OBJECT_PATH)

    process = Popen(ffplay_command(size), stdin=PIPE)
    remote_object.connect_to_signal("FrameEmitted", partial(handle_frame, process.stdin), dbus_interface=DBUS_INTERFACE)
    remote_object.EmitFrames()

    #print(remote_object.Capitalize("hello world"))
    
    print("Starting player... ", flush=True)
    mainloop.run()