:right-sidebar: True SpaceDrawer =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: SpaceDrawer(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: SpaceDrawer(**properties) new() -> GtkSource.SpaceDrawer Constructors ------------ .. rst-class:: interim-class .. class:: SpaceDrawer :no-index: .. classmethod:: new() -> ~gi.repository.GtkSource.SpaceDrawer Creates a new :obj:`~gi.repository.GtkSource.SpaceDrawer` object. Useful for storing space drawing settings independently of a :obj:`~gi.repository.GtkSource.View`. Methods ------- .. rst-class:: interim-class .. class:: SpaceDrawer :no-index: .. method:: bind_matrix_setting(settings: ~gi.repository.Gio.Settings, key: str, flags: ~gi.repository.Gio.SettingsBindFlags) -> None Binds the :obj:`~gi.repository.GtkSource.SpaceDrawer.props.matrix` property to a :obj:`~gi.repository.Gio.Settings` key. The :obj:`~gi.repository.Gio.Settings` key must be of the same type as the :obj:`~gi.repository.GtkSource.SpaceDrawer.props.matrix` property, that is, ``"au"``. The :obj:`~gi.repository.Gio.Settings.bind` function cannot be used, because the default GIO mapping functions don't support :obj:`~gi.repository.GLib.Variant` properties (maybe it will be supported by a future GIO version, in which case this function can be deprecated). :param settings: a :obj:`~gi.repository.Gio.Settings` object. :param key: the ``settings`` key to bind. :param flags: flags for the binding. .. method:: get_enable_matrix() -> bool .. method:: get_matrix() -> ~gi.repository.GLib.Variant Gets the value of the :obj:`~gi.repository.GtkSource.SpaceDrawer.props.matrix` property, as a :obj:`~gi.repository.GLib.Variant`. An empty array can be returned in case the matrix is a zero matrix. The :obj:`~gi.repository.SpaceDrawer.get_types_for_locations` function may be more convenient to use. .. method:: get_types_for_locations(locations: ~gi.repository.GtkSource.SpaceLocationFlags) -> ~gi.repository.GtkSource.SpaceTypeFlags If only one location is specified, this function returns what kind of white spaces are drawn at that location. The value is retrieved from the :obj:`~gi.repository.GtkSource.SpaceDrawer.props.matrix` property. If several locations are specified, this function returns the logical AND for those locations. Which means that if a certain kind of white space is present in the return value, then that kind of white space is drawn at all the specified ``locations``. :param locations: one or several :obj:`~gi.repository.GtkSource.SpaceLocationFlags`. .. method:: set_enable_matrix(enable_matrix: bool) -> None Sets whether the :obj:`~gi.repository.GtkSource.SpaceDrawer.props.matrix` property is enabled. :param enable_matrix: the new value. .. method:: set_matrix(matrix: ~gi.repository.GLib.Variant | None = None) -> None Sets a new value to the :obj:`~gi.repository.GtkSource.SpaceDrawer.props.matrix` property, as a :obj:`~gi.repository.GLib.Variant`. If ``matrix`` is :const:`None`, then an empty array is set. If ``matrix`` is floating, it is consumed. The :obj:`~gi.repository.SpaceDrawer.set_types_for_locations` function may be more convenient to use. :param matrix: the new matrix value, or :const:`None`. .. method:: set_types_for_locations(locations: ~gi.repository.GtkSource.SpaceLocationFlags, types: ~gi.repository.GtkSource.SpaceTypeFlags) -> None Modifies the :obj:`~gi.repository.GtkSource.SpaceDrawer.props.matrix` property at the specified ``locations``. :param locations: one or several :obj:`~gi.repository.GtkSource.SpaceLocationFlags`. :param types: a combination of :obj:`~gi.repository.GtkSource.SpaceTypeFlags`. Properties ---------- .. rst-class:: interim-class .. class:: SpaceDrawer :no-index: .. attribute:: props.enable_matrix :type: bool Whether the :obj:`~gi.repository.GtkSource.SpaceDrawer.props.matrix` property is enabled. .. attribute:: props.matrix :type: ~gi.repository.GLib.Variant The property is a :obj:`~gi.repository.GLib.Variant` property to specify where and what kind of white spaces to draw. The :obj:`~gi.repository.GLib.Variant` is of type ``"au"``, an array of unsigned integers. Each integer is a combination of :obj:`~gi.repository.GtkSource.SpaceTypeFlags`. There is one integer for each :obj:`~gi.repository.GtkSource.SpaceLocationFlags`, in the same order as they are defined in the enum (:const:`~gi.repository.GtkSource.SpaceLocationFlags.NONE` and :const:`~gi.repository.GtkSource.SpaceLocationFlags.ALL` are not taken into account). If the array is shorter than the number of locations, then the value for the missing locations will be :const:`~gi.repository.GtkSource.SpaceTypeFlags.NONE`. By default, :const:`~gi.repository.GtkSource.SpaceTypeFlags.ALL` is set for all locations.4