Plasma.Corona

KDE 4.2 PyKDE API Reference

- KDE's Python API

# Corona Class Reference

`from PyKDE4.plasma import *`

Inherits: QGraphicsScene → QObject
Namespace: Plasma

## Detailed Description

Corona plasma/corona.h <Plasma/Corona>

A QGraphicsScene for Plasma.Applets

## Signals
| availableScreenRegionChanged ()
| configSynced ()
| containmentAdded (Plasma.Containment containment)
| releaseVisualFocus ()
| screenOwnerChanged (int wasScreen, int isScreen, Plasma.Containment containment)
## Methods
| __init__ (self, QObject parent=0)
Plasma.Containment | addContainment (self, QString name, QVariantList args=QVariantList())
Plasma.Containment | addContainmentDelayed (self, QString name, QVariantList args=QVariantList())
| addOffscreenWidget (self, QGraphicsWidget widget)
QString | appletMimeType (self)
QRegion | availableScreenRegion (self, int id)
| availableScreenRegionChanged (self)
| clearContainments (self)
KSharedConfig.Ptr | config (self)
| configSynced (self)
| containmentAdded (self, Plasma.Containment containment)
Plasma.Containment | containmentForScreen (self, int screen, int desktop=-1)
[Plasma::Containmen] | containments (self)
| dragEnterEvent (self, QGraphicsSceneDragDropEvent event)
| dragLeaveEvent (self, QGraphicsSceneDragDropEvent event)
| dragMoveEvent (self, QGraphicsSceneDragDropEvent event)
[Plasma::Location] | freeEdges (self, int screen)
Plasma.ImmutabilityType | immutability (self)
| initializeLayout (self, QString config=QString())
| loadDefaultLayout (self)
| loadLayout (self, QString config=QString())
int | numScreens (self)
QPoint | popupPosition (self, QGraphicsItem item, QSize size)
| releaseVisualFocus (self)
| removeOffscreenWidget (self, QGraphicsWidget widget)
| requestConfigSync (self)
| requireConfigSync (self)
| saveLayout (self, QString config=QString())
QRect | screenGeometry (self, int id)
| screenOwnerChanged (self, int wasScreen, int isScreen, Plasma.Containment containment)
| setAppletMimeType (self, QString mimetype)
| setImmutability (self, Plasma.ImmutabilityType immutable)

## Method Documentation

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

Plasma.Containment addContainment | ( | self, |
|  | QString | name,
|  | QVariantList | args=QVariantList()
| ) |  |  |

Adds a Containment to the Corona

Parameters:

  | name | the plugin name for the containment, as given by KPluginInfo.pluginName(). If an empty string is passed in, the defalt containment plugin will be used (usually DesktopContainment). If the string literal "null" is passed in, then no plugin will be loaded and a simple Containment object will be created instead.
  | args | argument list to pass to the containment

Returns:
  a pointer to the containment on success, or 0 on failure

Plasma.Containment addContainmentDelayed | ( | self, |
|  | QString | name,
|  | QVariantList | args=QVariantList()
| ) |  |  |

Loads a containment with delayed initialization, primarily useful for implementations of loadDefaultLayout. The caller is responsible for all initializating, saving and notification of a new containment.

Parameters:

  | name | the plugin name for the containment, as given by KPluginInfo.pluginName(). If an empty string is passed in, the defalt containment plugin will be used (usually DesktopContainment). If the string literal "null" is passed in, then no plugin will be loaded and a simple Containment object will be created instead.
  | args | argument list to pass to the containment

Returns:
  a pointer to the containment on success, or 0 on failure

addOffscreenWidget | ( | self, |
|  | QGraphicsWidget | widget
| ) |  |  |

Adds a widget in the topleft quadrant in the scene. Widgets in the topleft quadrant are normally never shown unless you specifically aim a view at it, which makes it ideal for toplevel views etc.

Parameters:

  | widget | the widget to add.

QString appletMimeType | ( |  | self ) |

The current mime type of Drag/Drop items.

QRegion availableScreenRegion | ( | self, |
|  | int | id
| ) |  |  |

Returns the available region for a given screen. The available region excludes panels and similar windows. Valid screen ids are 0 to numScreens()-1. By default this method returns a rectangular region equal to screenGeometry(id); subclasses that need another behavior should override this method.

availableScreenRegionChanged | ( |  | self ) |

This signal inicates that a change in available screen goemetry occurred.

Signal syntax:
  `QObject.connect(source, SIGNAL("availableScreenRegionChanged()"), target_slot)`

clearContainments | ( |  | self ) |

Clear the Corona from all applets.

KSharedConfig.Ptr config | ( |  | self ) |

Returns the config file used to store the configuration for this Corona

configSynced | ( |  | self ) |

This signal indicates that the configuration file was flushed to disc.

Signal syntax:
  `QObject.connect(source, SIGNAL("configSynced()"), target_slot)`

