IBus.InputContext¶
- Subclasses:
None
Methods¶
- Inherited:
IBus.Proxy (1), Gio.DBusProxy (25), GObject.Object (37), Gio.AsyncInitable (4), Gio.DBusInterface (3), Gio.Initable (2)
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when the text is going to be committed. |
|
Emitted to select next candidate of lookup table. |
|
Emitted to select previous candidate of lookup table. |
|
Emitted to delete surrounding text event from IME to client of IME. |
|
Emitted when an IME is disabled. |
|
Emitted when an IME is enabled. |
|
Emitted to forward key event from IME to client of IME. |
|
Emitted to hide auxiliary text. |
|
Emitted to hide lookup table. |
|
Emitted to hide preedit text. |
|
Emitted to view the next page of lookup table. |
|
Emitted to view the previous page of lookup table. |
|
Emitted to register the properties in props. |
|
Emitted to receive the RequireSurroundingText signal from the daemon. |
|
Emitted to show auxiliary text. |
|
Emitted to show lookup table. |
|
Emitted to show preedit text. |
|
Emitted to hide auxilary text. |
|
Emitted to update lookup table. |
|
Emitted to update preedit text. |
|
Emitted to update preedit text with the mode. |
|
Emitted to update the property prop. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class IBus.InputContext(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
An
IBus.InputContext
is a proxy object of BusInputContext, which manages the context for input methods that supports text input in various natural languages.Clients call the
IBus.InputContext
to invoke BusInputContext, through which invokesIBus.Engine
.- classmethod get_input_context(path, connection)¶
- Parameters:
path (
str
) – The path to the object that emitting the signal.connection (
Gio.DBusConnection
) – AGio.DBusConnection
.
- Returns:
An existing
IBus.InputContext
.- Return type:
Gets an existing
IBus.InputContext
.
- classmethod get_input_context_async(path, connection, cancellable, callback, *user_data)¶
- Parameters:
path (
str
) – The path to the object that emitting the signal.connection (
Gio.DBusConnection
) – AGio.DBusConnection
.cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – AGio.AsyncReadyCallback
to call when the request is satisfied. The callback should not beNone
.
Gets an existing
IBus.InputContext
asynchronously.
- classmethod get_input_context_async_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – AGio.AsyncResult
obtained from theGio.AsyncReadyCallback
pass toIBus.InputContext.get_input_context_async
().- Raises:
- Returns:
An existing
IBus.InputContext
.- Return type:
Finishes an operation started with
IBus.InputContext.get_input_context_async
().
- classmethod new(path, connection, cancellable)¶
- Parameters:
path (
str
) – The path to the object that emitting the signal.connection (
Gio.DBusConnection
) – AGio.DBusConnection
.cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
orNone
.
- Raises:
- Returns:
A newly allocated
IBus.InputContext
.- Return type:
Creates a new
IBus.InputContext
.
- classmethod new_async(path, connection, cancellable, callback, *user_data)¶
- Parameters:
path (
str
) – The path to the object that emitting the signal.connection (
Gio.DBusConnection
) – AGio.DBusConnection
.cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – AGio.AsyncReadyCallback
to call when the request is satisfied. The callback should not beNone
.
Creates a new
IBus.InputContext
asynchronously.
- classmethod new_async_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – AGio.AsyncResult
obtained from theGio.AsyncReadyCallback
pass toIBus.InputContext.new_async
().- Raises:
- Returns:
A newly allocated
IBus.InputContext
.- Return type:
Finishes an operation started with
IBus.InputContext.new_async
().
- cancel_hand_writing(n_strokes)¶
- Parameters:
n_strokes (
int
) – The number of strokes to be removed. Pass 0 to remove all.
Clear handwriting stroke(s) in the current input method engine.
see_also:
IBus.Engine
::cancel-hand-writing
- focus_in()¶
Invoked when the client application get focus. An asynchronous IPC will be performed.
see_also: #IBusEngine::focus_in.
- focus_out()¶
Invoked when the client application get focus. An asynchronous IPC will be performed.
see_also: #IBusEngine::focus_out.
- get_engine()¶
- Returns:
An IME engine description for the context, or
None
.- Return type:
Gets an IME engine description for the context. A synchronous IPC will be performed.
- get_engine_async(timeout_msec, cancellable, callback, *user_data)¶
- Parameters:
timeout_msec (
int
) – The timeout in milliseconds or -1 to use the default timeout.cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – AGio.AsyncReadyCallback
to call when the request is satisfied orNone
if you don’t care about the result of the method invocation.
An asynchronous IPC will be performed.
- get_engine_async_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – AGio.AsyncResult
obtained from theGio.AsyncReadyCallback
passed toIBus.InputContext.get_engine_async
().- Raises:
- Returns:
An IME engine description for the context, or
None
.- Return type:
Finishes an operation started with
IBus.InputContext.get_engine_async
().
- needs_surrounding_text()¶
-
Check whether the current engine requires surrounding-text.
- post_process_key_event()¶
Call this API after
IBus.InputContext.process_key_event
() returns to retrieve commit-text and forwar-key-event signals during callingIBus.InputContext.process_key_event
().See also
IBus.InputContext.set_post_process_key_event
().New in version 1.5.29.
- process_hand_writing_event(coordinates, coordinates_len)¶
- Parameters:
Pass a handwriting stroke to an input method engine.
In this API, a coordinate (0.0, 0.0) represents the top-left corner of an area for handwriting, and (1.0, 1.0) does the bottom-right. Therefore, for example, if a user writes a character ‘L’, the array would be something like [0.0, 0.0, 0.0, 1.0, 1.0, 1.0] and coordinates_len would be 6.
The function is usually called when a user releases the mouse button in a hand writing area.
see_also:
IBus.Engine
::process-hand-writing-event
- process_key_event(keyval, keycode, state)¶
- Parameters:
- Returns:
True
for successfully process the key;False
otherwise.See also:
IBus.InputContext.process_key_event_async
()- Return type:
Pass the key event to input method engine and wait for the reply from ibus (i.e. synchronous IPC).
- process_key_event_async(keyval, keycode, state, timeout_msec, cancellable, callback, *user_data)¶
- Parameters:
keyval (
int
) – Key symbol of a key event.keycode (
int
) – Keycode of a key event.state (
int
) – Key modifier flags.timeout_msec (
int
) – The timeout in milliseconds or -1 to use the default timeout.cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – AGio.AsyncReadyCallback
to call when the request is satisfied orNone
if you don’t care about the result of the method invocation.
Pass the key event to input method engine.
Key symbols are characters/symbols produced by key press, for example, pressing “s” generates key symbol “s”; pressing shift-“s” generates key symbol “S”. Same key on keyboard may produce different key symbols on different keyboard layout. e.g., “s” key on QWERTY keyboard produces “o” in DVORAK layout.
Unlike key symbol, keycode is only determined by the location of the key, and irrelevant of the keyboard layout.
Briefly speaking, input methods that expect certain keyboard layout should use keycode; otherwise keyval is sufficient. For example, Chewing, Cangjie, Wubi expect an en-US QWERTY keyboard, these should use keycode; while pinyin can rely on keyval only, as it is less sensitive to the keyboard layout change, DVORAK users can still use DVORAK layout to input pinyin.
Use
IBus.Keymap.lookup_keysym
() to convert keycode to keysym in given keyboard layout.see_also:
IBus.Engine
::process-key-event
- process_key_event_async_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – AGio.AsyncResult
obtained from theGio.AsyncReadyCallback
passed toIBus.InputContext.process_key_event_async
().- Raises:
- Returns:
True
if the key event is processed;False
otherwise or some errors happen and the error will be set.- Return type:
Finishes an operation started with
IBus.InputContext.process_key_event_async
().
- property_activate(prop_name, state)¶
- Parameters:
prop_name (
str
) – A property name (e.g. “InputMode.WideLatin”)state (
int
) – A status of the property (e.g.IBus.PropState.CHECKED
)
Activate the property asynchronously.
See also: #IBusEngine::property_activate
- reset()¶
Invoked when the IME is reset. An asynchronous IPC will be performed.
see_also:
IBus.Engine
::reset
- set_capabilities(capabilities)¶
- Parameters:
capabilities (
int
) – Capabilities flags ofIBus.Engine
, seeIBus.Capabilite
Set the capabilities flags of client application asynchronously. When
IBus.Capabilite.FOCUS
is not set,IBus.Capabilite.PREEDIT_TEXT
,IBus.Capabilite.AUXILIARY_TEXT
,IBus.Capabilite.LOOKUP_TABLE
, andIBus.Capabilite.PROPERTY
have to be all set. The panel component does nothing for an application that doesn’t support focus.see_also:
IBus.Engine
::set-capabilities
- set_client_commit_preedit(client_commit)¶
- Parameters:
client_commit (
bool
) –True
if your input context commits pre-edit texts with Space or Enter key events or mouse click events.False
if ibus-daemon commits pre-edit texts with those events. The default isFalse
. The behavior is decided withIBus.Engine.update_preedit_text_with_mode
() to commit, clear or keep the pre-edit text and this API is important in ibus-hangul.
Set whether
IBus.InputContext
commits pre-edit texts or not. IfTrue
, ‘update-preedit-text-with-mode’ signal is emitted instead of ‘update-preedit-text’ signal. If your client receives the ‘update-preedit-text-with-mode’ signal, the client needs to implement commit_text() of pre-edit text when GtkIMContextClass.focus_out() is called in case an IME desires that behavior but it depends on each IME.See also
IBus.Engine.update_preedit_text_with_mode
().
- set_content_type(purpose, hints)¶
- Parameters:
purpose (
int
) – Primary purpose of the input context, as anIBus.InputPurpose
.hints (
int
) – Hints that augment purpose, as anIBus.InputHints
.
Set content-type (primary purpose and hints) of the context. This information is particularly useful to implement intelligent behavior in engines, such as automatic input-mode switch and text prediction. For example, to restrict input to numbers, the client can call this function with purpose set to
IBus.InputPurpose.NUMBER
.See also:
IBus.Engine
::set-content-type
- set_cursor_location(x, y, w, h)¶
- Parameters:
Set the cursor location of IBus input context asynchronously.
see_also:
IBus.Engine
::set-cursor-location
- set_cursor_location_relative(x, y, w, h)¶
- Parameters:
Set the relative cursor location of IBus input context asynchronously.
- set_engine(name)¶
- Parameters:
name (
str
) – A name of the engine.
Invoked when the IME engine is changed. An asynchronous IPC will be performed.
- set_post_process_key_event(enable)¶
- Parameters:
enable (
bool
) – Can useIBus.InputContext.post_process_key_event
() to retrieve commit-text and forwar-key-event signals during callingIBus.InputContext.process_key_event
() if it’sTrue
.
New in version 1.5.29.
Signal Details¶
- IBus.InputContext.signals.commit_text(input_context, text)¶
- Signal Name:
commit-text
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signaltext (
IBus.Text
) – Text to be committed.
Emitted when the text is going to be committed.
(Note: The text object is floating, and it will be released after the signal. If signal handler wants to keep the object, the handler should use
GObject.Object.ref_sink
() to get the ownership of the object.)
- IBus.InputContext.signals.cursor_down_lookup_table(input_context)¶
- Signal Name:
cursor-down-lookup-table
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to select next candidate of lookup table.
- IBus.InputContext.signals.cursor_up_lookup_table(input_context)¶
- Signal Name:
cursor-up-lookup-table
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to select previous candidate of lookup table.
- IBus.InputContext.signals.delete_surrounding_text(input_context, offset, n_chars)¶
- Signal Name:
delete-surrounding-text
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signaloffset (
int
) – the character offset from the cursor position of the text to be deleted. A negative value indicates a position before the cursor.n_chars (
int
) – the number of characters to be deleted.
Emitted to delete surrounding text event from IME to client of IME.
- IBus.InputContext.signals.disabled(input_context)¶
- Signal Name:
disabled
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted when an IME is disabled.
- IBus.InputContext.signals.enabled(input_context)¶
- Signal Name:
enabled
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted when an IME is enabled.
- IBus.InputContext.signals.forward_key_event(input_context, keyval, keycode, modifiers)¶
- Signal Name:
forward-key-event
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signalkeyval (
int
) – Key symbol of the keyboard event.keycode (
int
) – Key symbol of the keyboard event.modifiers (
int
) – Key modifier flags.
Emitted to forward key event from IME to client of IME.
- IBus.InputContext.signals.hide_auxiliary_text(input_context)¶
- Signal Name:
hide-auxiliary-text
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to hide auxiliary text.
- IBus.InputContext.signals.hide_lookup_table(input_context)¶
- Signal Name:
hide-lookup-table
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to hide lookup table.
- IBus.InputContext.signals.hide_preedit_text(input_context)¶
- Signal Name:
hide-preedit-text
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to hide preedit text.
- IBus.InputContext.signals.page_down_lookup_table(input_context)¶
- Signal Name:
page-down-lookup-table
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to view the next page of lookup table.
- IBus.InputContext.signals.page_up_lookup_table(input_context)¶
- Signal Name:
page-up-lookup-table
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to view the previous page of lookup table.
- IBus.InputContext.signals.register_properties(input_context, props)¶
- Signal Name:
register-properties
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signalprops (
IBus.PropList
) – AnIBus.PropList
that contains properties.
Emitted to register the properties in props.
(Note: The props object is floating, and it will be released after the signal. If signal handler wants to keep the object, the handler should use
GObject.Object.ref_sink
() to get the ownership of the object.)
- IBus.InputContext.signals.require_surrounding_text(input_context)¶
- Signal Name:
require-surrounding-text
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to receive the RequireSurroundingText signal from the daemon.
- IBus.InputContext.signals.show_auxiliary_text(input_context)¶
- Signal Name:
show-auxiliary-text
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to show auxiliary text.
- IBus.InputContext.signals.show_lookup_table(input_context)¶
- Signal Name:
show-lookup-table
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to show lookup table.
- IBus.InputContext.signals.show_preedit_text(input_context)¶
- Signal Name:
show-preedit-text
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signal
Emitted to show preedit text.
- IBus.InputContext.signals.update_auxiliary_text(input_context, text, visible)¶
- Signal Name:
update-auxiliary-text
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signaltext (
IBus.Text
) – An auxiliary textvisible (
bool
) – The visibility of text
Emitted to hide auxilary text.
(Note: The text object is floating, and it will be released after the signal. If signal handler wants to keep the object, the handler should use
GObject.Object.ref_sink
() to get the ownership of the object.)
- IBus.InputContext.signals.update_lookup_table(input_context, table, visible)¶
- Signal Name:
update-lookup-table
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signaltable (
IBus.LookupTable
) – AnIBus.LookupTable
to be updated.visible (
bool
) – Whether the table should be visible.
Emitted to update lookup table.
(Note: The table object is floating, and it will be released after the signal. If signal handler wants to keep the object, the handler should use
GObject.Object.ref_sink
() to get the ownership of the object.)
- IBus.InputContext.signals.update_preedit_text(input_context, text, cursor_pos, visible)¶
- Signal Name:
update-preedit-text
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signaltext (
IBus.Text
) – Text to be updated.cursor_pos (
int
) – Cursor position.visible (
bool
) – Whether the update is visible.
Emitted to update preedit text.
(Note: The text object is floating, and it will be released after the signal. If signal handler wants to keep the object, the handler should use
GObject.Object.ref_sink
() to get the ownership of the object.)
- IBus.InputContext.signals.update_preedit_text_with_mode(input_context, text, cursor_pos, visible, mode)¶
- Signal Name:
update-preedit-text-with-mode
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signaltext (
IBus.Text
) – Text to be updated.cursor_pos (
int
) – Cursor position.visible (
bool
) – Whether the update is visible.mode (
int
) – Preedit mode.
Emitted to update preedit text with the mode.
(Note: The text object is floating, and it will be released after the signal. If signal handler wants to keep the object, the handler should use
GObject.Object.ref_sink
() to get the ownership of the object.)
- IBus.InputContext.signals.update_property(input_context, prop)¶
- Signal Name:
update-property
- Flags:
- Parameters:
input_context (
IBus.InputContext
) – The object which received the signalprop (
IBus.Property
) – TheIBus.Property
to be updated.
Emitted to update the property prop.
(Note: The prop object is floating, and it will be released after the signal. If signal handler wants to keep the object, the handler should use
GObject.Object.ref_sink
() to get the ownership of the object.)