PluginPage Class Reference
from PyKDE4.kutils import *
Inherits: KCModule → QWidget → QObject
Namespace: KSettings
Detailed Description
Convenience KCModule for creating a plugins config page.
This class makes it very easy to create a plugins configuration page to your program. All you need to do is create a class that is derived from PluginPage and add the appropriate plugin information to the KPluginSelector. This is done using the pluginSelector() method:
K_PLUGIN_FACTORY(MyAppPluginConfigFactory, registerPlugin<MyAppPluginConfig>(); ) K_EXPORT_PLUGIN(MyAppConfigFactory("kcm_myapppluginconfig")); MyAppPluginConfig(QWidget * parent, const QVariantList & args) : PluginPage(MyAppPluginConfigFactory.componentData(), parent, args) { pluginSelector()->addPlugins( KGlobal.mainComponent().componentName(), i18n( "General Plugins" ), "General" ); pluginSelector()->addPlugins( KGlobal.mainComponent().componentName(), i18n( "Effects" ), "Effects" ); }
All that remains to be done is to create the appropriate .desktop file <pre> [Desktop Entry] Encoding=UTF-8 Icon=plugin Type=Service ServiceTypes=KCModule
X-KDE-Library=myapppluginconfig X-KDE-FactoryName=MyAppPluginConfigFactory X-KDE-ParentApp=myapp X-KDE-ParentComponents=myapp
Name=Plugins Comment=Select and configure your plugins: </pre>
Methods | |
__init__ (self, KComponentData componentData, QWidget parent=0, [QVariant] args=QVariantList()) | |
defaults (self) | |
load (self) | |
KPluginSelector | pluginSelector (self) |
save (self) |
Method Documentation
__init__ | ( | self, | ||
KComponentData | componentData, | |||
QWidget | parent=0, | |||
[QVariant] | args=QVariantList() | |||
) |
Standard KCModule constructor. Automatically creates the KPluginSelector widget.
defaults | ( | self ) |
load | ( | self ) |
Load the state of the plugins (selected or not) from the KPluginInfo objects. For KParts plugins everything should work automatically. For your own type of plugins you might need to reimplement the KPluginInfo.pluginLoaded() method. If that doesn't fit your needs you can also reimplement this method.
KPluginSelector pluginSelector | ( | self ) |
- Returns:
- a reference to the KPluginSelector.
save | ( | self ) |
Save the state of the plugins to KConfig objects