Plasma.DataEngineScript

KDE 4.2 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)
Plasma.DataEngine | dataEngine (self)
QString | mainScript (self)
int | minimumPollingInterval (self)
Plasma.Package | package (self)
| removeAllData (self, QString source)
| removeAllSources (self)
| removeData (self, QString source, QString key)
Plasma.Service | serviceForSource (self, QString source)
| setData (self, QString source, QString key, QVariant value)
| setData (self, QString source, QVariant value)
| setDataEngine (self, Plasma.DataEngine dataEngine)
| setMaxSourceCount (self, long limit)
| setMinimumPollingInterval (self, int minimumMs)
| setPollingInterval (self, long frequency)
bool | sourceRequestEvent (self, QString name)
QStringList | sources (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.

Plasma.DataEngine dataEngine | ( |  | self ) |

Returns the Plasma.DataEngine associated with this script component

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
| ) |  |  |

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
| ) |  |  |

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

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

Sets the Plasma.DataEngine associated with this DataEngineScript

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

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

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()

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