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.
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 |
| favoriteItemsChanged (QStringList favoriteItems) |
| favoriteItemsOnlyChanged () |
| itemsUpdated () |
Methods |
| addItemToList (self, Marble.AbstractDataPluginItem item) |
| addItemsToList (self, [Marble.AbstractDataPluginItem] items) |
| clear (self) |
| downloadDescriptionFile (self, QUrl url) |
| downloadItemData (self, QUrl url, QString type, Marble.AbstractDataPluginItem item) |
QStringList | favoriteItems (self) |
QObject | favoritesModel (self) |
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) |
| getItem (self, QString id, Marble.MarbleModel model) |
bool | isFavoriteItemsOnly (self) |
bool | itemExists (self, QString id) |
[Marble.AbstractDataPluginItem] | items (self, Marble.ViewportParams viewport, Marble.MarbleModel model, int number=10) |
| parseFile (self, QByteArray file) |
| registerItemProperties (self, QMetaObject item) |
| setFavoriteItems (self, QStringList list) |
| setFavoriteItemsOnly (self, bool favoriteOnly) |
| setItemSettings (self, {QString:QVariant} itemSettings) |
[Marble.AbstractDataPluginItem] | whichItemAt (self, QPoint curpos) |
Signal Documentation
favoriteItemsChanged |
( |
QStringList |
favoriteItems |
|
) |
|
|
|
- Signal syntax:
QObject.connect(source, SIGNAL("favoriteItemsChanged(const QStringList&)"), target_slot)
favoriteItemsOnlyChanged |
( |
|
) |
|
- Signal syntax:
QObject.connect(source, SIGNAL("favoriteItemsOnlyChanged()"), target_slot)
- Signal syntax:
QObject.connect(source, SIGNAL("itemsUpdated()"), target_slot)
Method Documentation
Convenience method to add one item to the list. See addItemsToList
Adds the items to the list of initialized items. It checks if items with the same id are
already in the list and ignores and deletes them in this case.
downloadDescriptionFile |
( |
self, |
|
|
|
QUrl |
url |
|
) |
|
|
|
Download the description file from the url.
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)
QStringList favoriteItems |
( |
|
self ) |
|
QObject favoritesModel |
( |
|
self ) |
|
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
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
- 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.
Retrieve data for a specific item
- Parameters:
-
| id | Item id of the item to retrieve
|
bool isFavoriteItemsOnly |
( |
|
self ) |
|
bool itemExists |
( |
self, |
|
|
|
QString |
id |
|
) |
|
|
|
Testing the existence of the item id in the list
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.
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.
registerItemProperties |
( |
self, |
|
|
|
QMetaObject |
item |
|
) |
|
|
|
setFavoriteItems |
( |
self, |
|
|
|
QStringList |
list |
|
) |
|
|
|
setFavoriteItemsOnly |
( |
self, |
|
|
|
bool |
favoriteOnly |
|
) |
|
|
|
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.
Get all items that contain the given point
Returns a list of all items that contain the point curpos