Components

Base Classes

class plinth.app.Component(component_id)[source]

Interface for an app component.

__init__(component_id)[source]

Initialize the component.

static diagnose()[source]

Run diagnostics and return results.

Return value must be a list of results. Each result is a two-tuple with first value as user visible description of the test followed by the result. The test result is a string enumeration from ‘failed’, ‘passed’ and ‘error’.

Also see has_diagnostics().

disable()[source]

Run operations to disable the component.

enable()[source]

Run operations to enable the component.

has_diagnostics()[source]

Return whether at least one diagnostic test is implemented.

If this method return True, the App.has_diagnostics(). also returns True.

If a subclass of Component overrides the diagnose() method, it is assumed that it is for implementing diagnostic tests and this method returns True for such a component. Override this method if this default behavior does not fit the needs.

class plinth.app.LeaderComponent(component_id)[source]

Interface for an app component that decides the state of the app.

These components determine if the app is enabled or not.

is_enabled()[source]

Return if the component is enabled.

class plinth.app.FollowerComponent(component_id, is_enabled=False)[source]

Interface for an app component that follows other components.

These components of the app don’t determine if the app is enabled or not.

__init__(component_id, is_enabled=False)[source]

Initialize the component.

disable()[source]

Run operations to disable the component.

enable()[source]

Run operations to enable the component.

is_enabled()[source]

Return whether the component is enabled.

set_enabled(enabled)[source]

Update the internal enabled state of the component.