KDE 4.6 PyKDE API Reference

- KDE's Python API

# PluginLoader Class Reference

`from PyKDE4.plasma import *`

Namespace: Plasma

## Detailed Description

This is an abstract base class which defines an interface to which Plasma's Applet Loading logic can communicate with a parent application. The plugin loader must be set before any plugins are loaded, otherwise (for safety reasons), the default PluginLoader implementation will be used.

Author:
  Ryan Rix <ry@n.rix.si>

Since:
  4.6

## Methods

| __init__ (self)
[KPluginInfo] | internalAppletInfo (self, QString category)
[KPluginInfo] | internalDataEngineInfo (self)
Plasma.Applet | internalLoadApplet (self, QString name, long appletId=0, [QVariant] args=QVariantList())
Plasma.DataEngine | internalLoadDataEngine (self, QString name)
Plasma.AbstractRunner | internalLoadRunner (self, QString name)
Plasma.Service | internalLoadService (self, QString name, [QVariant] args, QObject parent=0)
[KPluginInfo] | internalRunnerInfo (self)
[KPluginInfo] | internalServiceInfo (self)
[KPluginInfo] | listAppletInfo (self, QString category, QString parentApp=QString())
[KPluginInfo] | listDataEngineInfo (self, QString parentApp=QString())
[KPluginInfo] | listRunnerInfo (self, QString parentApp=QString())
Plasma.Applet | loadApplet (self, QString name, long appletId=0, [QVariant] args=QVariantList())
Plasma.DataEngine | loadDataEngine (self, QString name)
Plasma.AbstractRunner | loadRunner (self, QString name)
Plasma.Service | loadService (self, QString name, [QVariant] args, QObject parent=0)
[KPluginInfo] | standardInternalAppletInfo (self, QString category)
[KPluginInfo] | standardInternalDataEngineInfo (self)
[KPluginInfo] | standardInternalRunnerInfo (self)
[KPluginInfo] | standardInternalServiceInfo (self)

## Static Methods

Plasma.PluginLoader | pluginLoader ()
| setPluginLoader (Plasma.PluginLoader loader)

## Method Documentation

__init__ | ( |  | self ) |

[KPluginInfo] internalAppletInfo | ( | self, |
|  | QString | category
| ) |  |  |

A re-implementable method that allows subclasses to provide additional applets for listAppletInfo. If the application has no applets to give to the application, then the implementation should return an empty list.

This method is called by listAppletInfo prior to generating the list of applets installed on the system using the standard Plasma plugin mechanisms, and will try to find .desktop files for your applets.

Parameters:

  | category | Only applets matching this category will be returned. Useful in conjunction with knownCategories. If "Misc" is passed in, then applets without a Categories= entry are also returned. If an empty string is passed in, all applets are returned.

Returns:
  list of applets

[KPluginInfo] internalDataEngineInfo | ( |  | self ) |

A re-implementable method that allows subclasses to provide additional DataEngines for DataEngineManager.listDataEngines.

Returns:
  list of DataEngines, or an empty list if none

Plasma.Applet internalLoadApplet | ( | self, |
|  | QString | name,
|  | long | appletId=0,
|  | [QVariant] | args=QVariantList()
| ) |  |  |

A re-implementable method that allows subclasses to override the default behaviour of loadApplet. If the applet requested is not recognized, then the implementation should return a NULL pointer. This method is called by loadApplet prior to attempting to load an applet using the standard Plasma plugin mechanisms.

Parameters:

  | name | the plugin name, as returned by KPluginInfo.pluginName()
  | appletId | unique ID to assign the applet, or zero to have one assigned automatically.
  | args | to send the applet extra arguments

Returns:
  a pointer to the loaded applet, or 0 on load failure

Plasma.DataEngine internalLoadDataEngine | ( | self, |
|  | QString | name
| ) |  |  |

A re-implementable method that allows subclasses to override the default behaviour of loadDataEngine. If the engine requested is not recognized, then the implementation should return a NULL pointer. This method is called by loadDataEngine prior to attempting to load a DataEgine using the standard Plasma plugin mechanisms.

Parameters:

  | name | the name of the engine

Returns:
  the data engine that was loaded, or the NullEngine on failure.

Plasma.AbstractRunner internalLoadRunner | ( | self, |
|  | QString | name
| ) |  |  |

A re-implementable method that allows subclasses to override the default behaviour of loadRunner. If the runner requested is not recognized, then the implementation should return a NULL pointer. This method is called by loadRunner prior to attempting to load a DataEgine using the standard Plasma plugin mechanisms.

Parameters:

  | name | the name of the engine

Returns:
  the data engine that was loaded, or the NullEngine on failure.

Plasma.Service internalLoadService | ( | self, |
|  | QString | name,
|  | [QVariant] | args,
|  | QObject | parent=0
| ) |  |  |

A re-implementable method that allows subclasses to override the default behaviour of loadService. If the service requested is not recognized, then the implementation should return a NULL pointer. This method is called by loadService prior to attempting to load a Service using the standard Plasma plugin mechanisms.

