KDE 4.9 PyKDE API Reference

- KDE's Python API

# CommandInterface Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

Command extension interface for the Editor.

Introduction

The CommandInterface extends the Editor to support command line commands. An application or a Plugin can register new commands by using registerCommand(). To unregister a command call unregisterCommand(). To check, whether a command with a given name exists use queryCommand().

Accessing the CommandInterface

The CommandInterface is supposed to be an extension interface for the Editor, i.e. the Editor inherits the interface provided that the used KTextEditor library implements the interface. Use qobject_cast to access the interface:

     // editor is of type KTextEditor.Editor*
     KTextEditor.CommandInterface *iface =
         qobject_cast<KTextEditor.CommandInterface*>( editor );

     if( iface ) {
         // the implementation supports the interface
         // do stuff
     }

See also:
  KTextEditor.Editor, KTextEditor.Command, KTextEditor.CommandExtension

Author:
  Christoph Cullmann <cullmann@kde.org>

## Methods
QStringList | commandList (self)
[KTextEditor.Command] | commands (self)
KTextEditor.Command | queryCommand (self, QString cmd)
bool | registerCommand (self, KTextEditor.Command cmd)
bool | unregisterCommand (self, KTextEditor.Command cmd)

## Method Documentation

QStringList commandList | ( |  | self ) |

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

Get a list of available command line strings.

Returns:
  command line strings

See also:
  commands()

[KTextEditor.Command] commands | ( |  | self ) |

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

Get a list of all registered commands.

Returns:
  list of all commands

See also:
  queryCommand(), commandList()

KTextEditor.Command queryCommand | ( | self, |
|  | QString | cmd
| ) |  |  |

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

Query for the command cmd. If the command cmd does not exist the return value is NULL.

Parameters:

  | cmd | name of command to query for

Returns:
  the found command or NULL if no such command exists

bool registerCommand | ( | self, |
|  | KTextEditor.Command | cmd
| ) |  |  |

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

Register a the new command cmd. The command will be registered for all documents, i.e. every command is global.

Parameters:

  | cmd | command to register

Returns:
  true on success, otherwise false

See also:
  unregisterCommand()

bool unregisterCommand | ( | self, |
|  | KTextEditor.Command | cmd
| ) |  |  |

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

Unregister the command cmd. The command will be unregistered for all documents.

Parameters:

  | cmd | command to unregister

Returns:
  true on success, otherwise false

See also:
  registerCommand()