KDE 4.7 PyKDE API Reference

- KDE's Python API

# AbstractDataPluginModel Class Reference

`from PyKDE4.marble import *`

Inherits: QObject
Namespace: Marble

## Detailed Description

Abstract class:
  This class can be used as a base class for new classes, but can not be instantiated directly.

@short: An abstract data model (not based on QAbstractModel) for a AbstractDataPlugin.

This class is an abstract model for a AbstractDataPlugin. It provides the storage and selection of added items and it is also responsible for downloading item data.

The functions getAdditionalItems() and parseFile() have to be reimplemented in a subclass.

## Signals
| itemsUpdated ()
## Methods
| __init__ (self, QString name, PluginManager pluginManager, QObject parent=0)
| addItemToList (self, Marble.AbstractDataPluginItem item)
| downloadDescriptionFile (self, QUrl url)
| downloadItemData (self, QUrl url, QString type, Marble.AbstractDataPluginItem item)
bool | fileExists (self, QString fileName)
bool | fileExists (self, QString id, QString type)
Marble.AbstractDataPluginItem | findItem (self, QString id)
QString | generateFilename (self, QString id, QString type)
QString | generateFilepath (self, QString id, QString type)
| getAdditionalItems (self, Marble.GeoDataLatLonAltBox box, Marble.MarbleModel model, int number=10)
bool | itemExists (self, QString id)
[Marble.AbstractDataPluginItem] | items (self, Marble.ViewportParams viewport, Marble.MarbleModel model, int number=10)
QString | name (self)
| parseFile (self, QByteArray file)
| setItemSettings (self, {QString:QVariant} itemSettings)
| setName (self, QString name)
[Marble.AbstractDataPluginItem] | whichItemAt (self, QPoint curpos)

## Signal Documentation

itemsUpdated | ( |  | ) |

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

## Method Documentation

__init__ | ( | self, |
|  | QString | name,
|  | PluginManager | pluginManager,
|  | QObject | parent=0
| ) |  |  |

addItemToList | ( | self, |
|  | Marble.AbstractDataPluginItem | item
| ) |  |  |

Adds the item to the list of initialized items. It checks if a item with the same id is already in the list and ignores and deletes the item in this case.

downloadDescriptionFile | ( | self, |
|  | QUrl | url
| ) |  |  |

Download the description file from the url.

downloadItemData | ( | self, |
|  | QUrl | url,
|  | QString | type,
|  | Marble.AbstractDataPluginItem | item
| ) |  |  |

Downloads the file from url. item -> addDownloadedFile() will be called when the download is finished. Additionally initialized() items will be added to the item list after the download. It checks if a item with the same id is already in the list and ignores and deletes the item in this case. @param: The type of the download (to be specified by the subclasser)

bool fileExists | ( | self, |
|  | QString | fileName
| ) |  |  |

Testing the existence of a file with id and type

bool fileExists | ( | self, |
|  | QString | id,
|  | QString | type
| ) |  |  |

Testing the existence of a file with id and type

Marble.AbstractDataPluginItem findItem | ( | self, |
|  | QString | id
| ) |  |  |

Finds the item with id in the list.

Returns:
  The pointer to the item or (if no item has been found) 0

QString generateFilename | ( | self, |
|  | QString | id,
|  | QString | type
| ) |  |  |

Generates the filename relative to the download path from id and type

QString generateFilepath | ( | self, |
|  | QString | id,
|  | QString | type
| ) |  |  |

Generates the absolute filepath of the from id and type

getAdditionalItems | ( | self, |
|  | Marble.GeoDataLatLonAltBox | box,
|  | Marble.MarbleModel | model,
|  | int | number=10
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Managing to get number additional items in box. This includes generating a url and downloading the corresponding file. This method has to be implemented in a subclass.

bool itemExists | ( | self, |
|  | QString | id
| ) |  |  |

Testing the existence of the item id in the list

[Marble.AbstractDataPluginItem] items | ( | self, |
|  | Marble.ViewportParams | viewport,
|  | Marble.MarbleModel | model,
|  | int | number=10
| ) |  |  |

Get the items on the viewport Returns the currently downloaded images in the viewport. The maximum number of images can be specified with number, 0 means no limit.

Returns:
  The list of item with most important item first.

QString name | ( |  | self ) |

Returns the name of the plugin

parseFile | ( | self, |
|  | QByteArray | file
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Parse the file and generate items. The items will be added to the list or the method starts additionally needed downloads. This method has to be implemented in a subclass.

setItemSettings | ( | self, |
|  | {QString:QVariant} | itemSettings
| ) |  |  |

Sets the settings for all items. Sets the settings for all items before painting. This ensures that all items react on changed settings.

setName | ( | self, |
|  | QString | name
| ) |  |  |

Change the name of the plugin

[Marble.AbstractDataPluginItem] whichItemAt | ( | self, |
|  | QPoint | curpos
| ) |  |  |

Get all items that contain the given point Returns a list of all items that contain the point curpos