AppletScript Class Reference
from PyKDE4.plasma import *
Inherits: Plasma.ScriptEngine → QObject
Namespace: Plasma
Detailed Description
AppletScript plasma/scripting/appletscript.h <Plasma/Scripting/AppletScript>
Provides a restricted interface for scripted applets.
Signals |
| popupEvent (bool popped) |
| saveState (KConfigGroup group) |
Methods |
| __init__ (self, QObject parent=0) |
| addStandardConfigurationPages (self, KConfigDialog dialog) |
Plasma.Applet | applet (self) |
| configChanged (self) |
| configNeedsSaving (self) |
| constraintsEvent (self, Plasma.Constraints constraints) |
Plasma.Containment.Type | containmentType (self) |
[QAction] | contextualActions (self) |
Plasma.DataEngine | dataEngine (self, QString engine) |
KPluginInfo | description (self) |
bool | drawWallpaper (self) |
Plasma.Extender | extender (self) |
bool | isRegisteredAsDragHandle (self, QGraphicsItem item) |
Plasma.Animation | loadAnimationFromPackage (self, QString name, QObject parent) |
QString | mainScript (self) |
Plasma.Package | package (self) |
| paintInterface (self, QPainter painter, QStyleOptionGraphicsItem option, QRect contentsRect) |
| registerAsDragHandle (self, QGraphicsItem item) |
| setApplet (self, Plasma.Applet applet) |
| setConfigurationRequired (self, bool req, QString reason=QString()) |
| setContainmentType (self, Plasma.Containment.Type type) |
| setDrawWallpaper (self, bool drawWallpaper) |
| setFailedToLaunch (self, bool failed, QString reason=QString()) |
| setHasConfigurationInterface (self, bool hasInterface) |
QPainterPath | shape (self) |
| showConfigurationInterface (self) |
| showMessage (self, QIcon icon, QString message, Plasma.MessageButtons buttons) |
QSizeF | size (self) |
KConfigDialog | standardConfigurationDialog (self) |
| unregisterAsDragHandle (self, QGraphicsItem item) |
Signal Documentation
popupEvent |
( |
bool |
popped |
|
) |
|
|
|
- See also:
- PopupApplet
- Signal syntax:
QObject.connect(source, SIGNAL("popupEvent(bool)"), target_slot)
- See also:
- Applet
- Signal syntax:
QObject.connect(source, SIGNAL("saveState(KConfigGroup&)"), target_slot)
Method Documentation
__init__ |
( |
self, |
|
|
|
QObject |
parent=0 |
|
) |
|
|
|
Default constructor for an AppletScript.
Subclasses should not attempt to access the Plasma.Applet
associated with this AppletScript in the constructor. All
such set up that requires the Applet itself should be done
in the init() method.
This method should be called after a scripting applet has added
its own pages to a configuration dialog
- Since:
- 4.3.1
Returns the Plasma.Applet associated with this script component
configNeedsSaving |
( |
|
self ) |
|
Called when any of the geometry constraints have been updated.
This is always called prior to painting and should be used as an
opportunity to layout the widget, calculate sizings, etc.
Do not call update() from this method; an update() will be triggered
at the appropriate time for the applet.
- Parameters:
-
| constraints | the type of constraints that were updated
|
- See also:
- Containment
- Since:
- 4.7
[QAction] contextualActions |
( |
|
self ) |
|
Returns a list of context-related QAction instances.
- Returns:
- A list of actions. The default implementation returns an
empty list.
- Parameters:
-
| engine | name of the engine
|
- Returns:
- a data engine associated with this plasmoid
- Returns:
- the KPluginInfo associated with this plasmoid
bool drawWallpaper |
( |
|
self ) |
|
- Returns:
- true if the applet is a containment AND if the wallpaper is enabled
- See also:
- Containment
- Since:
- 4.7
bool isRegisteredAsDragHandle |
( |
self, |
|
|
|
QGraphicsItem |
item |
|
) |
|
|
|
Plasma.Animation loadAnimationFromPackage |
( |
self, |
|
|
|
QString |
name, |
|
|
QObject |
parent |
|
) |
|
|
|
Loads an animation from the applet package
- Parameters:
-
| animation | the animation to load
|
- Returns:
- an Animation object on success, a NULL pointer on failure
- Since:
- 4.5
QString mainScript |
( |
|
self ) |
|
- Returns:
- absolute path to the main script file for this plasmoid
- Returns:
- the Package associated with this plasmoid which can
be used to request resources, such as images and
interface files.
paintInterface |
( |
self, |
|
|
|
QPainter |
painter, |
|
|
QStyleOptionGraphicsItem |
option, |
|
|
QRect |
contentsRect |
|
) |
|
|
|
Called when the script should paint the applet
- Parameters:
-
| painter | the QPainter to use
|
| option | the style option containing such flags as selection, level of detail, etc
|
| contentsRect | the rect to paint within; automatically adjusted for
the background, if any
|
registerAsDragHandle |
( |
self, |
|
|
|
QGraphicsItem |
item |
|
) |
|
|
|
Sets the applet associated with this AppletScript
setConfigurationRequired |
( |
self, |
|
|
|
bool |
req, |
|
|
QString |
reason=QString() |
|
) |
|
|
|
- See also:
- Containment
- Since:
- 4.7
setDrawWallpaper |
( |
self, |
|
|
|
bool |
drawWallpaper |
|
) |
|
|
|
set if the containment draws its own wallpaper: it has no effect if the applet is not a containment
- See also:
- Containment
- Since:
- 4.7
setFailedToLaunch |
( |
self, |
|
|
|
bool |
failed, |
|
|
QString |
reason=QString() |
|
) |
|
|
|
setHasConfigurationInterface |
( |
self, |
|
|
|
bool |
hasInterface |
|
) |
|
|
|
Sets whether or not this script has a configuration interface or not
- Parameters:
-
| hasInterface | true if the applet is user configurable
|
QPainterPath shape |
( |
|
self ) |
|
Returns the shape of the widget, defaults to the bounding rect
showConfigurationInterface |
( |
|
self ) |
|
Show a configuration dialog.
Returns the area within which contents can be painted.
- Returns:
- a standard Plasma applet configuration dialog, ready
to have pages added to it.
Note that the dialog returned is set to delete on close.
unregisterAsDragHandle |
( |
self, |
|
|
|
QGraphicsItem |
item |
|
) |
|
|
|