KDE 4.2 PyKDE API Reference

- KDE's Python API

# Part Class Reference

`from PyKDE4.kparts import *`

Inherits: QObject,KParts.PartBase → KXMLGUIClient
Subclasses: KParts.ReadOnlyPart
Namespace: KParts

## Detailed Description

## Signals

| setStatusBarText (QString text)
| setWindowCaption (QString caption)

## Methods

| __init__ (self, QObject parent=0)
| __init__ (self, PartPrivate dd, QObject parent)
| __init__ (self, KParts.Part a0)
| customEvent (self, QEvent event)
| embed (self, QWidget parentWidget)
| guiActivateEvent (self, KParts.GUIActivateEvent event)
KParts.Part | hitTest (self, QWidget widget, QPoint globalPos)
QWidget | hostContainer (self, QString containerName)
KIconLoader | iconLoader (self)
bool | isSelectable (self)
| loadPlugins (self)
KParts.PartManager | manager (self)
| partActivateEvent (self, KParts.PartActivateEvent event)
| partSelectEvent (self, KParts.PartSelectEvent event)
| setAutoDeletePart (self, bool autoDeletePart)
| setAutoDeleteWidget (self, bool autoDeleteWidget)
| setManager (self, KParts.PartManager manager)
| setSelectable (self, bool selectable)
| setStatusBarText (self, QString text)
| setWidget (self, QWidget widget)
| setWindowCaption (self, QString caption)
| slotWidgetDestroyed (self)
QWidget | widget (self)

## Method Documentation

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

Constructor.

Parameters:

  | parent | Parent object of the part.

__init__ | ( | self, |
|  | PartPrivate | dd,
|  | QObject | parent
| ) |  |  |

__init__ | ( | self, |
|  | KParts.Part | a0
| ) |  |  |

customEvent | ( | self, |
|  | QEvent | event
| ) |  |  |

Internal:

embed | ( | self, |
|  | QWidget | parentWidget
| ) |  |  |

Embed this part into a host widget.

You don't need to do this if you created the widget with the correct parent widget - this is just a QWidget.reparent(). Note that the Part is still the holder of the QWidget, meaning that if you delete the Part, then the widget gets destroyed as well, and vice-versa. This method is not recommended since creating the widget with the correct parent is simpler anyway.

guiActivateEvent | ( | self, |
|  | KParts.GUIActivateEvent | event
| ) |  |  |

Convenience method which is called when the Part received a GUIActivateEvent . Reimplement this if you don't want to reimplement event and test for the event yourself or even install an event filter.

KParts.Part hitTest | ( | self, |
|  | QWidget | widget,
|  | QPoint | globalPos
| ) |  |  |

Returns the part (this, or a child part) at the given global position. This is called by the part manager to ask whether a part should be activated when clicking somewhere. In most cases the default implementation is enough. Reimplement this if your part has child parts in some areas (like in khtml or koffice)

Parameters:

  | widget | the part widget being clicked - usually the same as widget(), except in koffice.
  | globalPos | the mouse coordinates in global coordinates

QWidget hostContainer | ( | self, |
|  | QString | containerName
| ) |  |  |

Convenience method for KXMLGUIFactory.container.

Returns:
  a container widget owned by the Part's GUI.

KIconLoader iconLoader | ( |  | self ) |

Use this icon loader to load any icons that are specific to this part, i.e. icons installed into this part's own directories as opposed to standard kde icons. Use KIcon("myicon", iconLoader()).

Make sure to call setComponentData before calling iconLoader.

bool isSelectable | ( |  | self ) |

Returns whether the part is selectable or not.

loadPlugins | ( |  | self ) |

Load this part's plugins now. Normally you want to call this at the end of the part constructor, if you used setComponentData(componentData, false)

Since:
  4.1

KParts.PartManager manager | ( |  | self ) |

Returns the part manager handling this part, if any (0 otherwise).

partActivateEvent | ( | self, |
|  | KParts.PartActivateEvent | event
| ) |  |  |

Convenience method which is called when the Part received a PartActivateEvent . Reimplement this if you don't want to reimplement event and test for the event yourself or even install an event filter.

partSelectEvent | ( | self, |
|  | KParts.PartSelectEvent | event
| ) |  |  |

Convenience method which is called when the Part received a PartSelectEvent . Reimplement this if you don't want to reimplement event and test for the event yourself or even install an event filter.

setAutoDeletePart | ( | self, |
|  | bool | autoDeletePart
| ) |  |  |

By default, the part deletes itself when its widget is deleted. The hosting application can call setAutoDeletePart(false) to disable this behavior, to be able to delete the widget and then the part, independently. This is a method for the hosting application only, Part subclasses should never call this.

setAutoDeleteWidget | ( | self, |
|  | bool | autoDeleteWidget
| ) |  |  |

By default, the widget is deleted by the part when the part is deleted. The hosting application can call setAutoDeleteWidget(false) to disable this behavior, given that the widget is usually deleted by its parent widget anyway. This is a method for the hosting application only, Part subclasses should never call this.

setManager | ( | self, |
|  | KParts.PartManager | manager
| ) |  |  |

Internal:
  Used by the part manager.

setSelectable | ( | self, |
|  | bool | selectable
| ) |  |  |

Parameters:

  | selectable | Indicates whether the part is selectable or not.

setStatusBarText | ( | self, |
|  | QString | text
| ) |  |  |

Emitted by the part, to set a text in the statusbar of the window(s) hosting this part

Signal syntax:
  `QObject.connect(source, SIGNAL("setStatusBarText(const QString&)"), target_slot)`

setWidget | ( | self, |
|  | QWidget | widget
| ) |  |  |

Set the main widget.

Call this in the Part-inherited class constructor.

setWindowCaption | ( | self, |
|  | QString | caption
| ) |  |  |

Emitted by the part, to set the caption of the window(s) hosting this part

Signal syntax:
  `QObject.connect(source, SIGNAL("setWindowCaption(const QString&)"), target_slot)`

slotWidgetDestroyed | ( |  | self ) |

Internal:

QWidget widget | ( |  | self ) |

Returns:
  The widget defined by this part, set by setWidget().