EvinceDocument.Document¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
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 |
|---|---|---|---|
base |
r |
Class Details¶
- class EvinceDocument.Document(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
- classmethod doc_mutex_lock()¶
- classmethod doc_mutex_unlock()¶
- classmethod factory_add_filters(chooser, document)¶
- Parameters:
chooser (
Gtk.Widget) – aGtk.FileChooserdocument (
EvinceDocument.Document) – aEvinceDocument.Document, orNone
Adds some file filters to chooser.
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 evince can handle.
- classmethod factory_get_document(uri)¶
- Parameters:
uri (
str) – an URI- Raises:
- Returns:
a new
EvinceDocument.Document, orNone- Return type:
Creates a
EvinceDocument.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 toEvinceDocument.DocumentError.ENCRYPTED.
- classmethod factory_get_document_for_fd(fd, mime_type, flags, cancellable)¶
- Parameters:
fd (
int) – a file descriptormime_type (
str) – the mime typeflags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlagscancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Raises:
- Returns:
a new
EvinceDocument.Document, orNone- Return type:
Synchronously creates a
EvinceDocument.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 toEvinceDocument.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_for_gfile(file, flags, cancellable)¶
- Parameters:
flags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlagscancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Raises:
- Returns:
a new
EvinceDocument.Document, orNone- Return type:
Synchronously creates a
EvinceDocument.Documentfor the document at file; 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 toEvinceDocument.DocumentError.ENCRYPTED.New in version 3.6.
- classmethod factory_get_document_for_stream(stream, mime_type, flags, cancellable)¶
- Parameters:
stream (
Gio.InputStream) – aGio.InputStreamflags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlagscancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Raises:
- Returns:
a new
EvinceDocument.Document, orNone- Return type:
Synchronously creates a
EvinceDocument.Documentfor the document from stream; 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 toEvinceDocument.DocumentError.ENCRYPTED.If mime_type is non-
None, this overrides any type inferred from the stream. If the mime type cannot be inferred from the stream, and mime_type isNone, an error is returned.New in version 3.6.
- classmethod factory_get_document_full(uri, flags)¶
- Parameters:
uri (
str) – an URIflags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlags
- Raises:
- Returns:
a new
EvinceDocument.Document, orNone- Return type:
Creates a
EvinceDocument.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 toEvinceDocument.DocumentError.ENCRYPTED.
- classmethod fc_mutex_lock()¶
- classmethod fc_mutex_unlock()¶
- classmethod misc_format_date(utime)¶
- Parameters:
utime (
int) – a #GTime- Returns:
a locale specific date and time representation.
- Return type:
Deprecated since version 3.38: use
EvinceDocument.Document.misc_format_datetimeinstead as GTime is deprecated because it is not year-2038 safe.
- 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_loading_thumbnail(width, height, inverted_colors)¶
- Parameters:
- Returns:
- Return type:
- classmethod misc_get_page_border_size(page_width, page_height, border)¶
- Parameters:
page_width (
int) –page_height (
int) –border (
Gtk.Border) –
- 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_screen_dpi(screen)¶
- Parameters:
screen (
Gdk.Screen) – aGdk.Screen- Returns:
The DPI of screen, or 96 if the DPI is not available
- Return type:
Deprecated since version 3.36: This uses a deprecated GDK API. Use
EvinceDocument.Document.misc_get_widget_dpi() instead, which uses GDK’s per-monitor information.
- classmethod misc_get_thumbnail_frame(width, height, source_pixbuf)¶
- Parameters:
width (
int) – the desired widthheight (
int) – the desired heightsource_pixbuf (
GdkPixbuf.Pixbuf) – aGdkPixbuf.Pixbuf
- Returns:
- Return type:
- 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_invert_pixbuf(pixbuf)¶
- Parameters:
pixbuf (
GdkPixbuf.Pixbuf) –
- classmethod misc_invert_surface(surface)¶
- Parameters:
surface (
cairo.Surface) –
- classmethod misc_paint_one_page(cr, widget, area, border, highlight, inverted_colors)¶
- Parameters:
cr (
cairo.Context) – a #cairo_tEvannotation widget aGtk.Widgetwidget (
Gtk.Widget) –area (
Gdk.Rectangle) – aGdk.Rectangleborder (
Gtk.Border) – aGtk.Borderhighlight (
bool) – whether to highlight the textinverted_colors (
bool) – whether to invert colors
Deprecated since version 3.10..
- classmethod misc_pixbuf_from_surface(surface)¶
- Parameters:
surface (
cairo.Surface) – acairo.Surface- Returns:
- Return type:
- classmethod misc_render_loading_thumbnail(widget, width, height, inverted_colors)¶
- Parameters:
widget (
Gtk.Widget) – aGtk.Widgetto use for style informationwidth (
int) – the desired widthheight (
int) – the desired heightinverted_colors (
bool) – whether to invert colors
- Returns:
- Return type:
New in version 3.8.
- classmethod misc_render_loading_thumbnail_surface(widget, width, height, inverted_colors)¶
- Parameters:
widget (
Gtk.Widget) – aGtk.Widgetto use for style informationwidth (
int) – the desired widthheight (
int) – the desired heightinverted_colors (
bool) – whether to invert colors
- Returns:
- Return type:
New in version 3.14.
- classmethod misc_render_thumbnail_surface_with_frame(widget, source_surface, width, height)¶
- Parameters:
widget (
Gtk.Widget) – aGtk.Widgetto use for style informationsource_surface (
cairo.Surface) – acairo.Surfacewidth (
int) – the desired widthheight (
int) – the desired height
- Returns:
- Return type:
New in version 3.14.
- classmethod misc_render_thumbnail_with_frame(widget, source_pixbuf)¶
- Parameters:
widget (
Gtk.Widget) – aGtk.Widgetto use for style informationsource_pixbuf (
GdkPixbuf.Pixbuf) – aGdkPixbuf.Pixbuf
- Returns:
- Return type:
New in version 3.8.
- 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:
- find_page_by_label(page_label, page_index)¶
- get_backend_info(info)¶
- Parameters:
info (
EvinceDocument.DocumentBackendInfo) –- Return type:
- get_info()¶
- Returns:
- Return type:
Returns the
EvinceDocument.DocumentInfofor the document.
- 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
EvinceDocument.Pagefor the given index.- Return type:
- get_page_size(page_index)¶
- get_thumbnail(rc)¶
- Parameters:
rc (
EvinceDocument.RenderContext) – anEvinceDocument.RenderContext- Returns:
- Return type:
- get_thumbnail_surface(rc)¶
- Parameters:
rc (
EvinceDocument.RenderContext) – anEvinceDocument.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, EV_DEFINE_ERROR_ENCRYPTED is returned. If the backend cannot load the specific document,EvinceDocument.DocumentError.INVALIDis returned. If the backend does not support the format for the document’s contents,EvinceDocument.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, cancellable)¶
- Parameters:
fd (
int) – a file descriptorflags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlagscancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- 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
EvinceDocument.Document.load() for more information.New in version 42.0.
- load_full(uri, flags)¶
- Parameters:
uri (
str) – the document’s URIflags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlags
- Raises:
- Returns:
- Return type:
Loads self from uri.
On failure,
Falseis returned and error is filled in. If the document is encrypted, EV_DEFINE_ERROR_ENCRYPTED is returned. If the backend cannot load the specific document,EvinceDocument.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.
- load_gfile(file, flags, cancellable)¶
- Parameters:
flags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlagscancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Raises:
- Returns:
Trueif loading succeeded, orFalseon error with error filled in- Return type:
Synchronously loads the document from file. See
EvinceDocument.Document.load() for more information.New in version 3.6.
- load_stream(stream, flags, cancellable)¶
- Parameters:
stream (
Gio.InputStream) – aGio.InputStreamflags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlagscancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Raises:
- Returns:
Trueif loading succeeded, orFalseon error with error filled in- Return type:
Synchronously loads the document from stream. See
EvinceDocument.Document.load() for more information.New in version 3.6.
- render(rc)¶
- Parameters:
rc (
EvinceDocument.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.
- synctex_backward_search(page_index, x, y)¶
- Parameters:
- Returns:
A pointer to the
EvinceDocument.SourceLinkstructure that holds the result.Noneif synctex is not enabled for the document or no result is found. TheEvinceDocument.SourceLinkpointer should be freed withGLib.freeafter it is used.- Return type:
Peforms a Synctex backward search to obtain the TeX input file, line and (possibly) column corresponding to the position (x,`y`) (in 72dpi coordinates) in the page of self.
- do_get_backend_info(info) virtual¶
- Parameters:
info (
EvinceDocument.DocumentBackendInfo) –- Return type:
- do_get_info() virtual¶
- Returns:
- Return type:
Returns the
EvinceDocument.DocumentInfofor the document.
- do_get_page(index) virtual¶
- Parameters:
index (
int) – index of page- Returns:
Newly created
EvinceDocument.Pagefor the given index.- Return type:
- do_get_page_label(page) virtual¶
- Parameters:
page (
EvinceDocument.Page) –- Return type:
- do_get_page_size(page_index) virtual¶
- Parameters:
page_index (
EvinceDocument.Page) – index of page- Returns:
- Return type:
- do_get_thumbnail(rc) virtual¶
- Parameters:
rc (
EvinceDocument.RenderContext) – anEvinceDocument.RenderContext- Returns:
- Return type:
- do_get_thumbnail_surface(rc) virtual¶
- Parameters:
rc (
EvinceDocument.RenderContext) – anEvinceDocument.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, EV_DEFINE_ERROR_ENCRYPTED is returned. If the backend cannot load the specific document,EvinceDocument.DocumentError.INVALIDis returned. If the backend does not support the format for the document’s contents,EvinceDocument.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, cancellable) virtual¶
- Parameters:
fd (
int) – a file descriptorflags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlagscancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- 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
EvinceDocument.Document.load() for more information.New in version 42.0.
- do_load_gfile(file, flags, cancellable) virtual¶
- Parameters:
flags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlagscancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Returns:
Trueif loading succeeded, orFalseon error with error filled in- Return type:
Synchronously loads the document from file. See
EvinceDocument.Document.load() for more information.New in version 3.6.
- do_load_stream(stream, flags, cancellable) virtual¶
- Parameters:
stream (
Gio.InputStream) – aGio.InputStreamflags (
EvinceDocument.DocumentLoadFlags) – flags fromEvinceDocument.DocumentLoadFlagscancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone
- Returns:
Trueif loading succeeded, orFalseon error with error filled in- Return type:
Synchronously loads the document from stream. See
EvinceDocument.Document.load() for more information.New in version 3.6.
- do_render(rc) virtual¶
- Parameters:
rc (
EvinceDocument.RenderContext) –- Return type: