KDE 4.5 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

Part Class Reference

from PyKDE4.kparts import *

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

Detailed Description

Base class for parts.

A "part" is a GUI component, featuring:

  • A widget embeddedable in any application.
  • GUI elements that will be merged in the "host" user interface
  • (menubars, toolbars... ).

    About the widget:\n

    Note that KParts.Part does not inherit QWidget. This is due to the fact that the "visual representation" will probably not be a mere QWidget, but an elaborate one. That's why when implementing your KParts.Part (or derived) you should call KParts.Part.setWidget() in your constructor.

    About the GUI elements:\n

    Those elements trigger actions, defined by the part ( action()). The layout of the actions in the GUI is defined by an XML file ( setXMLFile()).

    See also ReadOnlyPart and ReadWritePart, which define the framework for a "viewer" part and for an "editor"-like part. Use Part directly only if your part doesn't fit into those.


    Signals

     setStatusBarText (QString text)
     setWindowCaption (QString caption)

    Methods

     __init__ (self, QObject parent=0)
     __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)
     setWidget (self, QWidget widget)
     slotWidgetDestroyed (self)
    QWidget widget (self)

    Signal Documentation

    setStatusBarText ( 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)
    setWindowCaption ( 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)

    Method Documentation

    __init__ (  self,
    QObject  parent=0
    )

    Constructor.

    Parameters:
    parent  Parent object of the part.

    __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 (0L 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.

    setWidget (  self,
    QWidget  widget
    )

    Set the main widget.

    Call this in the Part-inherited class constructor.

    slotWidgetDestroyed (   self )

    Internal:

    QWidget widget (   self )

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

    • Full Index

    Modules

    • akonadi
    • dnssd
    • kdecore
    • kdeui
    • khtml
    • kio
    • knewstuff
    • kparts
    • kutils
    • nepomuk
    • phonon
    • plasma
    • polkitqt
    • solid
    • soprano
    This documentation is maintained by Simon Edwards.
    KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal