Functions

backends_manager_get_document (mime_type)

backends_manager_get_document_module_name (document)

document_error_quark ()

file_compress (uri, type)

file_copy_metadata (from_, to)

file_get_mime_type (uri, fast)

file_get_mime_type_from_fd (fd)

file_is_temp (file)

file_uncompress (uri, type)

get_locale_dir ()

init ()

mkdtemp (tmpl)

mkstemp (tmpl, file_name)

mkstemp_file (tmpl)

rect_cmp (a, b)

should_use_portal ()

shutdown ()

tmp_file_unlink (file)

tmp_filename_unlink (filename)

tmp_uri_unlink (uri)

xfer_uri_simple (from_, to)

xmp_parse (xmp, size, info)

Details

EvinceDocument.backends_manager_get_document(mime_type)
Parameters:

mime_type (str) – a mime type hint

Returns:

a new EvinceDocument.Document

Return type:

EvinceDocument.Document

EvinceDocument.backends_manager_get_document_module_name(document)
Parameters:

document (EvinceDocument.Document) –

Return type:

str

EvinceDocument.document_error_quark()
Return type:

int

EvinceDocument.file_compress(uri, type)
Parameters:
Raises:

GLib.Error

Returns:

a newly allocated string URI, or None on error

Return type:

str

Compresses the file at uri.

If type is EvinceDocument.CompressionType.NONE, it does nothing and returns None.

Otherwise, it returns the filename of a temporary file containing the compressed data from the file at uri.

On error it returns None and fills in error.

It is the caller’s responsibility to unlink the temp file after use.

EvinceDocument.file_copy_metadata(from_, to)
Parameters:
  • from (str) – the source URI

  • to (str) – the target URI

Raises:

GLib.Error

Returns:

True if the attributes were copied successfully, False otherwise.

Return type:

bool

Performs a Gio.File.copy_attributes() with Gio.FileCopyFlags.ALL_METADATA from from to to.

New in version 3.4.

EvinceDocument.file_get_mime_type(uri, fast)
Parameters:
  • uri (str) – the URI

  • fast (bool) – whether to use fast MIME type detection

Raises:

GLib.Error

Returns:

a newly allocated string with the MIME type of the file at uri, or None on error or if the MIME type could not be determined

Return type:

str

EvinceDocument.file_get_mime_type_from_fd(fd)
Parameters:

fd (int) – an file descriptor (must be seekable)

Raises:

GLib.Error

Returns:

a newly allocated string with the MIME type of the file referred to by fd, or None on error or if the MIME type could not be determined

Return type:

str

EvinceDocument.file_is_temp(file)
Parameters:

file (Gio.File) –

Return type:

bool

EvinceDocument.file_uncompress(uri, type)
Parameters:
Raises:

GLib.Error

Returns:

a newly allocated string URI, or None on error

Return type:

str

Uncompresses the file at uri.

If type is EvinceDocument.CompressionType.NONE, it does nothing and returns None.

Otherwise, it returns the filename of a temporary file containing the decompressed data from the file at uri. On error it returns None and fills in error.

It is the caller’s responsibility to unlink the temp file after use.

EvinceDocument.get_locale_dir()
Return type:

str

EvinceDocument.init()
Returns:

True if any backends were found; False otherwise

Return type:

bool

Initializes the evince document library, and binds the evince gettext domain.

You must call this before calling any other function in the evince document library.

EvinceDocument.mkdtemp(tmpl)
Parameters:

tmpl (str) – a template string; must end in ‘XXXXXX’

Raises:

GLib.Error

Returns:

a newly allocated string with the temp directory name, or None on error with error filled in

Return type:

str

Creates a temp directory in the evince temp directory.

EvinceDocument.mkstemp(tmpl, file_name)
Parameters:
  • tmpl (str) – a template string; must contain ‘XXXXXX’, but not necessarily as a suffix

  • file_name (str) – a location to store the filename of the temp file

Raises:

GLib.Error

Returns:

a file descriptor to the newly created temp file name, or %-1 on error with error filled in

Return type:

int

Creates a temp file in the evince temp directory.

EvinceDocument.mkstemp_file(tmpl)
Parameters:

tmpl (str) – a template string; must contain ‘XXXXXX’, but not necessarily as a suffix

Raises:

GLib.Error

Returns:

a newly allocated Gio.File for the newly created temp file name, or None on error with error filled in

Return type:

Gio.File

Creates a temp Gio.File in the evince temp directory. See EvinceDocument.mkstemp() for more information.

EvinceDocument.rect_cmp(a, b)
Parameters:
Return type:

int

EvinceDocument.should_use_portal()
Returns:

whether evince should use the portal

Return type:

bool

Checks whether evince should use the portal.

New in version 3.30.

EvinceDocument.shutdown()

Shuts the evince document library down.

Parameters:

file (Gio.File) –

Parameters:

filename (str) –

Parameters:

uri (str) –

EvinceDocument.xfer_uri_simple(from_, to)
Parameters:
  • from (str) – the source URI

  • to (str) – the target URI

Raises:

GLib.Error

Returns:

True on success, or False on error with error filled in

Return type:

bool

Performs a Gio.File.copy() from from to to.

EvinceDocument.xmp_parse(xmp, size, info)
Parameters:
Return type:

bool