KDE 4.2 PyKDE API Reference

- KDE's Python API

# RunnerContext Class Reference

`from PyKDE4.plasma import *`

Inherits: QObject
Namespace: Plasma

## Detailed Description

RunnerContext plasma/runnercontext.h <Plasma/RunnerContext>

The RunnerContext class provides information related to a search, including the search term, metadata on the search term and collected matches.

## Enumerations

Type | { None, UnknownType, Directory, File, NetworkLocation, Executable, ShellCommand, Help, FileSystem }

## Signals

| matchesChanged ()

## Methods

| __init__ (self, QObject parent=0)
| __init__ (self, Plasma.RunnerContext other, QObject parent=0)
bool | addMatch (self, QString term, Plasma.QueryMatch match)
bool | addMatches (self, QString term, [Plasma.QueryMatch] matches)
Plasma.QueryMatch | match (self, QString id)
[Plasma.QueryMatch] | matches (self)
| matchesChanged (self)
QString | mimeType (self)
QString | query (self)
| reset (self)
| setQuery (self, QString term)
Plasma.RunnerContext.Type | type (self)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent=0
| ) |  |  |

__init__ | ( | self, |
|  | Plasma.RunnerContext | other,
|  | QObject | parent=0
| ) |  |  |

Copy constructor

bool addMatch | ( | self, |
|  | QString | term,
|  | Plasma.QueryMatch | match
| ) |  |  |

Appends a match to the existing list of matches.

If you are going to be adding multiple matches, use addMatches instead.

@arg term the search term that this match was generated for. @arg match the match to add

Returns:
  true if the match was added, false otherwise.

bool addMatches | ( | self, |
|  | QString | term,
|  | [Plasma.QueryMatch] | matches
| ) |  |  |

Appends lists of matches to the list of matches.

This method is thread safe and causes the matchesChanged() signal to be emitted.

Returns:
  true if matches were added, false if matches were e.g. outdated

Plasma.QueryMatch match | ( | self, |
|  | QString | id
| ) |  |  |

Retrieves a match by id.

Parameters:

  | id | the id of the match to return

Returns:
  the match associated with this id, or an invalid QueryMatch object if the id does not eixst

[Plasma.QueryMatch] matches | ( |  | self ) |

Retrieves all available matches for the current search term.

Returns:
  a list of matches

matchesChanged | ( |  | self ) |

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

QString mimeType | ( |  | self ) |

The mimetype that the search term refers to, if discoverable.

Returns:
  QString() if the mimetype can not be determined, otherwise the mimetype of the object being referred to by the search string.

QString query | ( |  | self ) |

Returns:
  the current search query term.

reset | ( |  | self ) |

Resets the search term for this object. This removes all current matches in the process.

setQuery | ( | self, |
|  | QString | term
| ) |  |  |

Sets the query term for this object and attempts to determine the type of the search.

Plasma.RunnerContext.Type type | ( |  | self ) |

The type of item the search term might refer to.

See also:
  Type

## Enumeration Documentation

Type

Enumerator:

  None = 0 |
  UnknownType = 1 |
  Directory = 2 |
  File = 4 |
  NetworkLocation = 8 |
  Executable = 16 |
  ShellCommand = 32 |
  Help = 64 |
  FileSystem = Directory|File|Executable|ShellCommand |