KDE 4.3 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.

## Methods

| __init__ (self, QString name, 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)
QString | generateFilename (self, QString id, QString type)
QString | generateFilepath (self, QString id, QString type)
| getAdditionalItems (self, Marble.GeoDataLatLonAltBox box, Marble.MarbleDataFacade facade, int number=10)
bool | itemExists (self, QString id)
[Marble::AbstractDataPluginIte] | items (self, Marble.ViewportParams viewport, Marble.MarbleDataFacade facade, int number=10)
QString | name (self)
| parseFile (self, QByteArray file)
| setName (self, QString name)
[Marble::AbstractDataPluginIte] | whichItemAt (self, QPoint curpos)

## Method Documentation

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

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

Adds the item to the list of initialized items.

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. @param: The type of the download (to be specified by the subclasser)

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

Testing the existence of the file fileName

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

Testing the existence of a file with id and type

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.MarbleDataFacade | facade,
|  | 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::AbstractDataPluginIte] items | ( | self, |
|  | Marble.ViewportParams | viewport,
|  | Marble.MarbleDataFacade | facade,
|  | 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.

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

Change the name of the plugin

[Marble::AbstractDataPluginIte] whichItemAt | ( | self, |
|  | QPoint | curpos
| ) |  |  |

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