WebKit.FindController

g GObject.Object GObject.Object WebKit.FindController WebKit.FindController GObject.Object->WebKit.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

WebKit.FindOptions

r

text

str

r

web-view

WebKit.WebView

r/w/co

Signals

Inherited:

GObject.Object (1)

Name

Short Description

counted-matches

This signal is emitted when the WebKit.FindController has counted the number of matches for a given text after a call to WebKit.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)

Class Details

class WebKit.FindController(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit.FindControllerClass

Controls text search in a WebKit.WebView.

A WebKit.FindController is used to search text in a WebKit.WebView. You can get a WebKit.WebView ‘s WebKit.FindController with WebKit.WebView.get_find_controller(), and later use it to search for text using WebKit.FindController.search(), or get the number of matches using WebKit.FindController.count_matches(). The operations are asynchronous and trigger signals when ready, such as WebKit.FindController ::found-text, WebKit.FindController ::failed-to-find-text or WebKit.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 WebKit.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 WebKit.WebView with the provided find_options. The number of matches will be provided by the WebKit.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 WebKit.FindController.search() or WebKit.FindController.count_matches().

get_options()
Returns:

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

Return type:

int

Gets the WebKit.FindOptions for the current search.

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

get_search_text()
Returns:

the text to look for in the WebKit.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 WebKit.FindController.search() or WebKit.FindController.count_matches().

get_web_view()
Returns:

the WebKit.WebView.

Return type:

WebKit.WebView

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

Do not dereference the returned instance as it belongs to the WebKit.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 WebKit.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 WebKit.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 WebKit.FindController ::found-text and WebKit.FindController ::failed-to-find-text signals.

To look for the next or previous occurrences of the same text with the same find options use WebKit.FindController.search_next() and/or WebKit.FindController.search_previous(). The WebKit.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 WebKit.FindController ::found-text will report GObject.G_MAXUINT matches instead of the actual number.

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

search_finish()

Finishes a find operation.

Finishes a find operation started by WebKit.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 WebKit.FindController.search() or WebKit.FindController.count_matches() is a programming error.

search_previous()

Looks for the previous occurrence of the search text.

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

Signal Details

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

counted-matches

Flags:

RUN_LAST

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

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

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

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

failed-to-find-text

Flags:

RUN_LAST

Parameters:

find_controller (WebKit.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 WebKit.FindController.search(), WebKit.FindController.search_next() or WebKit.FindController.search_previous().

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

found-text

Flags:

RUN_LAST

Parameters:
  • find_controller (WebKit.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 WebKit.FindController.search(), WebKit.FindController.search_next() or WebKit.FindController.search_previous().

Property Details

WebKit.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.

WebKit.FindController.props.options
Name:

options

Type:

WebKit.FindOptions

Default Value:

WebKit.FindOptions.NONE

Flags:

READABLE

The options to be used in the search operation.

WebKit.FindController.props.text
Name:

text

Type:

str

Default Value:

None

Flags:

READABLE

The current search text for this WebKit.FindController.

WebKit.FindController.props.web_view
Name:

web-view

Type:

WebKit.WebView

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The WebKit.WebView this controller is associated to.