:right-sidebar: True DataSourceRequest =================================================================== .. currentmodule:: gi.repository.Shumate .. versionadded:: 1.1 .. class:: DataSourceRequest(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: DataSourceRequest(**properties) new(x:int, y:int, zoom_level:int) -> Shumate.DataSourceRequest Constructors ------------ .. rst-class:: interim-class .. class:: DataSourceRequest :no-index: .. classmethod:: new(x: int, y: int, zoom_level: int) -> ~gi.repository.Shumate.DataSourceRequest Creates a new :obj:`~gi.repository.Shumate.DataSourceRequest`. Only implementations of :obj:`~gi.repository.DataSource.start_request` should need to construct a new request object. .. versionadded:: 1.1 :param x: X coordinate of the requested tile :param y: Y coordinate of the requested tile :param zoom_level: Zoom level of the requested tile Methods ------- .. rst-class:: interim-class .. class:: DataSourceRequest :no-index: .. method:: complete() -> None Marks the request as complete. No more data or errors may be emitted. This can only be called if data has been emitted. If there is no data, use :obj:`~gi.repository.DataSourceRequest.emit_error` instead, which will automatically complete the request. .. versionadded:: 1.1 .. method:: emit_data(data: ~gi.repository.GLib.Bytes, complete: bool) -> None Emits tile data as a response to the request. This sets the :obj:`~gi.repository.Shumate.DataSourceRequest.props.data` property. If ``complete`` is :const:`True`, then :obj:`~gi.repository.Shumate.DataSourceRequest.props.completed` is set to :const:`True` as well. .. versionadded:: 1.1 :param data: the data to emit :param complete: :const:`True` to also complete the request, :const:`False` otherwise .. method:: emit_error(error: ~gi.repository.GLib.GError) -> None Emits a fatal error in response to the request. This completes the request, so no more data or errors can be emitted after this. Non-fatal errors should not be reported. If :obj:`~gi.repository.Shumate.DataSourceRequest.props.data` was previously set, it will be cleared. .. versionadded:: 1.1 :param error: an error .. method:: get_data() -> ~gi.repository.GLib.Bytes | None Gets the latest data from the request. .. versionadded:: 1.1 .. method:: get_error() -> ~gi.repository.GLib.GError | None Gets the latest error from the request. .. versionadded:: 1.1 .. method:: get_x() -> int Gets the X coordinate of the requested tile. .. versionadded:: 1.1 .. method:: get_y() -> int Gets the Y coordinate of the requested tile. .. versionadded:: 1.1 .. method:: get_zoom_level() -> int Gets the zoom level of the requested tile. .. versionadded:: 1.1 .. method:: is_completed() -> bool Gets whether the request has been completed. Completed requests will not receive new data or errors. .. versionadded:: 1.1 Properties ---------- .. rst-class:: interim-class .. class:: DataSourceRequest :no-index: .. attribute:: props.completed :type: bool :const:`True` if the request has been completed, otherwise :const:`False`. A completed request will not receive further updates to either :obj:`~gi.repository.Shumate.DataSourceRequest.props.data` or :obj:`~gi.repository.Shumate.DataSourceRequest.props.error`. .. versionadded:: 1.1 .. attribute:: props.data :type: ~gi.repository.GLib.Bytes The most recent data for the tile, if available. If an error is emitted, this will be set to :const:`None`. .. versionadded:: 1.1 .. attribute:: props.error :type: ~gi.repository.GLib.GError The error that occurred during the request, if any. .. versionadded:: 1.1 .. attribute:: props.x :type: int The X coordinate of the requested tile. .. versionadded:: 1.1 .. attribute:: props.y :type: int The Y coordinate of the requested tile. .. versionadded:: 1.1 .. attribute:: props.zoom_level :type: int The zoom level of the requested tile. .. versionadded:: 1.1 Fields ------ .. rst-class:: interim-class .. class:: DataSourceRequest :no-index: .. attribute:: parent_instance