Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- PapersDocument.backend_query_type()¶
- Return type:
- PapersDocument.file_compress(uri, type)¶
- Parameters:
uri (
str) – a file URItype (
PapersDocument.CompressionType) – the compression type
- Raises:
- Returns:
a newly allocated string URI, or
Noneon error- Return type:
Compresses the file at uri.
If type is
PapersDocument.CompressionType.NONE, it does nothing and returnsNone.Otherwise, it returns the filename of a temporary file containing the compressed data from the file at uri.
On error it returns
Noneand fills in error.It is the caller’s responsibility to unlink the temp file after use.
- PapersDocument.file_copy_metadata(from_, to)¶
- Parameters:
- Raises:
- Returns:
Trueif the attributes were copied successfully,Falseotherwise.- Return type:
Performs a
Gio.File.copy_attributes() withGio.FileCopyFlags.ALL_METADATAfrom from to to.
- PapersDocument.file_get_mime_type(uri, fast)¶
- Parameters:
- Raises:
- Returns:
a newly allocated string with the MIME type of the file at uri, or
Noneon error or if the MIME type could not be determined- Return type:
- PapersDocument.file_get_mime_type_from_fd(fd)¶
- PapersDocument.file_uncompress(uri, type)¶
- Parameters:
uri (
str) – a file URItype (
PapersDocument.CompressionType) – the compression type
- Raises:
- Returns:
a newly allocated string URI, or
Noneon error- Return type:
Uncompresses the file at uri.
If type is
PapersDocument.CompressionType.NONE, it does nothing and returnsNone.Otherwise, it returns the filename of a temporary file containing the decompressed data from the file at uri. On error it returns
Noneand fills in error.It is the caller’s responsibility to unlink the temp file after use.
- PapersDocument.init()¶
-
Initializes the papers document library, and binds the papers gettext domain.
You must call this before calling any other function in the papers document library.
- PapersDocument.mkstemp(tmpl)¶
- Parameters:
tmpl (
str) – a template string; must contain ‘XXXXXX’, but not necessarily as a suffix- Raises:
- Returns:
a file descriptor to the newly created temp file name, or %-1 on error with error filled in
- file_name:
a location to store the filename of the temp file
- Return type:
Creates a temp file in the papers temp directory.
- PapersDocument.mkstemp_file(tmpl)¶
- Parameters:
tmpl (
str) – a template string; must contain ‘XXXXXX’, but not necessarily as a suffix- Raises:
- Returns:
a newly allocated
Gio.Filefor the newly created temp file name, orNoneon error with error filled in- Return type:
Creates a temp
Gio.Filein the papers temp directory. SeePapersDocument.mkstemp() for more information.
- PapersDocument.rect_cmp(a, b)¶
- Parameters:
a (
PapersDocument.Rectangle) –b (
PapersDocument.Rectangle) –
- Return type:
- PapersDocument.shutdown()¶
Shuts the papers document library down.
- PapersDocument.xfer_uri_simple(from_, to)¶
- Parameters:
- Raises:
- Returns:
- Return type:
Performs a
Gio.File.copy() from from to to.
- PapersDocument.xmp_parse(metadata, size, info)¶
- Parameters:
metadata (
str) – XMP document datasize (
int) – size of metadata in bytesinfo (
PapersDocument.DocumentInfo) – target to update
- Returns:
Trueiff metadata could be successfully parsed- Return type:
Parse XMP based document metadata into [struct`DocumentInfo`]