PapersDocument.Document¶
- Subclasses:
 None
Methods¶
- Inherited:
 - Structs:
 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
- Inherited:
 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Properties¶
Name  | 
Type  | 
Flags  | 
Short Description  | 
|---|---|---|---|
r/w  | 
Whether the document has been modified  | 
Signals¶
- Inherited:
 
Fields¶
- Inherited:
 
Name  | 
Type  | 
Access  | 
Description  | 
|---|---|---|---|
parent_instance  | 
r  | 
Class Details¶
- class PapersDocument.Document(**kwargs)¶
 - Bases:
 - Abstract:
 Yes
- Structure:
 
- classmethod factory_add_filters(dialog, document)¶
 - Parameters:
 dialog (
Gtk.FileDialog) – aGtk.FileDialogdocument (
PapersDocument.DocumentorNone) – aPapersDocument.Document, orNone
Adds some file filters to dialog.
Always add a “All documents” format.
If document is not
None, adds aGtk.FileFilterfor document's MIME type.If document is
None, adds aGtk.FileFilterfor each document type that papers can handle.
- classmethod factory_get_document(uri)¶
 - Parameters:
 uri (
str) – an URI- Raises:
 - Returns:
 a new
PapersDocument.Document, orNone- Return type:
 
Creates a
PapersDocument.Documentfor the document at uri; or, if no backend handling the document’s type is found, or an error occurred on opening the document, returnsNoneand fills in error. If the document is encrypted, it is returned but also error is set toPapersDocument.DocumentError.ENCRYPTED.
- classmethod factory_get_document_for_fd(fd, mime_type, flags)¶
 - Parameters:
 fd (
int) – a file descriptormime_type (
str) – the mime typeflags (
PapersDocument.DocumentLoadFlags) – flags fromPapersDocument.DocumentLoadFlags
- Raises:
 - Returns:
 a new
PapersDocument.Document, orNone- Return type:
 
Synchronously creates a
PapersDocument.Documentfor the document from fd using the backend for loading documents of type mime_type; or, if the backend does not support loading from file descriptors, or an error occurred on opening the document, returnsNoneand fills in error. If the document is encrypted, it is returned but also error is set toPapersDocument.DocumentError.ENCRYPTED.If the mime type cannot be inferred from the file descriptor, and mime_type is
None, an error is returned.Note that this function takes ownership of fd; you must not ever operate on it again. It will be closed automatically if the document is destroyed, or if this function returns
None.New in version 42.0.
- classmethod factory_get_document_full(uri, flags)¶
 - Parameters:
 uri (
str) – an URIflags (
PapersDocument.DocumentLoadFlags) – flags fromPapersDocument.DocumentLoadFlags
- Raises:
 - Returns:
 a new
PapersDocument.Document, orNone- Return type:
 
Creates a
PapersDocument.Documentfor the document at uri; or, if no backend handling the document’s type is found, or an error occurred on opening the document, returnsNoneand fills in error. If the document is encrypted, it is returned but also error is set toPapersDocument.DocumentError.ENCRYPTED.
- classmethod misc_format_datetime(dt)¶
 - Parameters:
 dt (
GLib.DateTime) – aGLib.DateTime- Returns:
 a new allocated string or
Nonein the case that there was an error (such as a format specifier not being supported in the current locale). The string should be freed withGLib.free().- Return type:
 
Determine the preferred date and time representation for the current locale for dt.
New in version 3.38.
- classmethod misc_get_pointer_position(widget)¶
 - Parameters:
 widget (
Gtk.Widget) – aGtk.Widget- Returns:
 - x:
 the pointer’s “x” position, or -1 if the position is not available
- y:
 the pointer’s “y” position, or -1 if the position is not available
- Return type:
 
Get the pointer’s x and y position relative to widget.
- classmethod misc_get_widget_dpi(widget)¶
 - Parameters:
 widget (
Gtk.Widget) – aGtk.Widget- Returns:
 DPI as
float- Return type:
 
Returns sensible guess for DPI of monitor on which given widget has been realized. If HiDPI display, use 192, else 96. Returns 96 as fallback value.
- classmethod misc_pixbuf_from_surface(surface)¶
 - Parameters:
 surface (
cairo.Surface) – acairo.Surface- Returns:
 - Return type:
 
- classmethod misc_surface_from_pixbuf(pixbuf)¶
 - Parameters:
 pixbuf (
GdkPixbuf.Pixbuf) –- Return type:
 
- classmethod misc_surface_rotate_and_scale(surface, dest_width, dest_height, dest_rotation)¶
 - Parameters:
 surface (
cairo.Surface) –dest_width (
int) –dest_height (
int) –dest_rotation (
int) –
- Return type:
 
- classmethod misc_texture_from_surface(surface)¶
 - Parameters:
 surface (
cairo.Surface) – acairo.Surface- Returns:
 The converted
Gdk.Texture- Return type:
 
Convert a
cairo.SurfacetoGdk.Textureobject.
- doc_mutex_lock()¶
 
- doc_mutex_unlock()¶
 
- find_page_by_label(page_label)¶
 
- get_backend_info(info)¶
 - Parameters:
 info (
PapersDocument.DocumentBackendInfo) –- Return type:
 
- get_info()¶
 - Returns:
 - Return type:
 
Returns the
PapersDocument.DocumentInfofor the document.
- get_max_page_size()¶
 
- get_min_page_size()¶
 
- get_modified()¶
 - Returns:
 Trueiff the document has been modified.You can monitor changes to the modification state by connecting to the notify::modified signal on self.
- Return type:
 
