:right-sidebar: True File =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: File(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: File(**properties) new() -> GtkSource.File Constructors ------------ .. rst-class:: interim-class .. class:: File :no-index: .. classmethod:: new() -> ~gi.repository.GtkSource.File Methods ------- .. rst-class:: interim-class .. class:: File :no-index: .. method:: check_file_on_disk() -> None Checks synchronously the file on disk, to know whether the file is externally modified, or has been deleted, and whether the file is read-only. :obj:`~gi.repository.GtkSource.File` doesn't create a :obj:`~gi.repository.Gio.FileMonitor` to track those properties, so this function needs to be called instead. Creating lots of :obj:`~gi.repository.Gio.FileMonitor`'s would take lots of resources. Since this function is synchronous, it is advised to call it only on local files. See :obj:`~gi.repository.File.is_local`. .. method:: get_compression_type() -> ~gi.repository.GtkSource.CompressionType .. method:: get_encoding() -> ~gi.repository.GtkSource.Encoding The encoding is initially :const:`None`. After a successful file loading or saving operation, the encoding is non-:const:`None`. .. method:: get_location() -> ~gi.repository.Gio.File .. method:: get_newline_type() -> ~gi.repository.GtkSource.NewlineType .. method:: is_deleted() -> bool Returns whether the file has been deleted. If the :obj:`~gi.repository.GtkSource.File.props.location` is :const:`None`, returns :const:`False`. To have an up-to-date value, you must first call :obj:`~gi.repository.File.check_file_on_disk`. .. method:: is_externally_modified() -> bool Returns whether the file is externally modified. If the :obj:`~gi.repository.GtkSource.File.props.location` is :const:`None`, returns :const:`False`. To have an up-to-date value, you must first call :obj:`~gi.repository.File.check_file_on_disk`. .. method:: is_local() -> bool Returns whether the file is local. If the :obj:`~gi.repository.GtkSource.File.props.location` is :const:`None`, returns :const:`False`. .. method:: is_readonly() -> bool Returns whether the file is read-only. If the :obj:`~gi.repository.GtkSource.File.props.location` is :const:`None`, returns :const:`False`. To have an up-to-date value, you must first call :obj:`~gi.repository.File.check_file_on_disk`. .. method:: set_location(location: ~gi.repository.Gio.File | None = None) -> None Sets the location. :param location: the new :obj:`~gi.repository.Gio.File`, or :const:`None`. Properties ---------- .. rst-class:: interim-class .. class:: File :no-index: .. attribute:: props.compression_type :type: ~gi.repository.GtkSource.CompressionType The compression type. .. attribute:: props.encoding :type: ~gi.repository.GtkSource.Encoding The character encoding, initially :const:`None`. After a successful file loading or saving operation, the encoding is non-:const:`None`. .. attribute:: props.location :type: ~gi.repository.Gio.File The location. .. attribute:: props.newline_type :type: ~gi.repository.GtkSource.NewlineType The line ending type. .. attribute:: props.read_only :type: bool Whether the file is read-only or not. The value of this property is not updated automatically (there is no file monitors). Fields ------ .. rst-class:: interim-class .. class:: File :no-index: .. attribute:: parent_instance