Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- IBus.accelerator_name(accelerator_key, accelerator_mods)¶
- Parameters:
accelerator_key (
int
) – accelerator keyvalaccelerator_mods (
IBus.ModifierType
) – accelerator modifier mask
- Returns:
a newly-allocated accelerator name
- Return type:
Converts an accelerator keyval and modifier mask into a string parseable by gtk_accelerator_parse(). For example, if you pass in
IBus.KEY_q
andIBus.ModifierType.CONTROL_MASK
, this function returns “<Control>q”.If you need to display accelerators in the user interface, see gtk_accelerator_get_label().
- IBus.accelerator_parse(accelerator)¶
- Parameters:
accelerator (
str
) – string representing an accelerator- Returns:
- Return type:
(accelerator_key:
int
, accelerator_mods:IBus.ModifierType
)
Parses a string representing an accelerator. The format looks like “<Control>a” or “<Shift><Alt>F1” or “<Release%gt;z” (the last one is for key release).
The parser is fairly liberal and allows lower or upper case, and also abbreviations such as “<Ctl>” and “<Ctrl>”. Key names are parsed using gdk_keyval_from_name(). For character keys the name is not the symbol, but the lowercase name, e.g. one would use “<Ctrl>minus” instead of “<Ctrl>-”.
If the parse fails, accelerator_key and accelerator_mods will be set to 0 (zero).
New in version 1.5.18.
- IBus.accelerator_valid(keyval, modifiers)¶
- Parameters:
keyval (
int
) – a GDK keyvalmodifiers (
IBus.ModifierType
) – modifier mask
- Returns:
True
if the accelerator is valid- Return type:
Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator. For example, the
IBus.KEY_a
keyval plusIBus.ModifierType.CONTROL_MASK
is valid - this is a “Ctrl+a” accelerator. But, you can’t, for instance, use theIBus.KEY_Control_L
keyval as an accelerator.
- IBus.attr_background_new(color, start_index, end_index)¶
- Parameters:
- Returns:
A newly allocated
IBus.Attribute
.- Return type:
Creates a new background
IBus.Attribute
.
- IBus.attr_foreground_new(color, start_index, end_index)¶
- Parameters:
- Returns:
A newly allocated
IBus.Attribute
.- Return type:
Creates a new foreground
IBus.Attribute
.
- IBus.attr_underline_new(underline_type, start_index, end_index)¶
- Parameters:
- Returns:
A newly allocated
IBus.Attribute
.- Return type:
Creates a new underline
IBus.Attribute
.
- IBus.emoji_dict_load(path)¶
- Parameters:
path (
str
) – A path of the saved dictionary file.- Returns:
An Emoji dictionary file loaded from the saved cache file.
A hash table of { emoji character,
IBus.EmojiData
object } is loaded from the saved cache file. Recommend to useIBus.EmojiData.load
() instead becaseGLib.SList
inGLib.HashTable
does not work with Gir and Vala. CallsIBus.EmojiData.load
() internally.- Return type:
- IBus.emoji_dict_lookup(dict, emoji)¶
- Parameters:
dict ({
str
:IBus.EmojiData
}) – An Emoji dictionaryemoji (
str
) – an emoji character
- Returns:
An
IBus.EmojiData
of emoji. This API was prepared for the old dict foramat with Gir and Vala but no longer needed. UseIBus.EmojiData.load
() instead.- Return type:
- IBus.emoji_dict_save(path, dict)¶
- Parameters:
Saves the Emoji dictionary to the cache file. Recommend to use
IBus.EmojiData.save
() instead becaseGLib.SList
inGLib.HashTable
does not work with Gir and Vala. CallsIBus.EmojiData.save
() internally. The format of the hash table changed and now is { emoji character,IBus.EmojiData
object }.
- IBus.free_strv(strv)¶
- Parameters:
strv (
str
) – List of strings.
Free a list of strings.
Deprecated since version ???: This function has been deprecated and should not be used in newly written code.
- IBus.get_address()¶
- Returns:
D-Bus address of IBus.
None
for not found.See also:
IBus.write_address
().- Return type:
Return the D-Bus address of IBus. It will find the address from following source:
Environment variable IBUS_ADDRESS
Socket file under ~/.config/ibus/bus/
- IBus.get_daemon_uid()¶
- Returns:
UID of ibus-daemon; or 0 if UID is not available.
- Return type:
Get UID of ibus-daemon.
Deprecated since version ???: This function has been deprecated and should not be used in newly written code.
- IBus.get_language_name(_locale)¶
- IBus.get_local_machine_id()¶
- Returns:
A newly allocated string that shows the UUID of the machine.
- Return type:
Obtains the machine UUID of the machine this process is running on.
- IBus.get_socket_path()¶
- Returns:
A newly allocated string that stores the path of socket file.
- Return type:
Get the path of socket file.
- IBus.get_timeout()¶
- Returns:
A GDBus timeout in milliseconds. -1 when default timeout for GDBus should be used.
- Return type:
Get the GDBus timeout in milliseconds. The timeout is for clients (e.g. im-ibus.so), not for ibus-daemon. Note that the timeout for ibus-daemon could be set by –timeout command line option of the daemon.
- IBus.get_untranslated_language_name(_locale)¶
- IBus.get_user_name()¶
- Returns:
A newly allocated string that stores current user name.
- Return type:
Get the current user name. It is determined by:
getlogin()
Environment variable SUDO_USER
Environment variable USERHELPER_UID
Environment variable USERNAME
Environment variable LOGNAME
Environment variable USER
Environment variable LNAME
- IBus.init()¶
Initialize the ibus types.
- IBus.key_event_from_string(string)¶
- Parameters:
string (
str
) – Key event string.- Returns:
True
for succeed;False
if failed.- keyval:
Variable that hold key symbol result.
- modifiers:
Variable that hold modifiers result.
- Return type:
Parse key event string and return key symbol and modifiers.
- IBus.key_event_to_string(keyval, modifiers)¶
- Parameters:
- Returns:
The name of a key symbol and modifier.
- Return type:
Return the name of a key symbol and modifiers.
For example, if press ctrl, shift, and enter, then this function returns: Shift+Control+enter.
- IBus.keyval_convert_case(symbol)¶
- Parameters:
symbol (
int
) – a keyval- Returns:
- lower:
return location for lowercase version of symbol
- upper:
return location for uppercase version of symbol
- Return type:
Obtains the upper- and lower-case versions of the keyval symbol. Examples of keyvals are
IBus.KEY_a
,IBus.KEY_Return
,IBus.KEY_F1
, etc.
- IBus.keyval_from_name(keyval_name)¶
- Parameters:
keyval_name (
str
) – Key name in #gdk_keys_by_name.- Returns:
Corresponding key symbol.
- Return type:
Return the key symbol that associate with the key name.
- IBus.keyval_name(keyval)¶
- Parameters:
keyval (
int
) – Key symbol.- Returns:
Corresponding key name.
None
if no such key symbol.- Return type:
Return the name of a key symbol.
Note that the returned string is used internally, so don’t free it.
- IBus.keyval_to_lower(keyval)¶
- Parameters:
keyval (
int
) – a key value.- Returns:
the lower case form of keyval, or keyval itself if it is already in lower case or it is not subject to case conversion.
- Return type:
Converts a key value to lower case, if applicable.
- IBus.keyval_to_unicode(keyval)¶
- Parameters:
keyval (
int
) – an IBus key symbol- Returns:
the corresponding unicode character, or 0 if there is no corresponding character.
- Return type:
Convert from an IBus key symbol to the corresponding ISO10646 (Unicode) character.
- IBus.keyval_to_upper(keyval)¶
- Parameters:
keyval (
int
) – a key value.- Returns:
the upper case form of keyval, or keyval itself if it is already in upper case or it is not subject to case conversion.
- Return type:
Converts a key value to upper case, if applicable.
- IBus.quit()¶
Stops an IBus from running.
Any calls to
IBus.quit
() for the loop will return. See also:IBus.main
().
- IBus.set_display(display)¶
- Parameters:
display (
str
) – Display address, as in DISPLAY environment for X.
Set the display address.
- IBus.set_log_handler(verbose)¶
-
Sets GLIB’s log handler to ours. Our log handler adds time info including hour, minute, second, and microsecond, like:
(ibus-daemon:7088): IBUS-DEBUG: 18:06:45.822819: ibus-daemon started
If verbose is
True
, all levels of messages will be logged. Otherwise, DEBUG and WARNING messages will be ignored. The function is used in ibus-daemon, but can be useful for IBus client programs as well for debugging. It’s totally fine for not calling this function. If you don’t set a custom GLIB log handler, the default GLIB log handler will be used.
- IBus.unicode_to_keyval(wc)¶
- Parameters:
wc (
str
) – a ISO10646 encoded character- Returns:
the corresponding IBus key symbol, if one exists. or, if there is no corresponding symbol, wc | 0x01000000
- Return type:
Convert from a ISO10646 character to a key symbol.
- IBus.unset_log_handler()¶
Remove the log handler which is set by
IBus.set_log_handler
.
- IBus.write_address(address)¶
- Parameters:
address (
str
) – D-Bus address of IBus.
Write D-Bus address to socket file.
See also:
IBus.get_address
().