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

EditorChooser Class Reference

from PyKDE4.ktexteditor import *

Inherits: QWidget → QObject
Namespace: KTextEditor

Detailed Description

Editor Component Chooser.

Topics: - chooser_intro - chooser_gui - chooser_editor

Introduction

The EditorChooser is responsible for two different tasks: It provides - a GUI, with which the user can choose the preferred editor part - a static accessor, with which the current selected editor part can be obtained.

The GUI Editor Chooser The EditorChooser is a simple widget with a group box containing an information label and a combo box which lists all available KTextEditor implementations. To give the user the possibility to choose a text editor implementation, create an instance of this class and put it into the GUI:

 KTextEditor.EditorChooser* ec = new KTextEditor.EditorChooser(parent);
 // read the settings from the application's KConfig object
 ec->readAppSetting();
 // optionally connect the signal changed()
 // plug the widget into a layout
 layout->addWidget(ec);
Later, for example when the user clicks the Apply-button:
 // save the user's choice
 ec->writeAppSetting();
After this, the static accessor editor() will return the new editor part object. Now, either the application has to be restarted, or you need code that closes all current documents so that you can safely switch and use the new editor part. Restarting is probably much easier.

Note:
If you do not put the EditorChooser into the GUI, the default editor component will be used. The default editor is configurable in KDE's control center in "KDE Components > Component Chooser > Embedded Text Editor".

Accessing the Editor Part The call of editor() will return the currently used editor part, either the KDE default or the one configured with the EditorChooser's GUI (see chooser_gui). Example:

 KTextEditor.Editor* editor = KTextEditor.EditorChooser.editor();

See also:
KTextEditor.Editor
Author:
Joseph Wenninger <jowenn@kde.org>


Signals

 changed ()

Methods

 __init__ (self, QWidget parent=0)
 readAppSetting (self, QString postfix=QString())
 writeAppSetting (self, QString postfix=QString())

Static Methods

KTextEditor.Editor editor (QString postfix=QString(), bool fallBackToKatePart=1)

Signal Documentation

changed (   )

This signal is emitted whenever the selected item in the combo box changed.

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

Method Documentation

__init__ (  self,
QWidget  parent=0
)

Constructor.

Create an editor chooser widget.

Parameters:
parent  the parent widget

readAppSetting (  self,
QString  postfix=QString()
)

Read the configuration from the application's config file. The group is handeled internally (it is called "KTEXTEDITOR:", but it is possible to add a string to extend the group name with postfix.

Parameters:
postfix  config group postfix string

See also:
writeAppSetting()

writeAppSetting (  self,
QString  postfix=QString()
)

Write the configuration to the application's config file.

Parameters:
postfix  config group postfix string

See also:
readAppSetting()


Static Method Documentation

KTextEditor.Editor editor ( QString  postfix=QString(),
bool  fallBackToKatePart=1
)

Static accessor to get the Editor instance of the currently used KTextEditor component.

That Editor instance can be qobject-cast to specific extensions. If the result of the cast is not NULL, that extension is supported:

Parameters:
postfix  config group postfix string

Parameters:
fallBackToKatePart  if true, the returned Editor component will be a katepart if no other implementation can be found

Returns:
Editor controller or NULL, if no editor component could be found

  • 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