containmentAdded | ( | self, |
|  | Plasma.Containment | containment
| ) |  |  |

This signal indicates a new containment has been added to the Corona

Signal syntax:
  `QObject.connect(source, SIGNAL("containmentAdded(Containment*)"), target_slot)`

Plasma.Containment containmentForScreen | ( | self, |
|  | int | screen,
|  | int | desktop=-1
| ) |  |  |

Returns the Containment, if any, for a given physical screen

Parameters:

  | screen | number of the physical screen to locate
  | desktop | the virtual desktop) to locate; if < 0 then it will simply return the first Containment associated with screen

[Plasma::Containmen] containments | ( |  | self ) |

Returns:
  all containments on this Corona

dragEnterEvent | ( | self, |
|  | QGraphicsSceneDragDropEvent | event
| ) |  |  |

dragLeaveEvent | ( | self, |
|  | QGraphicsSceneDragDropEvent | event
| ) |  |  |

dragMoveEvent | ( | self, |
|  | QGraphicsSceneDragDropEvent | event
| ) |  |  |

[Plasma::Location] freeEdges | ( | self, |
|  | int | screen
| ) |  |  |

This method is useful in order to retrieve the list of available screen edges for panel type containments.

Parameters:

  | screen | the id of the screen to look for free edges.

Returns:
  a list of free edges not filled with panel type containments.

Plasma.ImmutabilityType immutability | ( |  | self ) |

Returns:
  The type of immutability of this Corona

initializeLayout | ( | self, |
|  | QString | config=QString()
| ) |  |  |

Initializes the layout from a config file. This will first clear any existing Containments, load a layout from the requested configuration file, request the default layout if needed and update immutability.

Parameters:

  | config | the name of the config file to load from, or the default config file if QString()

loadDefaultLayout | ( |  | self ) |

Loads the default (system wide) layout for this user

loadLayout | ( | self, |
|  | QString | config=QString()
| ) |  |  |

Load applet layout from a config file. The results will be added to the current set of Containments.

Parameters:

  | config | the name of the config file to load from, or the default config file if QString()

int numScreens | ( |  | self ) |

Returns the number of screens available to plasma. Subclasses should override this method as the default implementation returns a meaningless value.

QPoint popupPosition | ( | self, |
|  | QGraphicsItem | item,
|  | QSize | size
| ) |  |  |

Recommended position for a popup window like a menu or a tooltip given its size

Parameters:

  | item | the item that the popup should appear adjacent to (an applet, say)
  | size | size of the popup

Returns:
  reccomended position

releaseVisualFocus | ( |  | self ) |

This signal indicates that an application launch, window creation or window focus event was triggered. This is used, for instance, to ensure that the Dashboard view in Plasma hides when such an event is triggered by an item it is displaying.

Signal syntax:
  `QObject.connect(source, SIGNAL("releaseVisualFocus()"), target_slot)`

removeOffscreenWidget | ( | self, |
|  | QGraphicsWidget | widget
| ) |  |  |

Removes a widget from the topleft quadrant in the scene.

Parameters:

  | widget | the widget to remove.

requestConfigSync | ( |  | self ) |

Schedules a flush-to-disk synchronization of the configuration state at the next convenient moment.

requireConfigSync | ( |  | self ) |

Schedules a time sensitive flush-to-disk synchronization of the configuration state. Since this method does not provide any sort of event compression, it should only be used when an *immediate* disk sync is *absolutely* required. Otherwise, use

See also:
  requestConfigSync() which does do event compression.

saveLayout | ( | self, |
|  | QString | config=QString()
| ) |  |  |

Save applets layout to file @arg config the file to save to, or the default config file if QString()

QRect screenGeometry | ( | self, |
|  | int | id
| ) |  |  |

Returns the geometry of a given screen. Valid screen ids are 0 to numScreen()-1, or -1 for the full desktop geometry. Subclasses should override this method as the default implementation returns a meaningless value.

screenOwnerChanged | ( | self, |
|  | int | wasScreen,
|  | int | isScreen,
|  | Plasma.Containment | containment
| ) |  |  |

This signal indicates that a containment has been newly associated (or dissociated) with a physical screen.

Parameters:

  | wasScreen | the screen it was associated with
  | isScreen | the screen it is now associated with
  | containment | the containment switching screens

Signal syntax:
  `QObject.connect(source, SIGNAL("screenOwnerChanged(int, int, Containment*)"), target_slot)`

setAppletMimeType | ( | self, |
|  | QString | mimetype
| ) |  |  |

Sets the mimetype of Drag/Drop items. Default is text/x-plasmoidservicename

setImmutability | ( | self, |
|  | Plasma.ImmutabilityType | immutable
| ) |  |  |

Sets the immutability type for this Corona (not immutable, user immutable or system immutable) @arg immutable the new immutability type of this applet