KParts

Introduction

The term KParts refers to the K Desktop Environment's component technology which is used to embed viewers and editors into applications. The use of components reduces the time spent by developers in reinventing existing features and technologies, leading to a more productive development environment.

The KParts framework encompasses a variety of forms for such components, from simple plugins to fully featured editors. Indeed, some of the most powerful widgets used in KDE are available in the form of KParts, making construction of custom and bespoke applications much more accessible to a wide range of programmers.

Applications written in Python using the PyKDE libraries have been able to import KParts for some time. The PyKDE components framework allows Python to be used to author KParts for import into any application which is able to import KParts, irrespective of the source language used.

Requirements

A working KPart needs the following resources:

The KPart may also employ the following optional resource:

Additionally, a Python KPart requires a place to store the Python source code and possibly storage for any packages which are not situated in the Python library directory.

Examples

The following examples are supplied with the PyKDE components framework:

PyValidator

A Python version of the W3C validator example found on the developer.kde.org web site. This could be improved by adding features which allow the browser's interface to be updated when the W3C site is visited.

PySpritePart

An image viewer for Acorn (or RISC OS) Spritefiles. This isn't a particularly useful example for most users, especially since extra libraries are required to use it. However, it deals with the simple but fundamental tasks of creating widgets to be embedded, loading data and displaying images.

You will need to have installed the spritefile module to be able to use this KPart; this can be found at

    http://www.boddie.org.uk/david/Projects/Python/Spritefile/

EmbedWiki

This item is now available in a separate package.

Highlighter

This example allows the user to quickly highlight a given keyword or phrase in the HTML document currently being displayed in Konqueror. Issues such as Document Object Model (DOM) traversal and manipulation are explored as text in the document is modified and restyled.

The highlighter dialog window