Parameters:

  | name | the plugin name of the service to load
  | args | a list of arguments to supply to the service plugin when loading it
  | parent | the parent object, if any, for the service

Returns:
  a Service object, unlike Plasma.Service.loadService, this can return null.

[KPluginInfo] internalRunnerInfo | ( |  | self ) |

Returns a list of all known Runner implementations

Returns:
  list of AbstractRunners, or an empty list if none

[KPluginInfo] internalServiceInfo | ( |  | self ) |

Returns a list of all known Runner implementations

Returns:
  list of AbstractRunners, or an empty list if none

[KPluginInfo] listAppletInfo | ( | self, |
|  | QString | category,
|  | QString | parentApp=QString()
| ) |  |  |

Returns a list of all known applets. This may skip applets based on security settings and ExcludeCategories in the application's config.

Parameters:

  | category | Only applets matchin this category will be returned. Useful in conjunction with knownCategories. If "Misc" is passed in, then applets without a Categories= entry are also returned. If an empty string is passed in, all applets are returned.
  | parentApp | the application to filter applets on. Uses the X-KDE-ParentApp entry (if any) in the plugin info. The default value of QString() will result in a list containing only applets not specifically registered to an application.

Returns:
  list of applets

[KPluginInfo] listDataEngineInfo | ( | self, |
|  | QString | parentApp=QString()
| ) |  |  |

Returns a list of all known DataEngines.

Parameters:

  | parentApp | the application to filter applets on. Uses the X-KDE-ParentApp entry (if any) in the plugin info. The default value of QString() will result in a list containing only applets not specifically registered to an application.

Returns:
  list of DataEngines

[KPluginInfo] listRunnerInfo | ( | self, |
|  | QString | parentApp=QString()
| ) |  |  |

Returns a list of all known Runner implementations

Parameters:

  | parentApp | the application to filter applets on. Uses the X-KDE-ParentApp entry (if any) in the plugin info. The default value of QString() will result in a list containing only applets not specifically registered to an application.

Returns:
  list of AbstractRunners

Plasma.Applet loadApplet | ( | self, |
|  | QString | name,
|  | long | appletId=0,
|  | [QVariant] | args=QVariantList()
| ) |  |  |

Load an Applet plugin.

Parameters:

  | name | the plugin name, as returned by KPluginInfo.pluginName()
  | appletId | unique ID to assign the applet, or zero to have one assigned automatically.
  | args | to send the applet extra arguments

Returns:
  a pointer to the loaded applet, or 0 on load failure

Plasma.DataEngine loadDataEngine | ( | self, |
|  | QString | name
| ) |  |  |

Load a DataEngine plugin.

Parameters:

  | name | the name of the engine

Returns:
  the DataEngine that was loaded, or the NullEngine on failure.

Plasma.AbstractRunner loadRunner | ( | self, |
|  | QString | name
| ) |  |  |

Load a Runner plugin

Returns:
  the Runner that was loaded, or 0 on failure.

Plasma.Service loadService | ( | self, |
|  | QString | name,
|  | [QVariant] | args,
|  | QObject | parent=0
| ) |  |  |

Load a Service plugin.

Parameters:

  | name | the plugin name of the service to load
  | args | a list of arguments to supply to the service plugin when loading it
  | parent | the parent object, if any, for the service

Returns:
  a Service object, unlike Plasma.Service.loadService, this can return null.

[KPluginInfo] standardInternalAppletInfo | ( | self, |
|  | QString | category
| ) |  |  |

Standardized mechanism for providing internal Applets by install .desktop files in $APPPDATA/plasma/internal/applets/

For applications that do this, internalAppletInfo can be implemented as a one-liner call to this method.

Parameters:

  | category | Only applets matching this category will be returned. Useful in conjunction with knownCategories. If "Misc" is passed in, then applets without a Categories= entry are also returned. If an empty string is passed in, all applets are returned.

Returns:
  list of Applets, or an empty list if none

[KPluginInfo] standardInternalDataEngineInfo | ( |  | self ) |

Standardized mechanism for providing internal Applets by install .desktop files in $APPPDATA/plasma/internal/dataengines/

For applications that do this, internalDataEngineInfo can be implemented as a one-liner call to this method.

Returns:
  list of applets

[KPluginInfo] standardInternalRunnerInfo | ( |  | self ) |

Standardized mechanism for providing internal Applets by install .desktop files in $APPPDATA/plasma/internal/runners/

For applications that do this, internalRunnerInfo can be implemented as a one-liner call to this method.

Returns:
  list of applets

[KPluginInfo] standardInternalServiceInfo | ( |  | self ) |

Standardized mechanism for providing internal Applets by install .desktop files in $APPPDATA/plasma/internal/services/

For applications that do this, internalRunnerInfo can be implemented as a one-liner call to this method.

Returns:
  list of applets

## Static Method Documentation

Plasma.PluginLoader pluginLoader | ( |  | ) |

Return the active plugin loader

setPluginLoader | ( | Plasma.PluginLoader | loader
| ) |  |  |

Set the plugin loader which will be queried for all loads.

Parameters:

  | loader | A subclass of PluginLoader which will be supplied by the application