KDE 4.2 PyKDE API Reference

- KDE's Python API

# PopupApplet Class Reference

`from PyKDE4.plasma import *`

Inherits: Plasma.Applet → QGraphicsWidget → QObject
Namespace: Plasma

## Detailed Description

Allows applets to automatically 'collapse' into an icon when put in an panel, and is a convenient base class for any applet that wishes to use extenders.

Applets that subclass this class should implement either widget() or graphicsWidget() to return a widget that will be displayed in the applet if the applet is in a Planar or MediaCenter form factor. If the applet is put in a panel, an icon will be displayed instead, which shows the widget in a popup when clicked.

If you use this class as a base class for your extender using applet, the extender will automatically be used for the popup; reimplementing graphicsWidget() is unnecessary in this case.

## Methods

| __init__ (self, QObject parent, QVariantList args)
bool | eventFilter (self, QObject watched, QEvent event)
QGraphicsWidget | graphicsWidget (self)
| hidePopup (self)
bool | isPassivePopup (self)
bool | isPopupShowing (self)
| mousePressEvent (self, QGraphicsSceneMouseEvent event)
| mouseReleaseEvent (self, QGraphicsSceneMouseEvent event)
| popupEvent (self, bool show)
QIcon | popupIcon (self)
Plasma.PopupPlacement | popupPlacement (self)
| setPassivePopup (self, bool passive)
| setPopupIcon (self, QIcon icon)
| setPopupIcon (self, QString iconName)
| showPopup (self, long displayTime=0)
| togglePopup (self)
QWidget | widget (self)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent,
|  | QVariantList | args
| ) |  |  |

bool eventFilter | ( | self, |
|  | QObject | watched,
|  | QEvent | event
| ) |  |  |

QGraphicsWidget graphicsWidget | ( |  | self ) |

Implement either this function or widget().

Returns:
  the widget that will get shown in either a layout, in the applet or in a Dialog, depending on the form factor of the applet.

hidePopup | ( |  | self ) |

Hides the popup.

bool isPassivePopup | ( |  | self ) |

Returns:
  true if the dialog will be treated as a passive poup

bool isPopupShowing | ( |  | self ) |

Returns:
  true if the applet is popped up

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

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

popupEvent | ( | self, |
|  | bool | show
| ) |  |  |

This event handler can be reimplemented in a subclass to receive an event before the popup is shown or hidden. @arg show true if the popup is going to be shown, false if the popup is going to be hidden. Note that showing and hiding the popup on click is already done in PopupApplet.

QIcon popupIcon | ( |  | self ) |

Returns:
  the icon that is displayed when the applet is in a panel.

Plasma.PopupPlacement popupPlacement | ( |  | self ) |

Returns:
  the placement of the popup relating to the icon

setPassivePopup | ( | self, |
|  | bool | passive
| ) |  |  |

Sets whether or not the dialog popup that gets created should be a "passive" popup that does not steal focus from other windows or not.

@arg passive true if the dialog should be treated as a passive popup

setPopupIcon | ( | self, |
|  | QIcon | icon
| ) |  |  |

@arg icon the icon that has to be displayed when the applet is in a panel.

setPopupIcon | ( | self, |
|  | QString | iconName
| ) |  |  |

@arg icon the icon that has to be displayed when the applet is in a panel.

showPopup | ( | self, |
|  | long | displayTime=0
| ) |  |  |

Shows the dialog showing the widget if the applet is in a panel. @arg displayTime the time in ms that the popup should be displayed, defaults to 0 which means always (until the user closes it again, that is).

togglePopup | ( |  | self ) |

Toggles the popup.

QWidget widget | ( |  | self ) |

Implement either this function or graphicsWidget().

Returns:
  the widget that will get shown in either a layout, in the applet or in a Dialog, depending on the form factor of the applet.