WebKit2.FindController

g GObject.Object GObject.Object WebKit2.FindController WebKit2.FindController GObject.Object->WebKit2.FindController

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

count_matches (search_text, find_options, max_match_count)

get_max_match_count ()

get_options ()

get_search_text ()

get_web_view ()

search (search_text, find_options, max_match_count)

search_finish ()

search_next ()

search_previous ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

max-match-count

int

r

options

WebKit2.FindOptions

r

text

str

r

web-view

WebKit2.WebView

r/w/co

Signals

Inherited:

GObject.Object (1)

Name

Short Description

counted-matches

This signal is emitted when the WebKit2.FindController has counted the number of matches for a given text after a call to WebKit2.FindController.count_matches().

failed-to-find-text

This signal is emitted when a search operation does not find any result for the given text.

found-text

This signal is emitted when a given text is found in the web page text.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class WebKit2.FindController(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit2.FindControllerClass

Controls text search in a WebKit2.WebView.

A WebKit2.FindController is used to search text in a WebKit2.WebView. You can get a WebKit2.WebView ‘s WebKit2.FindController with WebKit2.WebView.get_find_controller(), and later use it to search for text using WebKit2.FindController.search(), or get the number of matches using WebKit2.FindController.count_matches(). The operations are asynchronous and trigger signals when ready, such as WebKit2.FindController ::found-text, WebKit2.FindController ::failed-to-find-text or WebKit2.FindController ::counted-matches .

count_matches(search_text, find_options, max_match_count)
Parameters:
  • search_text (str) – the text to look for

  • find_options (int) – a bitmask with the WebKit2.FindOptions used in the search

  • max_match_count (int) – the maximum number of matches allowed in the search

Counts the number of matches for search_text.

Counts the number of matches for search_text found in the WebKit2.WebView with the provided find_options. The number of matches will be provided by the WebKit2.FindController ::counted-matches signal.

get_max_match_count()
Returns:

the maximum number of matches to report.

Return type:

int

Gets the maximum number of matches to report.

Gets the maximum number of matches to report during a text lookup. This number is passed as the last argument of WebKit2.FindController.search() or WebKit2.FindController.count_matches().

get_options()
Returns:

a bitmask containing the WebKit2.FindOptions associated with the current search.

Return type:

int

Gets the WebKit2.FindOptions for the current search.

Gets a bitmask containing the WebKit2.FindOptions associated with the current search.

get_search_text()
Returns:

the text to look for in the WebKit2.WebView.

Return type:

str

Gets the text that self is searching for.

Gets the text that self is currently searching for. This text is passed to either WebKit2.FindController.search() or WebKit2.FindController.count_matches().

get_web_view()
Returns:

the WebKit2.WebView.

Return type:

WebKit2.WebView

Gets the WebKit2.WebView this find controller is associated to.

Do not dereference the returned instance as it belongs to the WebKit2.FindController.

search(search_text, find_options, max_match_count)
Parameters:
  • search_text (str) – the text to look for

  • find_options (int) – a bitmask with the WebKit2.FindOptions used in the search

  • max_match_count (int) – the maximum number of matches allowed in the search

Looks for search_text associated with self.

Looks for search_text in the WebKit2.WebView associated with self since the beginning of the document highlighting up to max_match_count matches. The outcome of the search will be asynchronously provided by the WebKit2.FindController ::found-text and WebKit2.FindController ::failed-to-find-text signals.

To look for the next or previous occurrences of the same text with the same find options use WebKit2.FindController.search_next() and/or WebKit2.FindController.search_previous(). The WebKit2.FindController will use the same text and options for the following searches unless they are modified by another call to this method.

Note that if the number of matches is higher than max_match_count then WebKit2.FindController ::found-text will report GObject.G_MAXUINT matches instead of the actual number.

Callers should call WebKit2.FindController.search_finish() to finish the current search operation.

search_finish()

Finishes a find operation.

Finishes a find operation started by WebKit2.FindController.search(). It will basically unhighlight every text match found.

This method will be typically called when the search UI is closed/hidden by the client application.

search_next()

Looks for the next occurrence of the search text.

Calling this method before WebKit2.FindController.search() or WebKit2.FindController.count_matches() is a programming error.

search_previous()

Looks for the previous occurrence of the search text.

Calling this method before WebKit2.FindController.search() or WebKit2.FindController.count_matches() is a programming error.

Signal Details

WebKit2.FindController.signals.counted_matches(find_controller, match_count)
Signal Name:

counted-matches

Flags:

RUN_LAST

Parameters:
  • find_controller (WebKit2.FindController) – The object which received the signal

  • match_count (int) – the number of matches of the search text

This signal is emitted when the WebKit2.FindController has counted the number of matches for a given text after a call to WebKit2.FindController.count_matches().

WebKit2.FindController.signals.failed_to_find_text(find_controller)
Signal Name:

failed-to-find-text

Flags:

RUN_LAST

Parameters:

find_controller (WebKit2.FindController) – The object which received the signal

This signal is emitted when a search operation does not find any result for the given text. It will be issued if the text is not found asynchronously after a call to WebKit2.FindController.search(), WebKit2.FindController.search_next() or WebKit2.FindController.search_previous().

WebKit2.FindController.signals.found_text(find_controller, match_count)
Signal Name:

found-text

Flags:

RUN_LAST

Parameters:
  • find_controller (WebKit2.FindController) – The object which received the signal

  • match_count (int) – the number of matches found of the search text

This signal is emitted when a given text is found in the web page text. It will be issued if the text is found asynchronously after a call to WebKit2.FindController.search(), WebKit2.FindController.search_next() or WebKit2.FindController.search_previous().

Property Details

WebKit2.FindController.props.max_match_count
Name:

max-match-count

Type:

int

Default Value:

0

Flags:

READABLE

The maximum number of matches to report for a given search.

WebKit2.FindController.props.options
Name:

options

Type:

WebKit2.FindOptions

Default Value:

WebKit2.FindOptions.NONE

Flags:

READABLE

The options to be used in the search operation.

WebKit2.FindController.props.text
Name:

text

Type:

str

Default Value:

None

Flags:

READABLE

The current search text for this WebKit2.FindController.

WebKit2.FindController.props.web_view
Name:

web-view

Type:

WebKit2.WebView

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The WebKit2.WebView this controller is associated to.