Package screenlets :: Module services :: Class ScreenletService
[hide private]
[frames] | no frames]

Class ScreenletService

source code

            object --+        
                     |        
dbus.service.Interface --+    
                         |    
       dbus.service.Object --+
                             |
                            ScreenletService

The ScreenletService contains the boilerplate code for creating new dbus-objects for Screenlets. Subclasses can easily implement new functions to allow controlling and managing Screenlets through DBus in any way imaginable. This class should implement the default actions available for all screenlets - add, delete, get, set, (move?)

Nested Classes [hide private]

Inherited from dbus.service.Interface: __metaclass__

Instance Methods [hide private]
 
__init__(self, screenlet, name, id=None)
Constructor.
source code
 
test(self) source code
 
debug(self, string)
Dump a string to the console.
source code
 
add(self, id)
Ask the assigned Screenlet to add a new instance of itself to its session.
source code
 
get(self, id, attrib)
Ask the assigned Screenlet to return the given attribute's value.
source code
 
get_first_instance(self)
Get the ID of the first existing instance of the assigned Screenlet (within the screenlet's active session).
source code
 
list_instances(self)
Return a list with IDs of all existing instances of the assigned Screenlet (within the screenlet's active session).
source code
 
quit(self)
Quit all instances of the screenlet.
source code
 
set(self, id, attrib, value)
Ask the assigned Screenlet to set the given attribute to 'value'.
source code
 
instance_added(self, *args, **keywords)
This signal gets emitted whenever a new instance of the assigned Screenlet gets added.
 
instance_removed(self, *args, **keywords)
This signal gets emitted whenever an instance of the assigned Screenlet gets removed.

Inherited from dbus.service.Object: Introspect, __repr__, __str__, add_to_connection, remove_from_connection

Inherited from dbus.service.Object (private): _message_cb, _unregister_cb

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables [hide private]
  BUS = 'org.screenlets'
  PATH = '/org/screenlets/'
  IFACE = 'org.screenlets.ScreenletService'

Inherited from dbus.service.Object: SUPPORTS_MULTIPLE_CONNECTIONS, SUPPORTS_MULTIPLE_OBJECT_PATHS

Inherited from dbus.service.Interface (private): _dbus_class_table

Instance Variables [hide private]

Inherited from dbus.service.Object (private): _connection, _fallback, _locations, _locations_lock, _object_path

Properties [hide private]

Inherited from dbus.service.Object: __dbus_object_path__, connection, locations

Inherited from object: __class__

Method Details [hide private]

__init__(self, screenlet, name, id=None)
(Constructor)

source code 
Constructor. Either conn or bus_name is required; object_path
is also required.

:Parameters:
    `conn` : dbus.connection.Connection or None
        The connection on which to export this object.

        If None, use the Bus associated with the given ``bus_name``.
        If there is no ``bus_name`` either, the object is not
        initially available on any Connection.

        For backwards compatibility, if an instance of
        dbus.service.BusName is passed as the first parameter,
        this is equivalent to passing its associated Bus as
        ``conn``, and passing the BusName itself as ``bus_name``.

    `object_path` : str or None
        A D-Bus object path at which to make this Object available
        immediately. If this is not None, a `conn` or `bus_name` must
        also be provided.

    `bus_name` : dbus.service.BusName or None
        Represents a well-known name claimed by this process. A
        reference to the BusName object will be held by this
        Object, preventing the name from being released during this
        Object's lifetime (unless it's released manually).

Overrides: dbus.service.Object.__init__
(inherited documentation)

test(self)

source code 
Decorators:
  • @action(IFACE)

debug(self, string)

source code 
Dump a string to the console.
Decorators:
  • @action(IFACE)

add(self, id)

source code 
Ask the assigned Screenlet to add a new instance of itself to its session. The new Screenlet will have the ID defined by 'id'. The ID of the new instance is returned, so you can auto-generate an ID by passing an empty string. The function returns None if adding a new instance failed for some reason.
Decorators:
  • @action(IFACE)

get(self, id, attrib)

source code 
Ask the assigned Screenlet to return the given attribute's value. If 'id' is defined, the instance with the given id will be accessed, else the main instance is used. Protected attributes are not returned by this function. TODO: Throw exception on error? ... could be abused to crash the app
Decorators:
  • @action(IFACE)

get_first_instance(self)

source code 
Get the ID of the first existing instance of the assigned Screenlet (within the screenlet's active session).
Decorators:
  • @action(IFACE)

list_instances(self)

source code 
Return a list with IDs of all existing instances of the assigned Screenlet (within the screenlet's active session).
Decorators:
  • @action(IFACE)

quit(self)

source code 
Quit all instances of the screenlet. Similar to selecting Quit from the menu.
Decorators:
  • @action(IFACE)

set(self, id, attrib, value)

source code 
Ask the assigned Screenlet to set the given attribute to 'value'. The instance with the given id will be accessed.
Decorators:
  • @action(IFACE)

instance_added(self, *args, **keywords)

 
This signal gets emitted whenever a new instance of the assigned 
Screenlet gets added.

Decorators:
  • @signal(IFACE)

instance_removed(self, *args, **keywords)

 
This signal gets emitted whenever an instance of the assigned
Screenlet gets removed.

Decorators:
  • @signal(IFACE)