KDE 4.9 PyKDE API Reference

- KDE's Python API

# Engine Class Reference

`from PyKDE4.knewstuff import *`

Namespace: KNS

## Detailed Description

The KNewStuff2 engine is the top-level class to handle GHNS and DXS workflows.

An engine implements GHNS workflows, which consist of discrete steps performed by the inherited engine. Depending on the provider, traditional GHNS or DXS are used transparently. This class is the one which applications should use. In most cases, either upload() or download() will be called by the application to upload or download data.

Deprecated, use knewstuff3!

## Methods

| __init__ (self, QWidget parent=0)
| __init__ (self, KNS.Engine a0)
| downloadDialog (self)
| downloadDialog (self, QObject receiver, QString slot)
[KNS.Entry] | downloadDialogModal (self, QWidget parent=0)
bool | init (self, QString config)
| uploadDialog (self, QString file)
KNS.Entry | uploadDialogModal (self, QString file)

## Static Methods

[KNS.Entry] | download ()
KNS.Entry | upload (QString file)

## Method Documentation

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

Engine constructor.

As many engines as needed can be instantiated, although one should use the static methods download() and upload() instead.

__init__ | ( | self, |
|  | KNS.Engine | a0
| ) |  |  |

downloadDialog | ( |  | self ) |

Asynchronous way of starting the download workflow and getting feedback to a slot when the dialog closes.

This method should be used whenever a blocking application with a non-blocking GUI during GHNS operations is not suitable. the slot passed in should have the signature (KNS.Entry.List) as its parameter

See also:
  downloadDialogModal()

downloadDialog | ( | self, |
|  | QObject | receiver,
|  | QString | slot
| ) |  |  |

Asynchronous way of starting the download workflow and getting feedback to a slot when the dialog closes.

This method should be used whenever a blocking application with a non-blocking GUI during GHNS operations is not suitable. the slot passed in should have the signature (KNS.Entry.List) as its parameter

See also:
  downloadDialogModal()

[KNS.Entry] downloadDialogModal | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Synchronous way of starting the download workflow.

Starts the download workflow. This workflow will turn up a dialog where the user can select entries for installation and uninstallation. This method is a modal one. It will return all affected entries as a list.

NOTE: this list must be queried to see which ones were installed and which were uninstalled since both are in the one list. i.e. (entry->status() == KNS.Entry.Installed) NOTE: the list returned is not a copy of each entry, so do not delete the entries returned here

Returns:
  List of installed or deinstalled entries

bool init | ( | self, |
|  | QString | config
| ) |  |  |

uploadDialog | ( | self, |
|  | QString | file
| ) |  |  |

Asynchronous way of starting the upload workflow.

This method should be used whenever a blocking application with a non-blocking GUI during GHNS operations is not suitable. The affected entry will be reported by signals.

See also:
  uploadDialogModal()

KNS.Entry uploadDialogModal | ( | self, |
|  | QString | file
| ) |  |  |

Synchronous way of starting the upload workflow.

Starts the upload workflow. This workflow will offer provider selection and afterwards upload all files associated with an entry. This method is a modal one. It will return the uploaded entry.

Returns:
  Uploaded entry, or null in case of failures

## Static Method Documentation

[KNS.Entry] download | ( |  | ) |

Recommended download workflow entry point.

This method is a static convenience wrapper around downloadDialogModal() which does not require the manual construction of an engine object. The engine will be configured to load appname.knsrc. The resulting entry list must not be freed, as the engine will continue to keep track of it.

Returns:
  List of installed or deinstalled entries NOTE: this is a copy of each entry because this call deletes its own engine which deletes the original entries, so you need to delete the entries returned in the list

See also:
  downloadDialogModal()

KNS.Entry upload | ( | QString | file
| ) |  |  |

Recommended upload workflow entry point.

This method is a static convenience wrapper around uploadDialogModal() which does not require the manual construction of an engine object. The engine will be configured to load appname.knsrc. The resulting entry must not be freed, as the engine will continue to keep track of it.

Returns:
  Uploaded entry, or null in case of failures

See also:
  uploadDialogModal()