KDE 4.9 PyKDE API Reference

- KDE's Python API

# ActionWatcher Class Reference

`from PyKDE4.kdecore import *`

Inherits: QObject
Namespace: KAuth

## Detailed Description

Class used to receive notifications about the status of an action execution.

The ActionWatcher class provides some signals useful to track the execution of an action. The Action class is designed to be very ligthweight, so it's not the case to make it a QObject subclass. This means the action object can't expose signals. This is the reason why every action (not every Action object) used by the app has an associated ActionWatcher.

You don't create watchers directly. Instead, you should get one from the Action.watcher() method, if you have an action object, or with the ActionWatcher.watcher() static method, which takes the action name string.

See the documentation of single signals for more details about them.

Since:
  4.4

## Signals

| actionPerformed (KAuth.ActionReply reply)
| actionStarted ()
| progressStep (int progress)
| progressStep ({QString:QVariant} data)
| statusChanged (int status)

## Methods

| __init__ (self)
| __init__ (self, QString action)
QString | action (self)

## Static Methods

KAuth.ActionWatcher | watcher (QString action)

## Signal Documentation

actionPerformed | ( | KAuth.ActionReply | reply
| ) |  |  |

Signal emitted when an action completed the execution

This signal provides the only way to obtain the reply from the helper in case of asynchronous calls. The reply object is the same returned by the helper, or an error reply from the library if something went wrong.

Parameters:

  | reply | The reply coming from the helper

Signal syntax:
  `QObject.connect(source, SIGNAL("actionPerformed(const KAuth::ActionReply&)"), target_slot)`

actionStarted | ( |  | ) |

Signal emitted when an action starts the execution

This signal is emitted whe In case of execute() and executeAsync(), the signal is emitted about immediately, because the request is very fast.

If you execute a group of actions using Action.executeActions(), this signal is emitted when the single action is actually about to be executed, not when the whole group starts executing. This means you can use this signal to start some kind of timeout to handle helper crashes, if you feel the need.

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

progressStep | ( | int | progress
| ) |  |  |

Signal emitted by the helper to notify the action's progress

This signal is emitted every time the helper's code calls the HelperSupport.progressStep(QVariantMap) method. This is useful to let the helper notify the execution status of a long action, also providing some data, for example if you want to achieve some sort of progressive loading. The meaning of the data passed here is totally application-dependent. If you only need to pass some percentage, you can use the other signal that pass an int.

Parameters:

  | data | The progress data from the helper

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

progressStep | ( | {QString:QVariant} | data
| ) |  |  |

Signal emitted by the helper to notify the action's progress

This signal is emitted every time the helper's code calls the HelperSupport.progressStep(QVariantMap) method. This is useful to let the helper notify the execution status of a long action, also providing some data, for example if you want to achieve some sort of progressive loading. The meaning of the data passed here is totally application-dependent. If you only need to pass some percentage, you can use the other signal that pass an int.

Parameters:

  | data | The progress data from the helper

Signal syntax:
  `QObject.connect(source, SIGNAL("progressStep(const QVariantMap&)"), target_slot)`

statusChanged | ( | int | status
| ) |  |  |

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

## Method Documentation

__init__ | ( |  | self ) |

__init__ | ( | self, |
|  | QString | action
| ) |  |  |

QString action | ( |  | self ) |

## Static Method Documentation

KAuth.ActionWatcher watcher | ( | QString | action
| ) |  |  |

Factory method to get watchers

This method allows you to obtain (and create if needed) an action watcher from the action string identifier. It's more common to obtain a watcher using Action.watcher(), which actually calls this method.

Every signal of this class is emitted whichever method you used to execute the action. This means you could connect to the signal actionPerformed() even if you're using the execute() method (which already returns the reply) and you'll get the same reply.

Parameters:

  | action | The action string identifier for the creation of the watcher

Returns:
  The action watcher associated with the given action