KDE 4.9 PyKDE API Reference

- KDE's Python API

# RangeCommand Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

Extension interface for a Command making the exec method take a line range

Introduction

The RangeCommand extension extends the Command interface by making it possible to send a range to a command indicating that it should only do its work on those lines.

The method supportsRange() takes a QString reference and should return true if the given command name supports a range and false if not.

See also:
  KTextEditor.CommandInterface, KTextEditor.Command, KTextEditor.Range

Author:
  Erlend Hamberg <ehamberg@gmail.com>

Since:
  4.2

Note:
  KDE5: merge with KTextEditor.Command?

## Methods

bool | exec (self, KTextEditor.View view, QString cmd, QString msg, KTextEditor.Range range)
bool | supportsRange (self, QString cmd)

## Method Documentation

bool exec | ( | self, |
|  | KTextEditor.View | view,
|  | QString | cmd,
|  | QString | msg,
|  | KTextEditor.Range | range
| ) |  |  |

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

Execute the command for the given range on the given view and \p cmd string. Return the success value and a msg for status.

Returns:
  true on success, otherwise false

bool supportsRange | ( | self, |
|  | QString | cmd
| ) |  |  |

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

Find out if a given command can act on a range. This is used for checking if a command should be called when the user also gave a range or if an error should be raised.

Returns:
  true if command supports acting on a range of lines, false if not