KDE 4.7 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

KPluginSelector Class Reference

from PyKDE4.kutils import *

Inherits: QWidget → QObject

Detailed Description

A widget to select what plugins to load and configure the plugins.

It shows the list of available plugins

Since the user needs a way to know what a specific plugin does every plugin sould install a desktop file containing a name, comment and category field. The category is useful for applications that can use different kinds of plugins like a playlist, skin or visualization

The location of these desktop files is the share/apps/<instancename>/<plugindir> directory. But if you need you may use a different directory

You can add plugins from different KConfig[group], by just calling all times you want addPlugins method with the correct parameters

Additionally, calls to constructor with same categoryName, will add new items to the same category, even if plugins are from different categories

Author:
Matthias Kretz <kretz@kde.org>
Author:
Rafael Fernández López <ereslibre@kde.org>


Enumerations

PluginLoadMethod { ReadConfigFile, IgnoreConfigFile }

Signals

 changed (bool hasChanged)
 configCommitted (QByteArray componentName)

Methods

 __init__ (self, QWidget parent=0)
 addPlugins (self, QString componentName, QString categoryName=QString(), QString categoryKey=QString(), KSharedPtr config=KSharedConfig.Ptr())
 addPlugins (self, KComponentData instance, QString categoryName=QString(), QString categoryKey=QString(), KSharedPtr config=KSharedConfig.Ptr())
 addPlugins (self, [KPluginInfo] pluginInfoList, KPluginSelector.PluginLoadMethod pluginLoadMethod=KPluginSelector.ReadConfigFile, QString categoryName=QString(), QString categoryKey=QString(), KSharedPtr config=KSharedConfig.Ptr())
 defaults (self)
bool isDefault (self)
 load (self)
 save (self)
 updatePluginsState (self)

Signal Documentation

changed ( bool  hasChanged
)

Tells you whether the configuration is changed or not.

Signal syntax:
QObject.connect(source, SIGNAL("changed(bool)"), target_slot)
configCommitted ( QByteArray  componentName
)

Emitted after the config of an embedded KCM has been saved. The argument is the name of the parent component that needs to reload its config

Signal syntax:
QObject.connect(source, SIGNAL("configCommitted(const QByteArray&)"), target_slot)

Method Documentation

__init__ (  self,
QWidget  parent=0
)

Create a new KPluginSelector

addPlugins (  self,
QString  componentName,
QString  categoryName=QString(),
QString  categoryKey=QString(),
KSharedPtr  config=KSharedConfig.Ptr()
)

Add a list of non-KParts plugins

Parameters:
pluginInfoList  A list of KPluginInfo objects containing the necessary information for the plugins you want to add to the list
pluginLoadMethod  If KPluginSelector will try to load the state of the plugin when loading the dialog from the configuration file or not. This is useful if for some reason you called the setPluginEnabled() for each plugin individually before loading the dialog, and don't want KPluginSelector to override them when loading
categoryName  The translated name of the category. This is the name that is shown in the title. If the category did exist before because of another call to addPlugins, then they will be shown in that category. If categoryName is a new one, then a new category will be shown on the plugin window, and the list of plugins added to it
categoryKey  When you have different categories of KParts plugins you distinguish between the plugins using the Category key in the .desktop file. Use this parameter to select only those KParts plugins with the Category key == categoryKey. If categoryKey is not set the Category key is ignored and all plugins are shown. Not match case
config  The KConfig object that holds the state of the plugins being enabled or not. By default it will use KGlobal.config(). It is recommended to always pass a KConfig object if you use KSettings.PluginPage since you never know from where the page will be called (think global config app). For example KViewCanvas passes KConfig("kviewcanvas")

Note:
All plugins that were set a config group using setConfig() method will load and save their information from there. For those that weren't any config object, config will be used

addPlugins (  self,
KComponentData  instance,
QString  categoryName=QString(),
QString  categoryKey=QString(),
KSharedPtr  config=KSharedConfig.Ptr()
)

Add a list of non-KParts plugins

