Plasma.WallpaperScript

KDE 4.5 PyKDE API Reference

- KDE's Python API

# WallpaperScript Class Reference

`from PyKDE4.plasma import *`

Inherits: Plasma.ScriptEngine → QObject
Namespace: Plasma

## Detailed Description

WallpaperScript plasma/scripting/wallpaperscript.h <Plasma/Scripting/WallpaperScript>

Provides a restricted interface for scripting a Wallpaper

## Methods
| __init__ (self, QObject parent=0)
QRectF | boundingRect (self)
| configNeedsSaving (self)
QWidget | createConfigurationInterface (self, QWidget parent)
Plasma.DataEngine | dataEngine (self, QString name)
KPluginInfo | description (self)
bool | findInCache (self, QString key, QImage image, long lastModified=0)
| initWallpaper (self, KConfigGroup config)
| insertIntoCache (self, QString key, QImage image)
bool | isInitialized (self)
QString | mainScript (self)
| mouseMoveEvent (self, QGraphicsSceneMouseEvent event)
| mousePressEvent (self, QGraphicsSceneMouseEvent event)
| mouseReleaseEvent (self, QGraphicsSceneMouseEvent event)
Plasma.Package | package (self)
| paint (self, QPainter painter, QRectF exposedRect)
| render (self, QString sourceImagePath, QSize size, Plasma.Wallpaper.ResizeMethod resizeMethod=Plasma.Wallpaper.ScaledResize, QColor color=QColor(0,0,0))
| renderCompleted (self, QImage image)
| save (self, KConfigGroup config)
| setConfigurationRequired (self, bool needsConfiguring, QString reason=QString())
| setContextualActions (self, [QAction] actions)
| setResizeMethodHint (self, Plasma.Wallpaper.ResizeMethod resizeMethod)
| setTargetSizeHint (self, QSizeF targetSize)
| setUsingRenderingCache (self, bool useCache)
| setWallpaper (self, Plasma.Wallpaper wallpaper)
| update (self, QRectF exposedArea)
| urlDropped (self, KUrl url)
Plasma.Wallpaper | wallpaper (self)
| wheelEvent (self, QGraphicsSceneWheelEvent event)

## Method Documentation

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

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

QRectF boundingRect | ( |  | self ) |

configNeedsSaving | ( |  | self ) |

QWidget createConfigurationInterface | ( | self, |
|  | QWidget | parent
| ) |  |  |

Returns a widget that can be used to configure the options (if any) associated with this wallpaper. It will be deleted by the caller when it complete. The default implementation returns a null pointer.

To signal that settings have changed connect to settingsChanged(bool modified) in parent.

     connect(this, SIGNAL(settingsChanged(bool), parent, SLOT(settingsChanged(bool)))

Emit settingsChanged(true) when the settings are changed and false when the original state is restored.

Implementation detail note: for best visual results, use a QGridLayout with two columns, with the option labels in column 0

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

KPluginInfo description | ( |  | self ) |

Returns:
  the KPluginInfo associated with this wallpaper

bool findInCache | ( | self, |
|  | QString | key,
|  | QImage | image,
|  | long | lastModified=0
| ) |  |  |

initWallpaper | ( | self, |
|  | KConfigGroup | config
| ) |  |  |

This method is called once the wallpaper is loaded or mode is changed.

The mode can be retrieved using the renderingMode() method.

Parameters:

  | config | Config group to load settings

insertIntoCache | ( | self, |
|  | QString | key,
|  | QImage | image
| ) |  |  |

bool isInitialized | ( |  | self ) |

QString mainScript | ( |  | self ) |

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

mouseMoveEvent | ( | self, |
|  | QGraphicsSceneMouseEvent | event
| ) |  |  |

Mouse move event. To prevent further propagation of the event, the event must be accepted.

Parameters:

  | event | the mouse event object

mousePressEvent | ( | self, |
|  | QGraphicsSceneMouseEvent | event
| ) |  |  |

Mouse press event. To prevent further propagation of the even, and to receive mouseMoveEvents, the event must be accepted.

Parameters:

  | event | the mouse event object

mouseReleaseEvent | ( | self, |
|  | QGraphicsSceneMouseEvent | event
| ) |  |  |

Mouse release event. To prevent further propagation of the event, the event must be accepted.

Parameters:

  | event | the mouse event object

Plasma.Package package | ( |  | self ) |

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

paint | ( | self, |
|  | QPainter | painter,
|  | QRectF | exposedRect
| ) |  |  |

This method is called when the wallpaper should be painted.

Parameters:

  | painter | the QPainter to use to do the painting
  | exposedRect | the rect to paint within

render | ( | self, |
|  | QString | sourceImagePath,
|  | QSize | size,
|  | Plasma.Wallpaper.ResizeMethod | resizeMethod=Plasma.Wallpaper.ScaledResize,
|  | QColor | color=QColor(0,0,0)
| ) |  |  |

renderCompleted | ( | self, |
|  | QImage | image
| ) |  |  |

save | ( | self, |
|  | KConfigGroup | config
| ) |  |  |

This method is called when settings need to be saved.

Parameters:

  | config | Config group to save settings

setConfigurationRequired | ( | self, |
|  | bool | needsConfiguring,
|  | QString | reason=QString()
| ) |  |  |

setContextualActions | ( | self, |
|  | [QAction] | actions
| ) |  |  |

setResizeMethodHint | ( | self, |
|  | Plasma.Wallpaper.ResizeMethod | resizeMethod
| ) |  |  |

setTargetSizeHint | ( | self, |
|  | QSizeF | targetSize
| ) |  |  |

setUsingRenderingCache | ( | self, |
|  | bool | useCache
| ) |  |  |

setWallpaper | ( | self, |
|  | Plasma.Wallpaper | wallpaper
| ) |  |  |

Sets the Plasma.Wallpaper associated with this WallpaperScript

update | ( | self, |
|  | QRectF | exposedArea
| ) |  |  |

urlDropped | ( | self, |
|  | KUrl | url
| ) |  |  |

Plasma.Wallpaper wallpaper | ( |  | self ) |

Returns the Plasma.Wallpaper associated with this script component

wheelEvent | ( | self, |
|  | QGraphicsSceneWheelEvent | event
| ) |  |  |

Mouse wheel event. To prevent further propagation of the event, the event must be accepted.

Parameters:

  | event | the wheel event object