:right-sidebar: True FindController =================================================================== .. currentmodule:: gi.repository.WebKit .. class:: FindController(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Controls text search in a :obj:`~gi.repository.WebKit.WebView`\. A :obj:`~gi.repository.WebKit.FindController` is used to search text in a :obj:`~gi.repository.WebKit.WebView`\. You can get a :obj:`~gi.repository.WebKit.WebView`\'s :obj:`~gi.repository.WebKit.FindController` with :func:`~gi.repository.WebKit.WebView.get_find_controller`, and later use it to search for text using :func:`~gi.repository.WebKit.FindController.search`, or get the number of matches using :func:`~gi.repository.WebKit.FindController.count_matches`. The operations are asynchronous and trigger signals when ready, such as :obj:`~gi.repository.WebKit.FindController`\::found-text, :obj:`~gi.repository.WebKit.FindController`\::failed-to-find-text or :obj:`~gi.repository.WebKit.FindController`\::counted-matches. Methods ------- .. rst-class:: interim-class .. class:: FindController :no-index: .. method:: count_matches(search_text: str, find_options: int, max_match_count: int) -> None Counts the number of matches for ``search_text``\. Counts the number of matches for ``search_text`` found in the :obj:`~gi.repository.WebKit.WebView` with the provided ``find_options``\. The number of matches will be provided by the :obj:`~gi.repository.WebKit.FindController`\::counted-matches signal. :param search_text: the text to look for :param find_options: a bitmask with the :obj:`~gi.repository.WebKit.FindOptions` used in the search :param max_match_count: the maximum number of matches allowed in the search .. method:: get_max_match_count() -> 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 :func:`~gi.repository.WebKit.FindController.search` or :func:`~gi.repository.WebKit.FindController.count_matches`. .. method:: get_options() -> int Gets the :obj:`~gi.repository.WebKit.FindOptions` for the current search. Gets a bitmask containing the :obj:`~gi.repository.WebKit.FindOptions` associated with the current search. .. method:: get_search_text() -> str Gets the text that ``find_controller`` is searching for. Gets the text that ``find_controller`` is currently searching for. This text is passed to either :func:`~gi.repository.WebKit.FindController.search` or :func:`~gi.repository.WebKit.FindController.count_matches`. .. method:: get_web_view() -> ~gi.repository.WebKit.WebView Gets the :obj:`~gi.repository.WebKit.WebView` this find controller is associated to. Do not dereference the returned instance as it belongs to the :obj:`~gi.repository.WebKit.FindController`\. .. method:: search(search_text: str, find_options: int, max_match_count: int) -> None Looks for ``search_text`` associated with ``find_controller``\. Looks for ``search_text`` in the :obj:`~gi.repository.WebKit.WebView` associated with ``find_controller`` since the beginning of the document highlighting up to ``max_match_count`` matches. The outcome of the search will be asynchronously provided by the :obj:`~gi.repository.WebKit.FindController`\::found-text and :obj:`~gi.repository.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 :func:`~gi.repository.WebKit.FindController.search_next` and/or :func:`~gi.repository.WebKit.FindController.search_previous`. The :obj:`~gi.repository.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 :obj:`~gi.repository.WebKit.FindController`\::found-text will report %G_MAXUINT matches instead of the actual number. Callers should call :func:`~gi.repository.WebKit.FindController.search_finish` to finish the current search operation. :param search_text: the text to look for :param find_options: a bitmask with the :obj:`~gi.repository.WebKit.FindOptions` used in the search :param max_match_count: the maximum number of matches allowed in the search .. method:: search_finish() -> None Finishes a find operation. Finishes a find operation started by :func:`~gi.repository.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. .. method:: search_next() -> None Looks for the next occurrence of the search text. Calling this method before :func:`~gi.repository.WebKit.FindController.search` or :func:`~gi.repository.WebKit.FindController.count_matches` is a programming error. .. method:: search_previous() -> None Looks for the previous occurrence of the search text. Calling this method before :func:`~gi.repository.WebKit.FindController.search` or :func:`~gi.repository.WebKit.FindController.count_matches` is a programming error. Properties ---------- .. rst-class:: interim-class .. class:: FindController :no-index: .. attribute:: props.max_match_count :type: int The type of the None singleton. .. attribute:: props.options :type: ~gi.repository.WebKit.FindOptions The type of the None singleton. .. attribute:: props.text :type: str The type of the None singleton. .. attribute:: props.web_view :type: ~gi.repository.WebKit.WebView The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: FindController.signals :no-index: .. method:: counted_matches(match_count: int) -> None The type of the None singleton. :param match_count: the number of matches of the search text .. method:: failed_to_find_text() -> None The type of the None singleton. .. method:: found_text(match_count: int) -> None The type of the None singleton. :param match_count: the number of matches found of the search text