Package elisa :: Package plugins :: Package hal :: Module hal_resource :: Class HALResource

Class HALResource

source code


HAL resource provider. Provides volumes:// URI and sends messages on the bus when devices are plugged or unplugged (devices include CDs and DVDs).

Instance Methods
twisted.internet.defer.Deferred
initialize(self)
Initialize the component.
source code
twisted.internet.defer.Deferred
clean(self)
Clean the component.
source code
tuple of elisa.core.components.model.Model elisa.core.utils.defer.Deferred
get(self, uri, context_model=None)
Simple method to retrieve volumes or other devices.
source code
 
stop_volume_manager_monitoring(self)
Neutralize some of the volume_manager monitoring settings so that the user won't see rhythmbox pop up when an iPod is inserted (for example).
source code
 
restore_volume_manager_monitoring(self)
Restore the volume_manager gconf settings
source code

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Inherited from core.components.resource_provider.ResourceProvider
elisa.core.utils.defer.Deferred
delete(self, uri)
Delete a Resource represented by a URI.
source code
elisa.core.utils.defer.Deferred
post(self, uri, **parameters)
Update the resource pointed by uri with parameters.
source code
elisa.core.utils.defer.Deferred
put(self, source_uri, container_uri, source_model=None)
Put one resource into another.
source code
    Inherited from core.component.Component
 
name__get(self) source code
 
name__set(self, value) source code
    Inherited from core.log.Loggable
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
Class Methods
    Inherited from core.component.Component
elisa.core.component.Component or a subclass
create(cls, config_section=None, **kwargs)
Create and initialize the component.
source code
Class Variables
  log_category = "hal_resource"
  volumes_uri = '^volumes://'
  volumes_re = re.compile(volumes_uri)
  device_uri = '^device://'
  device_re = re.compile(device_uri)
str supported_uri = volumes_uri+ '|'+ device_uri
regular expression defining what URIs a ResourceProvider can handle
  default_filter = 'removable', 'dvd', 'cdda'

Inherited from extern.log.log.Loggable: logCategory

    Inherited from core.component.Component
  config_doc = {}
  default_config = {}
  name = property(fget= name__get, fset= name__set)
  path = PathDescriptor()
Properties

Inherited from object: __class__

Method Details

initialize(self)

source code 

Initialize the component.

This method is called by Component.create to finish the initialization of a component.

Returns: twisted.internet.defer.Deferred
a deferred called when a component is fully initialized
Overrides: core.component.Component.initialize
(inherited documentation)

clean(self)

source code 

Clean the component.

This method is called when a component is not needed anymore to clean its state.

Returns: twisted.internet.defer.Deferred
a deferred called when the component has finished cleaning its state
Overrides: core.component.Component.clean
(inherited documentation)

get(self, uri, context_model=None)

source code 

Simple method to retrieve volumes or other devices.

Access to volumes is done using the volumes:// uri and an optional filter parameter. If you specify it only these kind of volumes show up. Example:


:

  volumes://localhost/?filter=dvd,cdda

would only give you dvds and cddas. The three knows filters are: dvd, removable and cdda.

The default is that all filters are applied (like filter=dvd,cdda,removable).

In return you get a elisa.plugins.base.models.device.DevicesModel

Access to any kind of device is done using the device://localhost/path/to/udi. Example:


:

 device://localhost/org/freedesktop/Hal/devices/computer

would return a elisa.plugins.hal.hal.HALDeviceModel containing all the informations about the computer device. Please note though, that get() will return a None model at first and that the correct model will be returned by the callback of the deferred.

Parameters:
  • uri - URI pointing to the resource
  • context_model - the URI often comes from a certain context. For example a URI pointing to a MusicAlbum can come from a Model that could contain the album cover or the album name. If the context_model is provided the resource_provider should try to reuse its data if possible.
Returns: tuple of elisa.core.components.model.Model elisa.core.utils.defer.Deferred
a new model and a deferred fired when the model is fully loaded
Overrides: core.components.resource_provider.ResourceProvider.get