Example #1
0
File: plugin.py Project: KDE/silk
def request():
    """Called when plugin data are requested.

    When this function is called, Location data are valid. In this function
    should be set data for provider.
    Data are set with Provider.serProperty(pluginName, key, value) method. This
    method can by called multiple times, all keys are added to this plugin
    datasource.
    At the end, when all data are set, Provider.done(pluginName) method has to
    be called indicating that all data are ready and set.

    Location methods:
    QString getCountryCode();
    QString getCountry();
    QString getCity();
    QString getAddress(); // this method is usefull only when user has chosen
                          // manual configuration of location, otherwise its
                          // return is empty
    QString getLongitude();
    QString getLatitude();
    double getRange();    // range in KM around location for which user wants
                          // information

    Provider methods:
    void setProperty(QString source, QString key, QString value);
    void done(const QString source);
    """
    Provider.setProperty(PLUGIN_NAME, "Hello!", "You are in %s." %
        Location.getCity())
    Provider.done(PLUGIN_NAME)