IBus.Engine¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Enable surrounding text update by focus event |
||
r/w/co |
engine name |
||
r/w/co |
Has focus ID |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when a hand writing operation is cancelled. |
|
Emitted when candidate on lookup table is clicked. |
|
Emitted when the down cursor button is pressed. |
|
Emitted when the up cursor button is pressed. |
|
Emitted when the IME is disabled. |
|
Emitted when the IME is enabled. |
|
Emitted when the client application get the focus. |
|
Emitted when the client application get the focus. |
|
Emitted when the client application lost the focus. |
|
Emitted when the client application lost the focus. |
|
Emitted when the page-down button is pressed. |
|
Emitted when the page-up button is pressed. |
|
Emitted when a hand writing operation is cancelled. |
|
Emitted when a key event is received. |
|
Emitted when a property is activated or change changed. |
|
Emitted when a property is hidden. |
|
Emitted when a property is shown. |
|
Emitted when the IME is reset. |
|
Emitted when the client application capabilities is set. |
|
Emitted when the client application content-type (primary purpose and hints) is set. |
|
Emitted when the location of IME is set. |
|
Emitted when a surrounding text is set. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
client_capabilities |
r |
|
|
cursor_area |
r |
Area of cursor. |
|
enabled |
r |
Whether the engine is enabled. |
|
has_focus |
r |
Whether the engine has focus. |
|
parent |
r |
Class Details¶
- class IBus.Engine(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
An
IBus.Engine
provides infrastructure for input method engine. Developers can “extend” this class for input method engine development.see_also:
IBus.Component
,IBus.EngineDesc
- classmethod new(engine_name, object_path, connection)¶
- Parameters:
engine_name (
str
) – Name of theIBus.Object
.object_path (
str
) – Path forIBus.Service
.connection (
Gio.DBusConnection
) – An openedGio.DBusConnection
.
- Returns:
A newly allocated
IBus.Engine
.- Return type:
Create a new
IBus.Engine
.
- classmethod new_with_type(engine_type, engine_name, object_path, connection)¶
- Parameters:
engine_type (
GObject.GType
) –GObject.GType
ofIBus.Engine
.engine_name (
str
) – Name of theIBus.Object
.object_path (
str
) – Path forIBus.Service
.connection (
Gio.DBusConnection
) – An openedGio.DBusConnection
.
- Returns:
A newly allocated
IBus.Engine
.- Return type:
Create a new
IBus.Engine
.
- commit_text(text)¶
- Parameters:
text (
IBus.Text
) – String commit toIBus.Engine
.
Commit output of input method to IBus client.
(Note: The text object will be released, if it is floating. If caller want to keep the object, caller should make the object sink by
GObject.Object.ref_sink
.)
- delete_surrounding_text(offset, nchars)¶
- Parameters:
Delete surrounding text.
- forward_key_event(keyval, keycode, state)¶
- Parameters:
Forward the key event.
- get_content_type()¶
- Returns:
- purpose:
Primary purpose of the input context.
- hints:
Hints that augument purpose.
- Return type:
Get content-type (primary purpose and hints) of the current input context.
See also:
IBus.Engine
::set-content-type
- get_name()¶
- Returns:
Name of
IBus.Engine
.- Return type:
Return the name of
IBus.Engine
.
- get_surrounding_text()¶
- Returns:
- text:
Location to store surrounding text.
- cursor_pos:
Cursor position in characters in text.
- anchor_pos:
Anchor position of selection in text.
- Return type:
Get surrounding text.
It is also used to tell the input-context that the engine will utilize surrounding-text. In that case, it must be called in
IBus.Engine
::enable
handler, with both text and cursor set toNone
.See also:
IBus.Engine
::set-surrounding-text
- hide_auxiliary_text()¶
Hide the auxiliary bar.
- hide_lookup_table()¶
Hide the lookup table.
- hide_preedit_text()¶
Hide the pre-edit buffer.
- register_properties(prop_list)¶
- Parameters:
prop_list (
IBus.PropList
) – Property List.
Register and show properties in language bar.
(Note: The prop_list object will be released, if it is floating. If caller want to keep the object, caller should make the object sink by
GObject.Object.ref_sink
.)
- show_auxiliary_text()¶
Show the auxiliary bar.
- show_lookup_table()¶
Show the lookup table.
- show_preedit_text()¶
Show the pre-edit buffer.
- update_auxiliary_text(text, visible)¶
- Parameters:
Update the auxiliary bar.
(Note: The text object will be released, if it is floating. If caller want to keep the object, caller should make the object sink by
GObject.Object.ref_sink
.)
- update_lookup_table(lookup_table, visible)¶
- Parameters:
lookup_table (
IBus.LookupTable
) – An lookup_table.visible (
bool
) – Whether the lookup_table is visible.
Update the lookup table.
(Note: The table object will be released, if it is floating. If caller want to keep the object, caller should make the object sink by
GObject.Object.ref_sink
.)
- update_lookup_table_fast(lookup_table, visible)¶
- Parameters:
lookup_table (
IBus.LookupTable
) – An lookup_table.visible (
bool
) – Whether the lookup_table is visible.
Fast update for big lookup table.
If size of lookup table is not over table page size *4, then it calls
IBus.Engine.update_lookup_table
().(Note: The table object will be released, if it is floating. If caller want to keep the object, caller should make the object sink by
GObject.Object.ref_sink
.)
- update_preedit_text(text, cursor_pos, visible)¶
- Parameters:
Update the pre-edit buffer.
(Note: The text object will be released, if it is floating. If caller want to keep the object, caller should make the object sink by
GObject.Object.ref_sink
.)
- update_preedit_text_with_mode(text, cursor_pos, visible, mode)¶
- Parameters:
text (
IBus.Text
) – Update content.cursor_pos (
int
) – Current position of cursorvisible (
bool
) – Whether the pre-edit buffer is visible.mode (
IBus.PreeditFocusMode
) – Pre-edit commit mode when the focus is lost.
Update the pre-edit buffer with commit mode. Similar to
IBus.Engine.update_preedit_text
(), this function allows users to specify the behavior on focus out when the pre-edit buffer is visible.If mode is
IBus.PreeditFocusMode.COMMIT
, contents of the pre-edit buffer will be committed and cleared. If mode isIBus.PreeditFocusMode.CLEAR
, contents of the pre-edit buffer will be cleared only.(Note: The text object will be released, if it is floating. If caller want to keep the object, caller should make the object sink by
GObject.Object.ref_sink
.)
- update_property(prop)¶
- Parameters:
prop (
IBus.Property
) –IBus.Property
to be updated.
Update the state displayed in language bar.
(Note: The prop object will be released, if it is floating. If caller want to keep the object, caller should make the object sink by
GObject.Object.ref_sink
.)
- do_candidate_clicked(index, button, state) virtual¶
- do_cursor_down() virtual¶
- do_cursor_up() virtual¶
- do_disable() virtual¶
- do_enable() virtual¶
- do_focus_in() virtual¶
- do_focus_out() virtual¶
- do_page_down() virtual¶
- do_page_up() virtual¶
- do_process_hand_writing_event(coordinates, coordinates_len) virtual¶
- do_process_key_event(keyval, keycode, state) virtual¶
- do_property_activate(prop_name, prop_state) virtual¶
- do_reset() virtual¶
Signal Details¶
- IBus.Engine.signals.cancel_hand_writing(engine, n_strokes)¶
- Signal Name:
cancel-hand-writing
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signaln_strokes (
int
) – The number of strokes to be removed. 0 means “remove all”.
Emitted when a hand writing operation is cancelled. Implement the member function IBusEngineClass::cancel_hand_writing in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.candidate_clicked(engine, index, button, state)¶
- Signal Name:
candidate-clicked
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalindex (
int
) – Index of candidate be clicked.button (
int
) – Mouse button.state (
int
) – Keyboard state.
Emitted when candidate on lookup table is clicked. Implement the member function IBusEngineClass::candidate_clicked in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.cursor_down(engine)¶
- Signal Name:
cursor-down
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signal
Emitted when the down cursor button is pressed. Implement the member function IBusEngineClass::cursor_down in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.cursor_up(engine)¶
- Signal Name:
cursor-up
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signal
Emitted when the up cursor button is pressed. Implement the member function IBusEngineClass::cursor_up in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.disable(engine)¶
- Signal Name:
disable
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signal
Emitted when the IME is disabled. Implement the member function IBusEngineClass::disable in extended class to receive this signal.
See also:
IBus.Bus.set_global_engine
().Argument user_data is ignored in this function.
- IBus.Engine.signals.enable(engine)¶
- Signal Name:
enable
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signal
Emitted when the IME is enabled. Implement the member function IBusEngineClass::enable in extended class to receive this signal.
See also:
IBus.Bus.set_global_engine
().Argument user_data is ignored in this function.
- IBus.Engine.signals.focus_in(engine)¶
- Signal Name:
focus-in
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signal
Emitted when the client application get the focus. Implement the member function IBusEngineClass::focus_in in extended class to receive this signal.
See also:
IBus.InputContext.focus_in
()Argument user_data is ignored in this function.
- IBus.Engine.signals.focus_in_id(engine, object_path, client)¶
- Signal Name:
focus-in-id
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalobject_path (
str
) – An object path.client (
str
) – An client name.
Emitted when the client application get the focus. Implement the member function IBusEngineClass::focus_in in extended class to receive this signal. object_path is a unique id by input context. client indicates a client type: ‘fake’: focus is on desktop background or other programs where no input is possible ‘xim’: old X11 programs like xterm, emacs, … GTK3 programs in a Gnome Xorg session when GTK_IM_MODULE is unset also use xim ‘gtk-im:<client-name>’: Gtk2 input module is used ‘gtk3-im:<client-name>’: Gtk3 input module is used ‘gtk4-im:<client-name>’: Gtk4 input module is used In case of the Gtk input modules, the name of the client is also shown after the “:”, for example like ‘gtk3-im:firefox’, ‘gtk4-im:gnome-text-editor’, … ‘gnome-shell’: Entries handled by gnome-shell (like the command line dialog opened with Alt+F2 or the search field when pressing the Super key.) When GTK_IM_MODULE is unset in a Gnome Wayland session all programs which would show ‘gtk3-im’ or ‘gtk4-im’ with GTK_IM_MODULE=ibus then show ‘gnome-shell’ instead. ‘Qt’: Qt4 programs like keepassx-2.0.3 … ‘QIBusInputContext’: Qt5 programs like keepassxc-2.7.1, anki-2.1.15 telegram-desktop-3.7.3,
You need to set
IBus.Engine
::has-focus-id
property toTrue
when you construct anIBus.Engine
to use this class method.See also:
IBus.InputContext.focus_in
()Argument user_data is ignored in this function.
- IBus.Engine.signals.focus_out(engine)¶
- Signal Name:
focus-out
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signal
Emitted when the client application lost the focus. Implement the member function IBusEngineClass::focus_out in extended class to receive this signal.
See also:
IBus.InputContext.focus_out
()Argument user_data is ignored in this function.
- IBus.Engine.signals.focus_out_id(engine, object_path)¶
- Signal Name:
focus-out-id
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalobject_path (
str
) – An object path.
Emitted when the client application lost the focus. Implement the member function IBusEngineClass::focus_out in extended class to receive this signal. object_path is a unique id by input context. You need to set
IBus.Engine
::has-focus-id
property toTrue
when you construct anIBus.Engine
to use this class method.See also:
IBus.InputContext.focus_out
()Argument user_data is ignored in this function.
- IBus.Engine.signals.page_down(engine)¶
- Signal Name:
page-down
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signal
Emitted when the page-down button is pressed. Implement the member function IBusEngineClass::page_down in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.page_up(engine)¶
- Signal Name:
page-up
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signal
Emitted when the page-up button is pressed. Implement the member function IBusEngineClass::page_up in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.process_hand_writing_event(engine, coordinates, coordinates_len)¶
- Signal Name:
process-hand-writing-event
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalcoordinates (
object
orNone
) – An array of double (0.0 to 1.0) which represents a stroke (i.e. [x1, y1, x2, y2, x3, y3, …]).coordinates_len (
int
) – The number of elements in the array.
Emitted when a hand writing operation is cancelled. Implement the member function IBusEngineClass::cancel_hand_writing in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.process_key_event(engine, keyval, keycode, state)¶
- Signal Name:
process-key-event
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalkeyval (
int
) – Key symbol of the key press.keycode (
int
) – KeyCode of the key press.state (
int
) – Key modifier flags.
- Returns:
True
for successfully process the key;False
otherwise. See also:IBus.InputContext.process_key_event
().Argument user_data is ignored in this function.
- Return type:
Emitted when a key event is received. Implement the member function IBusEngineClass::process_key_event in extended class to receive this signal. Both the key symbol and keycode are passed to the member function. See
IBus.InputContext.process_key_event
() for further explanation of key symbol, keycode and which to use.
- IBus.Engine.signals.property_activate(engine, name, state)¶
- Signal Name:
property-activate
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalname (
str
) – Property name.state (
int
) – Property state.
Emitted when a property is activated or change changed. Implement the member function IBusEngineClass::property_activate in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.property_hide(engine, name)¶
- Signal Name:
property-hide
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalname (
str
) – Property name.
Emitted when a property is hidden. Implement the member function IBusEngineClass::property_hide in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.property_show(engine, name)¶
- Signal Name:
property-show
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalname (
str
) – Property name.
Emitted when a property is shown. Implement the member function IBusEngineClass::property_side in extended class to receive this signal.
Argument user_data is ignored in this function.
- IBus.Engine.signals.reset(engine)¶
- Signal Name:
reset
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signal
Emitted when the IME is reset. Implement the member function IBusEngineClass::reset in extended class to receive this signal.
See also:
IBus.InputContext.reset
().Argument user_data is ignored in this function.
- IBus.Engine.signals.set_capabilities(engine, caps)¶
- Signal Name:
set-capabilities
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalcaps (
int
) – Capabilities flags ofIBus.Engine
, seeIBus.Capabilite
Emitted when the client application capabilities is set. Implement the member function IBusEngineClass::set_capabilities in extended class to receive this signal.
See also:
IBus.InputContext.set_capabilities
().Argument user_data is ignored in this function.
- IBus.Engine.signals.set_content_type(engine, purpose, hints)¶
- Signal Name:
set-content-type
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalpurpose (
int
) – Primary purpose of the input context, as anIBus.InputPurpose
.hints (
int
) – Hints that augment purpose, as anIBus.InputHints
.
Emitted when the client application content-type (primary purpose and hints) is set. The engine could change the behavior according to the content-type. Implement the member function IBusEngineClass::set_content_type in extended class to receive this signal.
For example, if the client application wants to restrict input to numbers, this signal will be emitted with purpose set to
IBus.InputPurpose.NUMBER
, so the engine can switch the input mode to latin.Argument user_data is ignored in this function.
- IBus.Engine.signals.set_cursor_location(engine, x, y, w, h)¶
- Signal Name:
set-cursor-location
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signalx (
int
) – X coordinate of the cursor.y (
int
) – Y coordinate of the cursor.w (
int
) – Width of the cursor.h (
int
) – Height of the cursor.
Emitted when the location of IME is set. Implement the member function IBusEngineClass::set_cursor_location in extended class to receive this signal.
See also:
IBus.InputContext.set_cursor_location
().Argument user_data is ignored in this function.
- IBus.Engine.signals.set_surrounding_text(engine, text, cursor_pos, anchor_pos)¶
- Signal Name:
set-surrounding-text
- Flags:
- Parameters:
engine (
IBus.Engine
) – The object which received the signaltext (
GObject.Object
) – The surrounding text.cursor_pos (
int
) – The cursor position on surrounding text.anchor_pos (
int
) – The anchor position on selection area.
Emitted when a surrounding text is set. Implement the member function IBusEngineClass::set_surrounding_text in extended class to receive this signal. If anchor_pos equals to cursor_pos, it means “there are no selection” or “does not support selection retrival”.
Argument user_data is ignored in this function.
Property Details¶
- IBus.Engine.props.active_surrounding_text¶
- Name:
active-surrounding-text
- Type:
- Default Value:
- Flags:
When this property is set to
True
, “RequireSurroundingText” D-Bus signal will be called by ibus-daemon on every focus-in/out event, with no need for the engine to callIBus.Engine.get_surrounding_text
(). This property can only be set at construct time.
- IBus.Engine.props.engine_name¶
- Name:
engine-name
- Type:
- Default Value:
'noname'
- Flags:
Name of this
IBus.Engine
.
- IBus.Engine.props.has_focus_id¶
- Name:
has-focus-id
- Type:
- Default Value:
- Flags:
Use #IBusEngine::focus_in_id()/focus_out_id() class method insteads of focus_in()/focus_out() class methods when this property is set to
True
. Otherwise, use #IBusEngine::focus_in()/focus_out class methods. This property can only be set at construct time.See also:
IBus.Engine
::focus-in-id