-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Offer additional engines which do simple ibus-m17n emulation by default
Resolves: #570 ([ENHANCEMENT] Offer additional engines which do simple ibus-m17n emulation by default) Resolves: #569 ([BUG] setup tool may crash when changing the sound file)
- Loading branch information
1 parent
876f0e1
commit fdfe9f0
Showing
11 changed files
with
1,150 additions
and
565 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
from gi.repository import GLib | ||
# pylint: enable=wrong-import-position | ||
|
||
import itb_util | ||
import itb_version | ||
|
||
LOGGER = logging.getLogger('ibus-typing-booster') | ||
|
@@ -250,46 +251,93 @@ def write_xml() -> None: | |
''' | ||
Writes the XML to describe the engine(s) to standard output. | ||
''' | ||
m17n_db_info = itb_util.M17nDbInfo() | ||
m17n_input_methods = set(m17n_db_info.get_imes()) | ||
m17n_input_methods_skip = set([ | ||
'NoIME', | ||
]) | ||
# Input methods offering multiple candidates are not yet supported | ||
# by typing-booster: | ||
m17n_input_methods_multiple_candidates = set([ | ||
'ja-anthy', | ||
't-lsymbol', | ||
'ml-swanalekha', | ||
'vi-han', | ||
'vi-nomtelex', | ||
'vi-nomvni', | ||
'vi-tcvn', | ||
'vi-telex', | ||
'vi-viqr', | ||
'vi-vni', | ||
'zh-cangjie', | ||
'zh-pinyin-vi', | ||
'zh-pinyin', | ||
'zh-py', | ||
'zh-py-b5', | ||
'zh-py-gb', | ||
'zh-quick', | ||
'zh-tonepy', | ||
'zh-tonepy-gb', | ||
'zh-tonepy-b5', | ||
'zh-zhuyin', | ||
]) | ||
supported_input_methods = sorted( | ||
(m17n_input_methods - m17n_input_methods_skip) | ||
- m17n_input_methods_multiple_candidates | ||
) + ['typing-booster'] | ||
# supported_input_methods = ['typing-booster'] | ||
egs = Element('engines') # pylint: disable=possibly-used-before-assignment | ||
|
||
for language in ('t',): | ||
for ime in supported_input_methods: | ||
_engine = SubElement( # pylint: disable=possibly-used-before-assignment | ||
egs, 'engine') | ||
|
||
_name = SubElement(_engine, 'name') | ||
_name.text = 'typing-booster' | ||
name = 'typing-booster' | ||
longname = 'Typing Booster' | ||
language = 't' | ||
license = 'GPL' | ||
author = ('Mike FABIAN <[email protected]>' | ||
', Anish Patil <[email protected]>') | ||
layout = 'default' | ||
icon = os.path.join(ICON_DIR, 'ibus-typing-booster.svg') | ||
description = 'A completion input method to speedup typing.' | ||
symbol = '🚀' | ||
setup = SETUP_TOOL | ||
icon_prop_key = 'InputMode' | ||
if ime != 'typing-booster': | ||
m17n_lang, m17n_name = ime.split('-', maxsplit=1) | ||
name = f'tb:{m17n_lang}:{m17n_name}' | ||
longname = f'{ime} (Typing Booster)' | ||
language = m17n_lang | ||
icon = m17n_db_info.get_icon(ime) | ||
description = m17n_db_info.get_description(ime) | ||
symbol = m17n_lang | ||
if symbol == 't': | ||
symbol = '⌨️' | ||
setup = SETUP_TOOL + f' --engine-name {name}' | ||
|
||
_name = SubElement(_engine, 'name') | ||
_name.text = name | ||
_longname = SubElement(_engine, 'longname') | ||
_longname.text = 'Typing Booster' | ||
|
||
_longname.text = longname | ||
_language = SubElement(_engine, 'language') | ||
_language.text = language | ||
|
||
_license = SubElement(_engine, 'license') | ||
_license.text = 'GPL' | ||
|
||
_license.text = license | ||
_author = SubElement(_engine, 'author') | ||
_author.text = ( | ||
'Mike FABIAN <[email protected]>' | ||
+ ', Anish Patil <[email protected]>') | ||
|
||
_author.text = author | ||
_icon = SubElement(_engine, 'icon') | ||
_icon.text = os.path.join(ICON_DIR, 'ibus-typing-booster.svg') | ||
|
||
_icon.text = icon | ||
_layout = SubElement(_engine, 'layout') | ||
_layout.text = 'default' | ||
|
||
_layout.text = layout | ||
_desc = SubElement(_engine, 'description') | ||
_desc.text = 'A completion input method to speedup typing.' | ||
|
||
_desc.text = description | ||
_symbol = SubElement(_engine, 'symbol') | ||
_symbol.text = '🚀' | ||
|
||
_symbol.text = symbol | ||
_setup = SubElement(_engine, 'setup') | ||
_setup.text = SETUP_TOOL | ||
|
||
_setup.text = setup | ||
_icon_prop_key = SubElement(_engine, 'icon_prop_key') | ||
_icon_prop_key.text = 'InputMode' | ||
_icon_prop_key.text = icon_prop_key | ||
|
||
# now format the xmlout pretty | ||
indent(egs) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.