KDE 4.7 PyKDE API Reference

- KDE's Python API

# RunnerSyntax Class Reference

`from PyKDE4.plasma import *`

Namespace: Plasma

## Detailed Description

RunnerSyntax

Since:
  4.3

Represents a query prototype that the runner accepts. These can be created and registered with AbstractRunner.addSyntax(Syntax &) to allow applications to show to the user what the runner is currently capable of doing

## Methods
| __init__ (self, QString exampleQuery, QString description)
| __init__ (self, Plasma.RunnerSyntax other)
| addExampleQuery (self, QString exampleQuery)
QString | description (self)
QStringList | exampleQueries (self)
QStringList | exampleQueriesWithTermDescription (self)
QString | searchTermDescription (self)
| setDescription (self, QString description)
| setSearchTermDescription (self, QString description)

## Method Documentation

__init__ | ( | self, |
|  | QString | exampleQuery,
|  | QString | description
| ) |  |  |

Constructs a simple syntax object

Parameters:

  | exampleQuery | an example of the query, with :q: placed wherever search term text might appear. e.g. if the runner accepts "keyword some random text" then the value of this parameter should be "keyword :q:"
  | descrition | A description of what the described syntax does from the user's point of view.

__init__ | ( | self, |
|  | Plasma.RunnerSyntax | other
| ) |  |  |

Copy constructor

addExampleQuery | ( | self, |
|  | QString | exampleQuery
| ) |  |  |

Adds a synonymous example query to this Syntax. Some runners may accept multiple formulations of keywords to trigger the same behaviour. This allows the runner to show these relationships by grouping the example queries into one Syntax object

Parameters:

  | exampleQuery | an example of the query, with :q: placed wherever search term text might appear. e.g. if the runner accepts "keyword some random text" then the value of this parameter should be "keyword :q:"

QString description | ( |  | self ) |

Returns:
  the description of what the syntax does from the user's point of view

QStringList exampleQueries | ( |  | self ) |

Returns:
  the example queries associated with this Syntax object

QStringList exampleQueriesWithTermDescription | ( |  | self ) |

Returns:
  the example queries associated with this Syntax object, with the searchTermDescription replacing instances of :q:. Used for showing the queries in the user interface.

QString searchTermDescription | ( |  | self ) |

Returns:
  a description of the search term for this syntax

setDescription | ( | self, |
|  | QString | description
| ) |  |  |

Sets the description for the syntax, describing what it does from the user's point of view.

setSearchTermDescription | ( | self, |
|  | QString | description
| ) |  |  |

Sets the text that should be used to replace instances of :q: in the text. By default this is the generic phrase "search term". If the syntax expects a specific kind of input, it may be defined here. A syntax used by a runner that changes the brightness of the display may set this to "brightness" for instance.