:right-sidebar: True InputMethodContext =================================================================== .. currentmodule:: gi.repository.WebKit .. versionadded:: 2.28 .. class:: InputMethodContext(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: InputMethodContext(**properties) Methods ------- .. rst-class:: interim-class .. class:: InputMethodContext :no-index: .. method:: filter_key_event(key_event: ~gi.repository.Gdk.Event) -> bool Allow ``key_event`` to be handled by the input method. If :const:`True` is returned, then no further processing should be done for the key event. .. versionadded:: 2.28 :param key_event: the key event to filter .. method:: get_input_hints() -> ~gi.repository.WebKit.InputHints Get the value of the :obj:`~gi.repository.WebKit.InputMethodContext`:input-hints property. .. versionadded:: 2.28 .. method:: get_input_purpose() -> ~gi.repository.WebKit.InputPurpose Get the value of the :obj:`~gi.repository.WebKit.InputMethodContext`:input-purpose property. .. versionadded:: 2.28 .. method:: get_preedit() -> tuple[str, list[~gi.repository.WebKit.InputMethodUnderline], int] Get the pre-edit string and a list of WebKitInputMethodUnderline. Get the current pre-edit string for the ``context``, and a list of WebKitInputMethodUnderline to apply to the string. The string will be displayed inserted at ``cursor_offset``. .. versionadded:: 2.28 .. method:: notify_cursor_area(x: int, y: int, width: int, height: int) -> None Notify ``context`` that cursor area changed in input associated. .. versionadded:: 2.28 :param x: the x coordinate of cursor location :param y: the y coordinate of cursor location :param width: the width of cursor area :param height: the height of cursor area .. method:: notify_focus_in() -> None Notify ``context`` that input associated has gained focus. .. versionadded:: 2.28 .. method:: notify_focus_out() -> None Notify ``context`` that input associated has lost focus. .. versionadded:: 2.28 .. method:: notify_surrounding(text: str, length: int, cursor_index: int, selection_index: int) -> None Notify ``context`` that the context surrounding the cursor has changed. If there's no selection ``selection_index`` is the same as ``cursor_index``. .. versionadded:: 2.28 :param text: text surrounding the insertion point :param length: the length of ``text``, or -1 if ``text`` is nul-terminated :param cursor_index: the byte index of the insertion cursor within ``text``. :param selection_index: the byte index of the selection cursor within ``text``. .. method:: reset() -> None Reset the ``context``. This will typically cause the input to clear the preedit state. .. versionadded:: 2.28 .. method:: set_enable_preedit(enabled: bool) -> None Set whether ``context`` should enable preedit to display feedback. .. versionadded:: 2.28 :param enabled: whether to enable preedit .. method:: set_input_hints(hints: ~gi.repository.WebKit.InputHints) -> None Set the value of the :obj:`~gi.repository.WebKit.InputMethodContext`:input-hints property. .. versionadded:: 2.28 :param hints: a :obj:`~gi.repository.WebKit.InputHints` .. method:: set_input_purpose(purpose: ~gi.repository.WebKit.InputPurpose) -> None Set the value of the :obj:`~gi.repository.WebKit.InputMethodContext`:input-purpose property. .. versionadded:: 2.28 :param purpose: a :obj:`~gi.repository.WebKit.InputPurpose` Properties ---------- .. rst-class:: interim-class .. class:: InputMethodContext :no-index: .. attribute:: props.input_hints :type: ~gi.repository.WebKit.InputHints The :obj:`~gi.repository.WebKit.InputHints` of the input associated with this context. .. versionadded:: 2.28 .. attribute:: props.input_purpose :type: ~gi.repository.WebKit.InputPurpose The :obj:`~gi.repository.WebKit.InputPurpose` of the input associated with this context. .. versionadded:: 2.28 Signals ------- .. rst-class:: interim-class .. class:: InputMethodContext.signals :no-index: .. method:: committed(text: str) -> None Emitted when a complete input sequence has been entered by the user. This can be a single character immediately after a key press or the final result of preediting. .. versionadded:: 2.28 :param text: the string result .. method:: delete_surrounding(offset: int, n_chars: int) -> None Emitted when the input method wants to delete the context surrounding the cursor. If ``offset`` is a negative value, it means a position before the cursor. .. versionadded:: 2.28 :param offset: the character offset from the cursor position of the text to be deleted. :param n_chars: the number of characters to be deleted .. method:: preedit_changed() -> None Emitted whenever the preedit sequence currently being entered has changed. It is also emitted at the end of a preedit sequence, in which case :func:`~gi.repository.WebKit.InputMethodContext.get_preedit` returns the empty string. .. versionadded:: 2.28 .. method:: preedit_finished() -> None Emitted when a preediting sequence has been completed or canceled. .. versionadded:: 2.28 .. method:: preedit_started() -> None Emitted when a new preediting sequence starts. .. versionadded:: 2.28 Virtual Methods --------------- .. rst-class:: interim-class .. class:: InputMethodContext :no-index: .. method:: do_committed(text: str) -> None :param text: .. method:: do_delete_surrounding(offset: int, n_chars: int) -> None :param offset: :param n_chars: .. method:: do_filter_key_event(key_event: ~gi.repository.Gdk.Event) -> bool Allow ``key_event`` to be handled by the input method. If :const:`True` is returned, then no further processing should be done for the key event. .. versionadded:: 2.28 :param key_event: the key event to filter .. method:: do_get_preedit() -> tuple[str, list[~gi.repository.WebKit.InputMethodUnderline], int] Get the pre-edit string and a list of WebKitInputMethodUnderline. Get the current pre-edit string for the ``context``, and a list of WebKitInputMethodUnderline to apply to the string. The string will be displayed inserted at ``cursor_offset``. .. versionadded:: 2.28 .. method:: do_notify_cursor_area(x: int, y: int, width: int, height: int) -> None Notify ``context`` that cursor area changed in input associated. .. versionadded:: 2.28 :param x: the x coordinate of cursor location :param y: the y coordinate of cursor location :param width: the width of cursor area :param height: the height of cursor area .. method:: do_notify_focus_in() -> None Notify ``context`` that input associated has gained focus. .. versionadded:: 2.28 .. method:: do_notify_focus_out() -> None Notify ``context`` that input associated has lost focus. .. versionadded:: 2.28 .. method:: do_notify_surrounding(text: str, length: int, cursor_index: int, selection_index: int) -> None Notify ``context`` that the context surrounding the cursor has changed. If there's no selection ``selection_index`` is the same as ``cursor_index``. .. versionadded:: 2.28 :param text: text surrounding the insertion point :param length: the length of ``text``, or -1 if ``text`` is nul-terminated :param cursor_index: the byte index of the insertion cursor within ``text``. :param selection_index: the byte index of the selection cursor within ``text``. .. method:: do_preedit_changed() -> None .. method:: do_preedit_finished() -> None .. method:: do_preedit_started() -> None .. method:: do_reset() -> None Reset the ``context``. This will typically cause the input to clear the preedit state. .. versionadded:: 2.28 .. method:: do_set_enable_preedit(enabled: bool) -> None Set whether ``context`` should enable preedit to display feedback. .. versionadded:: 2.28 :param enabled: whether to enable preedit Fields ------ .. rst-class:: interim-class .. class:: InputMethodContext :no-index: .. attribute:: parent_instance .. attribute:: priv