KDE 4.7 PyKDE API Reference

- KDE's Python API

# DataEngineScript Class Reference

`from PyKDE4.plasma import *`

Inherits: Plasma.ScriptEngine → QObject
Namespace: Plasma

## Detailed Description

DataEngineScript plasma/scripting/dataenginescript.h <Plasma/Scripting/DataEngineScript>

Provides a restricted interface for scripting a DataEngine

## Methods
| __init__ (self, QObject parent=0)
| addSource (self, Plasma.DataContainer source)
{QString:Plasma.DataContainer} | containerDict (self)
Plasma.DataEngine | dataEngine (self)
KPluginInfo | description (self)
| forceImmediateUpdateOfAllVisualizations (self)
QString | mainScript (self)
int | minimumPollingInterval (self)
Plasma.Package | package (self)
| removeAllData (self, QString source)
| removeAllSources (self)
| removeData (self, QString source, QString key)
| removeSource (self, QString source)
| scheduleSourcesUpdated (self)
Plasma.Service | serviceForSource (self, QString source)
| setData (self, QString source, QString key, QVariant value)
| setData (self, QString source, QVariant value)
| setData (self, QString source, {QString:QVariant} values)
| setDataEngine (self, Plasma.DataEngine dataEngine)
| setIcon (self, QString icon)
| setMaxSourceCount (self, long limit)
| setMinimumPollingInterval (self, int minimumMs)
| setName (self, QString name)
| setPollingInterval (self, long frequency)
bool | sourceRequestEvent (self, QString name)
QStringList | sources (self)
| updateAllSources (self)
bool | updateSourceEvent (self, QString source)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent=0
| ) |  |  |

Default constructor for a DataEngineScript. Subclasses should not attempt to access the Plasma.DataEngine associated with this DataEngineScript in the constructor. All such set up that requires the DataEngine itself should be done in the init() method.

addSource | ( | self, |
|  | Plasma.DataContainer | source
| ) |  |  |

{QString:Plasma.DataContainer} containerDict | ( |  | self ) |

Plasma.DataEngine dataEngine | ( |  | self ) |

Returns the Plasma.DataEngine associated with this script component

KPluginInfo description | ( |  | self ) |

Returns:
  the KPluginInfo associated with this plasmoid

forceImmediateUpdateOfAllVisualizations | ( |  | self ) |

QString mainScript | ( |  | self ) |

Returns:
  absolute path to the main script file for this plasmoid

int minimumPollingInterval | ( |  | self ) |

Plasma.Package package | ( |  | self ) |

Returns:
  the Package associated with this plasmoid which can be used to request resources, such as images and interface files.

removeAllData | ( | self, |
|  | QString | source
| ) |  |  |

removeAllSources | ( |  | self ) |

removeData | ( | self, |
|  | QString | source,
|  | QString | key
| ) |  |  |

removeSource | ( | self, |
|  | QString | source
| ) |  |  |

scheduleSourcesUpdated | ( |  | self ) |

Plasma.Service serviceForSource | ( | self, |
|  | QString | source
| ) |  |  |

Parameters:

  | source | the source to targe the Service at

Returns:
  a Service that has the source as a destination. The service is parented to the DataEngine, but may be deleted by the caller when finished with it

setData | ( | self, |
|  | QString | source,
|  | QString | key,
|  | QVariant | value
| ) |  |  |

Adds a set of values to a source

Parameters:

  | source | the name of the source to set the data on

@values a key/value collection to add to the source

Since:
  4.5

setData | ( | self, |
|  | QString | source,
|  | QVariant | value
| ) |  |  |

Adds a set of values to a source

Parameters:

  | source | the name of the source to set the data on

@values a key/value collection to add to the source

Since:
  4.5

setData | ( | self, |
|  | QString | source,
|  | {QString:QVariant} | values
| ) |  |  |

Adds a set of values to a source

Parameters:

  | source | the name of the source to set the data on

@values a key/value collection to add to the source

Since:
  4.5

setDataEngine | ( | self, |
|  | Plasma.DataEngine | dataEngine
| ) |  |  |

Sets the Plasma.DataEngine associated with this DataEngineScript

setIcon | ( | self, |
|  | QString | icon
| ) |  |  |

setMaxSourceCount | ( | self, |
|  | long | limit
| ) |  |  |

setMinimumPollingInterval | ( | self, |
|  | int | minimumMs
| ) |  |  |

setName | ( | self, |
|  | QString | name
| ) |  |  |

setPollingInterval | ( | self, |
|  | long | frequency
| ) |  |  |

bool sourceRequestEvent | ( | self, |
|  | QString | name
| ) |  |  |

Called when the script should create a source that does not currently exist.

Parameters:

  | name | the name of the source that should be created

Returns:
  true if a DataContainer was set up, false otherwise

QStringList sources | ( |  | self ) |

Returns:
  a list of all the data sources available via this DataEngine Whether these sources are currently available (which is what the default implementation provides) or not is up to the DataEngine to decide. By default, this returns dataEngine()->sources()

updateAllSources | ( |  | self ) |

bool updateSourceEvent | ( | self, |
|  | QString | source
| ) |  |  |

Called when the script should refresh the data contained in a given source.

Parameters:

  | source | the name of the source that should be updated

Returns:
  true if the data was changed, or false if there was no change or if the change will occur later