DataSource#
Superclasses: Object
Subclasses: TileDownloader
The base class used to retrieve tiles as Bytes
.
Methods#
- class DataSource
- do_get_tile_data_async(self, x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None #
- Parameters:
x
y
zoom_level
cancellable
callback
user_data
- do_get_tile_data_finish(self, result: AsyncResult) Bytes | None #
- Parameters:
result
- do_start_request(self, x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None) DataSourceRequest #
- Parameters:
x
y
zoom_level
cancellable
- get_tile_data_async(x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None #
Gets the data for the tile at the given coordinates.
Some data sources may return data multiple times. For example,
TileDownloader
may return data from a cache, then return updated data from the network.received_data
is emitted each time data is received, thencallback
is called after the last update.- Parameters:
x – the X coordinate to fetch
y – the Y coordinate to fetch
zoom_level – the Z coordinate to fetch
cancellable – a
Cancellable
callback – a
AsyncReadyCallback
to execute upon completionuser_data – closure data for
callback
- get_tile_data_finish(result: AsyncResult) Bytes | None #
Gets the final result of a request started with
get_tile_data_async()
.- Parameters:
result – a
AsyncResult
provided to callback
- set_max_zoom_level(zoom_level: int) None #
Sets the data source’s maximum zoom level.
Added in version 1.1.
- Parameters:
zoom_level – the maximum zoom level
- set_min_zoom_level(zoom_level: int) None #
Sets the data source’s minimum zoom level.
Added in version 1.1.
- Parameters:
zoom_level – the minimum zoom level
- start_request(x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None) DataSourceRequest #
Begins a request for a tile.
Added in version 1.1.
- Parameters:
x – X coordinate to request
y – Y coordinate to request
zoom_level – zoom level to request
cancellable – for cancelling the request
Properties#
Signals#
- class DataSource.signals
- received_data(x: int, y: int, zoom_level: int, bytes: Bytes) None #
The type of the None singleton.
Deprecated since version 1.1: Use
start_request
and connect to the notify signals of the resultingDataSourceRequest
.- Parameters:
x – the X coordinate of the tile
y – the Y coordinate of the tile
zoom_level – the zoom level of the tile
bytes – the received data
Virtual Methods#
- class DataSource
- do_get_tile_data_async(x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None #
Gets the data for the tile at the given coordinates.
Some data sources may return data multiple times. For example,
TileDownloader
may return data from a cache, then return updated data from the network.received_data
is emitted each time data is received, thencallback
is called after the last update.- Parameters:
x – the X coordinate to fetch
y – the Y coordinate to fetch
zoom_level – the Z coordinate to fetch
cancellable – a
Cancellable
callback – a
AsyncReadyCallback
to execute upon completionuser_data – closure data for
callback
- do_get_tile_data_finish(result: AsyncResult) Bytes | None #
Gets the final result of a request started with
get_tile_data_async()
.- Parameters:
result – a
AsyncResult
provided to callback
- do_start_request(x: int, y: int, zoom_level: int, cancellable: Cancellable | None = None) DataSourceRequest #
Begins a request for a tile.
Added in version 1.1.
- Parameters:
x – X coordinate to request
y – Y coordinate to request
zoom_level – zoom level to request
cancellable – for cancelling the request
Fields#
- class DataSource
- parent_instance#