Parameters:
pluginInfoList  A list of KPluginInfo objects containing the necessary information for the plugins you want to add to the list
pluginLoadMethod  If KPluginSelector will try to load the state of the plugin when loading the dialog from the configuration file or not. This is useful if for some reason you called the setPluginEnabled() for each plugin individually before loading the dialog, and don't want KPluginSelector to override them when loading
categoryName  The translated name of the category. This is the name that is shown in the title. If the category did exist before because of another call to addPlugins, then they will be shown in that category. If categoryName is a new one, then a new category will be shown on the plugin window, and the list of plugins added to it
categoryKey  When you have different categories of KParts plugins you distinguish between the plugins using the Category key in the .desktop file. Use this parameter to select only those KParts plugins with the Category key == categoryKey. If categoryKey is not set the Category key is ignored and all plugins are shown. Not match case
config  The KConfig object that holds the state of the plugins being enabled or not. By default it will use KGlobal.config(). It is recommended to always pass a KConfig object if you use KSettings.PluginPage since you never know from where the page will be called (think global config app). For example KViewCanvas passes KConfig("kviewcanvas")

Note:
All plugins that were set a config group using setConfig() method will load and save their information from there. For those that weren't any config object, config will be used

addPlugins (  self,
[KPluginInfo]  pluginInfoList,
KPluginSelector.PluginLoadMethod  pluginLoadMethod=KPluginSelector.ReadConfigFile,
QString  categoryName=QString(),
QString  categoryKey=QString(),
KSharedPtr  config=KSharedConfig.Ptr()
)

Add a list of non-KParts plugins

Parameters:
pluginInfoList  A list of KPluginInfo objects containing the necessary information for the plugins you want to add to the list
pluginLoadMethod  If KPluginSelector will try to load the state of the plugin when loading the dialog from the configuration file or not. This is useful if for some reason you called the setPluginEnabled() for each plugin individually before loading the dialog, and don't want KPluginSelector to override them when loading
categoryName  The translated name of the category. This is the name that is shown in the title. If the category did exist before because of another call to addPlugins, then they will be shown in that category. If categoryName is a new one, then a new category will be shown on the plugin window, and the list of plugins added to it
categoryKey  When you have different categories of KParts plugins you distinguish between the plugins using the Category key in the .desktop file. Use this parameter to select only those KParts plugins with the Category key == categoryKey. If categoryKey is not set the Category key is ignored and all plugins are shown. Not match case
config  The KConfig object that holds the state of the plugins being enabled or not. By default it will use KGlobal.config(). It is recommended to always pass a KConfig object if you use KSettings.PluginPage since you never know from where the page will be called (think global config app). For example KViewCanvas passes KConfig("kviewcanvas")

Note:
All plugins that were set a config group using setConfig() method will load and save their information from there. For those that weren't any config object, config will be used

defaults (   self )

Change to applications defaults

See also:
isDefault()

bool isDefault (   self )

Returns true if the plugin selector does not have any changes to application defaults

See also:
defaults()
Since:
4.3

load (   self )

Load the state of the plugins (selected or not) from the KPluginInfo objects

save (   self )

Save the configuration

updatePluginsState (   self )

Updates plugins state (enabled or not)

This method won't save anything on any configuration file. It will just be useful if you added plugins with the method:

 void addPlugins(const QList<KPluginInfo> &pluginInfoList,
                 const QString &categoryName = QString(),
                 const QString &categoryKey = QString(),
                 const KSharedConfig.Ptr &config = KSharedConfig.Ptr());

To sum up, this method will update your plugins state depending if plugins are ticked or not on the KPluginSelector dialog, without saving anything anywhere


Enumeration Documentation

PluginLoadMethod
Enumerator:
ReadConfigFile = 0
IgnoreConfigFile 

  • Full Index

Modules

  • akonadi
  • dnssd
  • kdecore
  • kdeui
  • khtml
  • kio
  • knewstuff
  • kparts
  • kutils
  • nepomuk
  • phonon
  • plasma
  • polkitqt
  • solid
  • soprano
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal