Atk.Document

g Atk.Document Atk.Document GObject.GInterface GObject.GInterface GObject.GInterface->Atk.Document

Implementations:
 Atk.NoOpObject

Methods

  get_attribute_value (attribute_name)
  get_attributes ()
  get_current_page_number ()
  get_document ()
  get_document_type ()
  get_locale ()
  get_page_count ()
  set_attribute_value (attribute_name, attribute_value)

Properties

None

Signals

Name Short Description
load-complete The ‘load-complete’ signal is emitted when a pending load of a static document has completed.
load-stopped The ‘load-stopped’ signal is emitted when a pending load of document contents is cancelled, paused, or otherwise interrupted by the user or application logic.
page-changed The ‘page-changed’ signal is emitted when the current page of a document changes, e.g.
reload The ‘reload’ signal is emitted when the contents of a document is refreshed from its source.

Fields

None

Class Details

class Atk.Document
Bases:GObject.GInterface
Structure:Atk.DocumentIface

The Atk.Document interface should be supported by any object whose content is a representation or view of a document. The Atk.Document interface should appear on the toplevel container for the document content; however Atk.Document instances may be nested (i.e. an Atk.Document may be a descendant of another Atk.Document) in those cases where one document contains “embedded content” which can reasonably be considered a document in its own right.

get_attribute_value(attribute_name)[source]
Parameters:attribute_name (str) – a character string representing the name of the attribute whose value is being queried.
Returns:a string value associated with the named attribute for this document, or None if a value for attribute_name has not been specified for this document.
Return type:str or None

Retrieves the value of the given attribute_name inside self.

New in version 1.12.

get_attributes()[source]
Returns:An AtkAttributeSet containing the explicitly set name-value-pair attributes associated with this document as a whole.
Return type:[object]

Gets an AtkAttributeSet which describes document-wide attributes as name-value pairs.

New in version 1.12.

get_current_page_number()[source]
Returns:the current page number inside self, or -1 if not implemented, not know by the implementor, or irrelevant.
Return type:int

Retrieves the current page number inside self.

New in version 2.12.

get_document()[source]
Returns:a object that points to an instance of the DOM.
Return type:object or None

Gets a object that points to an instance of the DOM. It is up to the caller to check atk_document_get_type to determine how to cast this pointer.

Deprecated since version 2.12: document is already a representation of the document. Use it directly, or one of its children, as an instance of the DOM.

get_document_type()[source]
Returns:a string indicating the document type
Return type:str

Gets a string indicating the document type.

Deprecated since version 2.12: Please use Atk.Document.get_attributes() to ask for the document type if it applies.

get_locale()[source]
Returns:a UTF-8 string indicating the POSIX-style LC_MESSAGES locale of the document content as a whole, or None if the document content does not specify a locale.
Return type:str

Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale of the content of this document instance. Individual text substrings or images within this document may have a different locale, see atk_text_get_attributes and Atk.Image.get_image_locale.

Deprecated since version 2.7.90: Please use Atk.Object.get_object_locale() instead.

get_page_count()[source]
Returns:total page count of self, or -1 if not implemented, not know by the implementor or irrelevant.
Return type:int

Retrieves the total number of pages inside self.

New in version 2.12.

set_attribute_value(attribute_name, attribute_value)[source]
Parameters:
  • attribute_name (str) – a character string representing the name of the attribute whose value is being set.
  • attribute_value (str) – a string value to be associated with attribute_name.
Returns:

True if attribute_value is successfully associated with attribute_name for this self, and False if if the document does not allow the attribute to be modified

Return type:

bool

Sets the value for the given attribute_name inside self.

New in version 1.12.

do_get_current_page_number() virtual
Returns:the current page number inside document, or -1 if not implemented, not know by the implementor, or irrelevant.
Return type:int

Retrieves the current page number inside document.

New in version 2.12.

do_get_document() virtual
Returns:a object that points to an instance of the DOM.
Return type:object or None

Gets a object that points to an instance of the DOM. It is up to the caller to check atk_document_get_type to determine how to cast this pointer.

Deprecated since version 2.12: document is already a representation of the document. Use it directly, or one of its children, as an instance of the DOM.

do_get_document_attribute_value(attribute_name) virtual
Parameters:attribute_name (str) – a character string representing the name of the attribute whose value is being queried.
Returns:a string value associated with the named attribute for this document, or None if a value for attribute_name has not been specified for this document.
Return type:str or None

Retrieves the value of the given attribute_name inside document.

New in version 1.12.

do_get_document_attributes() virtual
Returns:An AtkAttributeSet containing the explicitly set name-value-pair attributes associated with this document as a whole.
Return type:[object]

Gets an AtkAttributeSet which describes document-wide attributes as name-value pairs.

New in version 1.12.

do_get_document_locale() virtual
Returns:a UTF-8 string indicating the POSIX-style LC_MESSAGES locale of the document content as a whole, or None if the document content does not specify a locale.
Return type:str

Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale of the content of this document instance. Individual text substrings or images within this document may have a different locale, see atk_text_get_attributes and Atk.Image.get_image_locale.

Deprecated since version 2.7.90: Please use Atk.Object.get_object_locale() instead.

do_get_document_type() virtual
Returns:a string indicating the document type
Return type:str

Gets a string indicating the document type.

Deprecated since version 2.12: Please use Atk.Document.get_attributes() to ask for the document type if it applies.

do_get_page_count() virtual
Returns:total page count of document, or -1 if not implemented, not know by the implementor or irrelevant.
Return type:int

Retrieves the total number of pages inside document.

New in version 2.12.

do_set_document_attribute(attribute_name, attribute_value) virtual
Parameters:
  • attribute_name (str) – a character string representing the name of the attribute whose value is being set.
  • attribute_value (str) – a string value to be associated with attribute_name.
Returns:

True if attribute_value is successfully associated with attribute_name for this document, and False if if the document does not allow the attribute to be modified

Return type:

bool

Sets the value for the given attribute_name inside document.

New in version 1.12.

Signal Details

Atk.Document.signals.load_complete(document)
Signal Name:load-complete
Flags:RUN_LAST
Parameters:document (Atk.Document) – The object which received the signal

The ‘load-complete’ signal is emitted when a pending load of a static document has completed. This signal is to be expected by ATK clients if and when Atk.Document implementors expose Atk.StateType.BUSY. If the state of an Atk.Object which implements Atk.Document does not include Atk.StateType.BUSY, it should be safe for clients to assume that the Atk.Document’s static contents are fully loaded into the container. (Dynamic document contents should be exposed via other signals.)

Atk.Document.signals.load_stopped(document)
Signal Name:load-stopped
Flags:RUN_LAST
Parameters:document (Atk.Document) – The object which received the signal

The ‘load-stopped’ signal is emitted when a pending load of document contents is cancelled, paused, or otherwise interrupted by the user or application logic. It should not however be emitted while waiting for a resource (for instance while blocking on a file or network read) unless a user-significant timeout has occurred.

Atk.Document.signals.page_changed(document, page_number)
Signal Name:

page-changed

Flags:

RUN_LAST

Parameters:
  • document (Atk.Document) – The object which received the signal
  • page_number (int) – the new page number. If this value is unknown or not applicable, -1 should be provided.

The ‘page-changed’ signal is emitted when the current page of a document changes, e.g. pressing page up/down in a document viewer.

New in version 2.12.

Atk.Document.signals.reload(document)
Signal Name:reload
Flags:RUN_LAST
Parameters:document (Atk.Document) – The object which received the signal

The ‘reload’ signal is emitted when the contents of a document is refreshed from its source. Once ‘reload’ has been emitted, a matching ‘load-complete’ or ‘load-stopped’ signal should follow, which clients may await before interrogating ATK for the latest document content.