New in version 3.28.
- get_page(index)¶
 - Parameters:
 index (
int) – index of page- Returns:
 Newly created
PapersDocument.Pagefor the given index.- Return type:
 
- get_page_size(page_index)¶
 
- get_thumbnail(rc)¶
 - Parameters:
 rc (
PapersDocument.RenderContext) – anPapersDocument.RenderContext- Returns:
 - Return type:
 
- get_thumbnail_surface(rc)¶
 - Parameters:
 rc (
PapersDocument.RenderContext) – anPapersDocument.RenderContext- Returns:
 - Return type:
 
New in version 3.14.
- load(uri)¶
 - Parameters:
 uri (
str) – the document’s URI- Raises:
 - Returns:
 - Return type:
 
Loads self from uri.
On failure,
Falseis returned and error is filled in. If the document is encrypted, PPS_DEFINE_ERROR_ENCRYPTED is returned. If the backend cannot load the specific document,PapersDocument.DocumentError.INVALIDis returned. If the backend does not support the format for the document’s contents,PapersDocument.DocumentError.UNSUPPORTED_CONTENTis returned. Other errors are possible too, depending on the backend used to load the document and the URI, e.g.GLib.IOError,GLib.FileError, andGLib.ConvertError.
- load_fd(fd, flags)¶
 - Parameters:
 fd (
int) – a file descriptorflags (
PapersDocument.DocumentLoadFlags) – flags fromPapersDocument.DocumentLoadFlags
- Raises:
 - Returns:
 Trueif loading succeeded, orFalseon error with error filled in- Return type:
 
Synchronously loads the document from fd, which must refer to a regular file.
Note that this function takes ownership of fd; you must not ever operate on it again. It will be closed automatically if the document is destroyed, or if this function returns
None.See
PapersDocument.Document.load() for more information.New in version 42.0.
- load_full(uri, flags)¶
 - Parameters:
 uri (
str) – the document’s URIflags (
PapersDocument.DocumentLoadFlags) – flags fromPapersDocument.DocumentLoadFlags
- Raises:
 - Returns:
 - Return type:
 
Loads self from uri.
On failure,
Falseis returned and error is filled in. If the document is encrypted, PPS_DEFINE_ERROR_ENCRYPTED is returned. If the backend cannot load the specific document,PapersDocument.DocumentError.INVALIDis returned. Other errors are possible too, depending on the backend used to load the document and the URI, e.g.GLib.IOError,GLib.FileError, andGLib.ConvertError.
- render(rc)¶
 - Parameters:
 rc (
PapersDocument.RenderContext) –- Return type:
 
- set_modified(modified)¶
 - Parameters:
 modified (
bool) – a boolean value to set the document as modified or not.
Set the self modification state as modified.
New in version 3.28.
- do_get_backend_info(info) virtual¶
 - Parameters:
 info (
PapersDocument.DocumentBackendInfo) –- Return type:
 
- do_get_info() virtual¶
 - Returns:
 - Return type:
 
Returns the
PapersDocument.DocumentInfofor the document.
- do_get_page(index) virtual¶
 - Parameters:
 index (
int) – index of page- Returns:
 Newly created
PapersDocument.Pagefor the given index.- Return type:
 
- do_get_page_label(page) virtual¶
 - Parameters:
 page (
PapersDocument.Page) –- Return type:
 
- do_get_page_size(page_index) virtual¶
 - Parameters:
 page_index (
PapersDocument.Page) – index of page- Returns:
 - Return type:
 
- do_get_thumbnail(rc) virtual¶
 - Parameters:
 rc (
PapersDocument.RenderContext) – anPapersDocument.RenderContext- Returns:
 - Return type:
 
- do_get_thumbnail_surface(rc) virtual¶
 - Parameters:
 rc (
PapersDocument.RenderContext) – anPapersDocument.RenderContext- Returns:
 - Return type:
 
New in version 3.14.
- do_load(uri) virtual¶
 - Parameters:
 uri (
str) – the document’s URI- Returns:
 - Return type:
 
Loads document from uri.
On failure,
Falseis returned and error is filled in. If the document is encrypted, PPS_DEFINE_ERROR_ENCRYPTED is returned. If the backend cannot load the specific document,PapersDocument.DocumentError.INVALIDis returned. If the backend does not support the format for the document’s contents,PapersDocument.DocumentError.UNSUPPORTED_CONTENTis returned. Other errors are possible too, depending on the backend used to load the document and the URI, e.g.GLib.IOError,GLib.FileError, andGLib.ConvertError.
- do_load_fd(fd, flags) virtual¶
 - Parameters:
 fd (
int) – a file descriptorflags (
PapersDocument.DocumentLoadFlags) – flags fromPapersDocument.DocumentLoadFlags
- Returns:
 Trueif loading succeeded, orFalseon error with error filled in- Return type:
 
Synchronously loads the document from fd, which must refer to a regular file.
Note that this function takes ownership of fd; you must not ever operate on it again. It will be closed automatically if the document is destroyed, or if this function returns
None.See
PapersDocument.Document.load() for more information.New in version 42.0.
- do_load_gfile(file, flags, cancellable) virtual¶
 - Parameters:
 file (
Gio.File) –flags (
PapersDocument.DocumentLoadFlags) –cancellable (
Gio.CancellableorNone) –
- Return type:
 
- do_load_stream(stream, flags, cancellable) virtual¶
 - Parameters:
 stream (
Gio.InputStream) –flags (
PapersDocument.DocumentLoadFlags) –cancellable (
Gio.CancellableorNone) –
- Return type:
 
- do_render(rc) virtual¶
 - Parameters:
 rc (
PapersDocument.RenderContext) –- Return type: