# Class e.p.p.b.h.HierarchyController(Component):

Part of elisa.plugins.poblesec.base.hierarchy View In Hierarchy

Known subclasses: elisa.plugins.daap.controller.AlbumsDaapController, elisa.plugins.daap.controller.ArtistsDaapController, elisa.plugins.daap.controller.TracksDaapController, elisa.plugins.database.music_controller.DecadesDbController, elisa.plugins.database.music_controller.GenericAlbumsDbController, elisa.plugins.database.music_controller.GenericArtistsController, elisa.plugins.database.music_controller.GenericTracksDbController, elisa.plugins.database.music_controller.GenresDbController, elisa.plugins.database.photo_controller.GenericPhotoAlbumsController, elisa.plugins.database.photo_controller.GenericPhotosController, elisa.plugins.database.photo_controller.PhotosTimesController, elisa.plugins.dvd.dvdcontroller.DvdHierarchyController, elisa.plugins.flickr.controller.FlickrController, elisa.plugins.ipod.controller.AlbumsIpodController, elisa.plugins.ipod.controller.ArtistsIpodController, elisa.plugins.ipod.controller.TracksIpodController, elisa.plugins.poblesec.filesystem.FilesystemController, elisa.plugins.poblesec.network.NetworkShareBrowser, elisa.plugins.poblesec.section.SectionMenuHierarchy, elisa.plugins.shoutcast.controller.GenericShoutcastController, elisa.plugins.yesfm.controllers.TrackActionsController, elisa.plugins.youtube.controller.YoutubeController

Generic controller that should be used as a base class for all custom controllers that define a browsable hierarchy.

The model of the controller is usually populated in its initialize method, while the behaviour when an item of the list representing a given level of the hierarchy is clicked is defined by the node_clicked method.

Every deferred call done in the context of this controller should be registered in the internal dictionary of deferreds so as to keep track of them and allow their cancellation if needed (e.g. when cleaning the controller). Each value of this internal dictionary is a list, meaning that several deferred calls can be associated to one key.

    >>> self.register_deferred(key, deferred)

To cancel all the deferred calls associated to a given key, do:

    >>> self.cancel_deferreds(key)

Instance Variables | deferreds | a dictionary of currently pending deferred calls (type: `dict` of `list` of {elisa.core.utils.cancellable_defer.CancellableDeferred} )
| actions | a list of contextual actions for this controller. (type: `elisa.plugins.pigment.widgets.notifying_list.List` of `elisa.plugins.poblesec.actions.Action` )

Line # | Kind | Name | Docs
--- | --- | --- | ---
55 | Method | initialize | Initialize the component.
68 | Method | node_clicked | Callback invoked when an item of the list representing a given level of
80 | Method | register_deferred | Register a deferred call to be associated to a given key.
86 | Method | cancel_deferreds | Cancel all the currently pending deferred calls associated to one given
103 | Method | cancel_all_deferreds | Cancel all the currently pending deferred calls.
114 | Method | clean | Clean the component.

Inherited from Component:

Line # | Kind | Name | Docs
--- | --- | --- | ---
85 | Class | PathDescriptor | Undocumented
97 | Class Method | create | Create and initialize the component.

Inherited from Loggable (via Component):

Line # | Kind | Name | Docs
--- | --- | --- | ---
81 | Method | __init__ | Undocumented

def initialize(self):
overrides elisa.core.component.Component.initialize
overridden in elisa.plugins.daap.controller.AlbumsDaapController, elisa.plugins.daap.controller.ArtistsDaapController, elisa.plugins.daap.controller.TracksDaapController, elisa.plugins.database.music_controller.DecadesDbController, elisa.plugins.database.music_controller.GenericAlbumsDbController, elisa.plugins.database.music_controller.GenericArtistsController, elisa.plugins.database.music_controller.GenericTracksDbController, elisa.plugins.database.music_controller.GenresDbController, elisa.plugins.database.photo_controller.GenericPhotoAlbumsController, elisa.plugins.database.photo_controller.GenericPhotosController, elisa.plugins.database.photo_controller.PhotosTimesController, elisa.plugins.dvd.dvdcontroller.DvdHierarchyController, elisa.plugins.favorites.controller.FavoritesController, elisa.plugins.flickr.controller.FlickrController, elisa.plugins.ipod.controller.AlbumsIpodController, elisa.plugins.ipod.controller.ArtistsIpodController, elisa.plugins.ipod.controller.TracksIpodController, elisa.plugins.poblesec.directory_settings.MediaDirectoryList, elisa.plugins.poblesec.filesystem.FilesystemController, elisa.plugins.poblesec.network.NetworkShareBrowser, elisa.plugins.poblesec.network.NetworkSharesList, elisa.plugins.poblesec.section.HardwareListControllerMixin, elisa.plugins.shoutcast.controller.GenericShoutcastController, elisa.plugins.yesfm.controllers.TrackActionsController, elisa.plugins.youtube.controller.YoutubeController

Initialize the component.

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

Returns | a deferred called when a component is fully initialized (type: `twisted.internet.defer.Deferred` )

def node_clicked(self, widget, item):
overridden in elisa.plugins.daap.controller.AlbumsDaapController, elisa.plugins.daap.controller.ArtistsDaapController, elisa.plugins.daap.controller.TracksDaapController, elisa.plugins.database.music_controller.DecadesDbController, elisa.plugins.database.music_controller.GenericAlbumsDbController, elisa.plugins.database.music_controller.GenericArtistsController, elisa.plugins.database.music_controller.GenericTracksDbController, elisa.plugins.database.music_controller.GenresDbController, elisa.plugins.database.photo_controller.GenericPhotoAlbumsController, elisa.plugins.database.photo_controller.GenericPhotosController, elisa.plugins.database.photo_controller.PhotosTimesController, elisa.plugins.dvd.dvdcontroller.DvdHierarchyController, elisa.plugins.flickr.controller.FlickrController, elisa.plugins.ipod.controller.AlbumsIpodController, elisa.plugins.ipod.controller.ArtistsIpodController, elisa.plugins.ipod.controller.TracksIpodController, elisa.plugins.poblesec.filesystem.FilesystemController, elisa.plugins.poblesec.network.NetworkShareBrowser, elisa.plugins.poblesec.section.SectionMenuHierarchy, elisa.plugins.shoutcast.controller.GenericShoutcastController, elisa.plugins.yesfm.controllers.TrackActionsController, elisa.plugins.youtube.controller.YoutubeController
Callback invoked when an item of the list representing a given level of the hierarchy is clicked.

Parameters | widget | the selected list item widget in the view (type: `elisa.plugins.pigment.widgets.widget.Widget` )
| item | the selected list item in the controller's model (type: `elisa.core.components.model.Model` )

def register_deferred(self, key, deferred):
Register a deferred call to be associated to a given key.

def cancel_deferreds(self, key):
Cancel all the currently pending deferred calls associated to one given key in the internal dictionary.

Parameters | key | the key in the internal deferreds dictionary (type: any immutable type )

def cancel_all_deferreds(self):
Cancel all the currently pending deferred calls.

def clean(self):
overrides elisa.core.component.Component.clean
overridden in elisa.plugins.database.music_controller.AlbumsDbController, elisa.plugins.database.music_controller.ArtistsDbController, elisa.plugins.poblesec.network.NetworkSharesList, elisa.plugins.poblesec.section.HardwareListControllerMixin, elisa.plugins.yesfm.controllers.AlbumsController

Clean the component.

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

Returns | a deferred called when the component has finished cleaning its state (type: `twisted.internet.defer.Deferred` )