KTextEditor.ConfigInterface

KDE 4.9 PyKDE API Reference

- KDE's Python API

# ConfigInterface Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

Config interface extension for the Document and View.

Introduction

The ConfigInterface provides methods to access and modify the low level config information for a given Document or View. Examples of this config data can be displaying the icon bar, showing line numbers, etc. This generally allows access to settings that otherwise are only accessible during runtime.

Accessing the Interface

The ConfigInterface is supposed to be an extension interface for a Document or View, i.e. the Document or View inherits the interface provided that the KTextEditor library in use implements the interface. Use qobject_cast to access the interface:

     // ptr is of type KTextEditor.Document* or KTextEditor.View*
     KTextEditor.ConfigInterface *iface =
         qobject_cast<KTextEditor.ConfigInterface*>( ptr );

     if( iface ) {

         // the implementation supports the interface
         // do stuff
     }

Accessing Data

A list of available config variables (or keys) can be optained by calling configKeys(). For all available keys configValue() returns the corresponding value as QVariant. A value for a given key can be set by calling setConfigValue(). Right now, when using KatePart as editor component, KTextEditor.View has support for the following tuples: - line-numbers [bool], show/hide line numbers - icon-bar [bool], show/hide icon bar - folding-bar [bool], show/hide the folding bar - dynamic-word-wrap [bool], enable/disable dynamic word wrap - background-color [QColor], read/set the default background color - selection-color [QColor], read/set the default color for selections - search-highlight-color [QColor], read/set the background color for search - replace-highlight-color [QColor], read/set the background color for replaces - default-mark-type [uint], read/set the default mark type - allow-mark-menu [bool], enable/disable the menu shown when right clicking on the left gutter. When disabled, click on the gutter will always set or clear the mark of default type.

KTextEditor.Document has support for the following: - backup-on-save-local [bool], enable/disable backup when saving local files - backup-on-save-remote [bool], enable/disable backup when saving remote files - backup-on-save-suffix [string], set the suffix for file backups, e.g. "~" - backup-on-save-prefix [string], set the prefix for file backups, e.g. "."

Either interface should emit the configChanged signal when appropriate. TODO: Add to interface in KDE 5.

For instance, if you want to enable dynamic word wrap of a KTextEditor.View simply call

     iface->setConfigValue("dynamic-word-wrap", true);

See also:
  KTextEditor.View, KTextEditor.Document

Author:
  Matt Broadstone <mbroadst@gmail.com>

## Methods
| __init__ (self)
QStringList | configKeys (self)
QVariant | configValue (self, QString key)
| setConfigValue (self, QString key, QVariant value)

## Method Documentation

__init__ | ( |  | self ) |

QStringList configKeys | ( |  | self ) |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Get a list of all available keys.

QVariant configValue | ( | self, |
|  | QString | key
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Get a value for the key.

setConfigValue | ( | self, |
|  | QString | key,
|  | QVariant | value
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Set a the key's value to value.