[ibus-typing-booster] master: Remove code to just pass Control and Alternate through (027203b)
by mfabian@fedoraproject.org
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 027203b860ba40f491f2519eb3b249245e2096f7
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Mon Dec 14 17:26:26 2015 +0100
Remove code to just pass Control and Alternate through
Not needed here, inherited from ibus-table
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index 121b944..bba3d13 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -1199,12 +1199,6 @@ class tabengine (IBus.Engine):
self.forward_key_event(key.val, key.code, key.state)
return True
- # We pass all other hotkeys through:
- if key.state & IBus.ModifierType.CONTROL_MASK:
- return False
- if key.state & IBus.ModifierType.MOD1_MASK:
- return False
-
if IBus.keyval_to_unicode(key.val):
if self._editor.is_empty():
# first key typed, we will try to complete something now
8 years, 5 months
[ibus-typing-booster] master: Use Transliterator from m17n_translit.py (9befbc6)
by mfabian@fedoraproject.org
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 9befbc680793016cc2b1ca57108c9bafc0e5b8d8
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Dec 8 14:32:55 2015 +0100
Use Transliterator from m17n_translit.py
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 62 ++++++++++---------------
1 files changed, 25 insertions(+), 37 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index 6aca2eb..69629d5 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -28,17 +28,11 @@ import unicodedata
import re
from gi.repository import IBus
from gi.repository import GLib
+from m17n_translit import Transliterator
import itb_util
debug_level = int(0)
-try:
- from gi.repository import Translit
- Transliterator = Translit.Transliterator
-except:
- import traceback
- traceback.print_exc()
-
from gettext import dgettext
_ = lambda a : dgettext ("ibus-typing-booster", a)
N_ = lambda a : a
@@ -102,9 +96,9 @@ class editor(object):
self._min_char_complete = 1 # minimum
if self._min_char_complete > 9:
self._min_char_complete = 9 # maximum
- self._typed_string = u''
+ self._typed_string = []
self._typed_string_cursor = 0
- self._typed_string_when_update_candidates_was_last_called = u''
+ self._typed_string_when_update_candidates_was_last_called = []
self._transliterated_string = u''
self._p_phrase = u''
self._pp_phrase = u''
@@ -147,10 +141,11 @@ class editor(object):
try:
if debug_level > 1:
sys.stderr.write(
- "calling Transliterator.get(%(m17n)s, %(cur)s)\n"
- %{'m17n': self._m17ndb, 'cur': self._current_ime})
- self.trans = Transliterator.get(self._m17ndb, self._current_ime)
- except:
+ "calling Transliterator(%(cur)s)\n"
+ %{'cur': self._current_ime})
+ self.trans = Transliterator(self._current_ime)
+ except ValueError as e:
+ sys.stderr.write('Error initializing Transliterator: %s' %e)
import traceback
traceback.print_exc()
@@ -162,15 +157,15 @@ class editor(object):
self._lookup_table.clear()
self._lookup_table.set_cursor_visible(False)
self._candidates = []
- self._typed_string = u''
+ self._typed_string = []
self._typed_string_cursor = 0
- self._typed_string_when_update_candidates_was_last_called = u''
+ self._typed_string_when_update_candidates_was_last_called = []
self._transliterated_string = u''
def update_transliterated_string(self):
if self.trans_m17n_mode:
self._transliterated_string = self.trans.transliterate(
- self._typed_string)[0]
+ self._typed_string)
if type(self._transliterated_string) != type(u''):
self._transliterated_string = (
self._transliterated_string.decode('UTF-8'))
@@ -178,22 +173,15 @@ class editor(object):
self._transliterated_string = unicodedata.normalize(
'NFKD', self._transliterated_string)
else:
- self._transliterated_string = self._typed_string
+ self._transliterated_string = u''.join.self._typed_string
if debug_level > 1:
sys.stderr.write(
"update_transliterated_string() self._typed_string=%s\n"
- %self._typed_string.encode('UTF-8'))
- sys.stderr.write(
- "update_transliterated_string() repr(self._typed_string)=%s\n"
- %repr(self._typed_string))
+ %self._typed_string)
sys.stderr.write(
"update_transliterated_string() "
+ "self._transliterated_string=%s\n"
- %self._transliterated_string.encode('UTF-8'))
- sys.stderr.write(
- "update_transliterated_string() "
- + "repr(self._transliterated_string)=%s\n"
- %repr(self._transliterated_string))
+ %self._transliterated_string)
def get_transliterated_string(self):
return self._transliterated_string
@@ -202,10 +190,10 @@ class editor(object):
'''Insert typed string at cursor position'''
if debug_level > 1:
sys.stderr.write("insert_string_at_cursor() string_to_insert=%s\n"
- %string_to_insert.encode('UTF-8'))
+ %string_to_insert)
sys.stderr.write("insert_string_at_cursor() "
+ "self._typed_string=%s\n"
- %self._typed_string.encode('UTF-8'))
+ %self._typed_string)
sys.stderr.write("insert_string_at_cursor() "
+ "self._typed_string_cursor=%s\n"
%self._typed_string_cursor)
@@ -258,7 +246,7 @@ class editor(object):
position can only be approximated from the cursor position in
the typed string.
- For example, if the type string is ���gru"n��� and the
+ For example, if the typed string is ���gru"n��� and the
transliteration method used is ���Latin Postfix���, this
transliterates to ���gr��n���. Now if the cursor position in the
typed string is ���3���, then the cursor is between the ���u���
@@ -293,13 +281,13 @@ class editor(object):
'''
if self.trans_m17n_mode:
transliterated_string_up_to_cursor = self.trans.transliterate(
- self._typed_string[:self._typed_string_cursor])[0]
+ self._typed_string[:self._typed_string_cursor])
if type(transliterated_string_up_to_cursor) != type(u''):
transliterated_string_up_to_cursor = (
transliterated_string_up_to_cursor.decode('UTF-8'))
else:
transliterated_string_up_to_cursor = (
- self._typed_string[:self._typed_string_cursor])
+ u''.join(self._typed_string[:self._typed_string_cursor]))
if self._current_ime in ['ko-romaja', 'ko-han2']:
transliterated_string_up_to_cursor = unicodedata.normalize(
'NFKD', transliterated_string_up_to_cursor)
@@ -366,7 +354,7 @@ class editor(object):
'''Update lookuptable'''
if debug_level > 1:
sys.stderr.write("update_candidates() self._typed_string=%s\n"
- %self._typed_string.encode('UTF-8'))
+ %self._typed_string)
if (self._typed_string
== self._typed_string_when_update_candidates_was_last_called):
# The input did not change since we came here last, do
@@ -517,7 +505,7 @@ class editor(object):
# the remembered list of transliterated characters to
# force update_candidates() to really do something and not
# return immediately:
- self._typed_string_when_update_candidates_was_last_called = u''
+ self._typed_string_when_update_candidates_was_last_called = []
self.update_candidates()
return True
else:
@@ -966,7 +954,7 @@ class tabengine (IBus.Engine):
token = match.group('token')
self.delete_surrounding_text(-1-len(token), 1+len(token))
self.get_context()
- self._editor.insert_string_at_cursor(token)
+ self._editor.insert_string_at_cursor(list(token))
self._update_ui()
return True
if (key.val >= 32
@@ -999,7 +987,7 @@ class tabengine (IBus.Engine):
# therefore we cannot just pass it through. Just
# add it to the input so far and see what comes
# next:
- self._editor.insert_string_at_cursor(typed_character)
+ self._editor.insert_string_at_cursor(list(typed_character))
self._update_ui()
return True
if (typed_character
@@ -1014,7 +1002,7 @@ class tabengine (IBus.Engine):
# want ���3��� to be converted to ���������. So we try
# to transliterate and commit the result:
transliterated_digit = self._editor.trans.transliterate(
- typed_character)[0]
+ list(typed_character))
if type(transliterated_digit) != type(u''):
transliterated_digit = (
transliterated_digit.decode('utf8'))
@@ -1216,7 +1204,7 @@ class tabengine (IBus.Engine):
sys.stderr.write(
"MOD5_MASK=%(bit)s\n"
%{'bit': key.state & IBus.ModifierType.MOD5_MASK})
- self._editor.insert_string_at_cursor(typed_character)
+ self._editor.insert_string_at_cursor(list(typed_character))
if (typed_character
and unicodedata.category(typed_character)
in itb_util.categories_to_trigger_immediate_commit):
8 years, 5 months
[ibus-typing-booster] master: Forward key events triggering a commit using ���forward_key_event()��� instead of relying on ���return False��� (46bd8b3)
by mfabian@fedoraproject.org
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 46bd8b3c7d8ab73ec99cf31e3245295b37a3534f
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Mon Dec 14 12:45:35 2015 +0100
Forward key events triggering a commit using ���forward_key_event()��� instead of relying on ���return False���
Resolves: rhbz#1291238 - committing with the space key in ibus-typing-booster works correctly only in GTK applications but not in Qt and X11 applications
See: https://bugzilla.redhat.com/show_bug.cgi?id=1291238
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index 69629d5..d1003d4 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -1184,7 +1184,19 @@ class tabengine (IBus.Engine):
# as the committed string has characters:
for c in commit_string:
self.forward_key_event(key.val, key.code, key.state)
- return False
+ # Forward the key event which triggered the commit here
+ # and return True instead of trying to pass that key event
+ # to the application by returning False. Doing it by
+ # returning false works correctly in GTK applications but
+ # not in Qt or X11 applications. When ���return False��� is
+ # used, the key event which triggered the commit here
+ # arrives in Qt or X11 *before* the committed
+ # string. I.e. when typing ���word ��� the space which
+ # triggered the commit gets to application first and the
+ # applications receives ��� word���.
+ # See: https://bugzilla.redhat.com/show_bug.cgi?id=1291238
+ self.forward_key_event(key.val, key.code, key.state)
+ return True
# We pass all other hotkeys through:
if key.state & IBus.ModifierType.CONTROL_MASK:
8 years, 5 months
[ibus-typing-booster] master: Add m17n_translit.py to engine/Makefile.am to install it (fa2d739)
by mfabian@fedoraproject.org
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit fa2d739362d172ba2bf59637c0565597ee7d2dfd
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Wed Dec 16 00:32:47 2015 +0100
Add m17n_translit.py to engine/Makefile.am to install it
>---------------------------------------------------------------
ibus-typing-booster/engine/Makefile.am | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/ibus-typing-booster/engine/Makefile.am b/ibus-typing-booster/engine/Makefile.am
index 1ed7913..2ede0e6 100644
--- a/ibus-typing-booster/engine/Makefile.am
+++ b/ibus-typing-booster/engine/Makefile.am
@@ -22,6 +22,7 @@ engine_table_PYTHON = \
hunspell_suggest.py \
tabsqlitedb.py \
itb_util.py \
+ m17n_translit.py \
$(NULL)
engine_table_DATA = \
$(NULL)
8 years, 5 months
[ibus-typing-booster] master: Add m17n_translit.py module to use libm17n directly (f925d36)
by mfabian@fedoraproject.org
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit f925d3644253b8a7817563146f3760abc0a578fc
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Mon Dec 7 23:57:11 2015 +0100
Add m17n_translit.py module to use libm17n directly
Add a m17n_translit.py module to be able to use libm17n directly
without going through libtranslit.
This is needed to support modifier keys, some input methods
like hi-inscript2 use AltGr+<letter> a lot and libtranslit does
not support that.
>---------------------------------------------------------------
ibus-typing-booster/engine/m17n_translit.py | 272 +++++++++++++++++++++++++++
1 files changed, 272 insertions(+), 0 deletions(-)
diff --git a/ibus-typing-booster/engine/m17n_translit.py b/ibus-typing-booster/engine/m17n_translit.py
new file mode 100644
index 0000000..f56855c
--- /dev/null
+++ b/ibus-typing-booster/engine/m17n_translit.py
@@ -0,0 +1,272 @@
+# -*- coding: utf-8 -*-
+# vim:et sts=4 sw=4
+#
+# ibus-typing-booster - The Tables engine for IBus
+#
+# Copyright (c) 2015 Mike FABIAN <mfabian(a)redhat.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>
+
+import ctypes
+
+class libm17n__MSymbolStruct(ctypes.Structure):
+ pass
+libm17n__MSymbol = ctypes.POINTER(libm17n__MSymbolStruct)
+class libm17n__MPlist(ctypes.Structure):
+ pass
+class libm17n__MConverter(ctypes.Structure):
+ pass
+class libm17n__MInputMethod(ctypes.Structure):
+ pass
+class libm17n__MInputContext(ctypes.Structure):
+ pass
+class libm17n__MText(ctypes.Structure):
+ pass
+libm17n__MSymbolStruct._fields_ = [
+ ('managing_key', ctypes.c_uint),
+ ('name', ctypes.c_char_p),
+ ('length', ctypes.c_int),
+ ('plist', libm17n__MPlist),
+ ('next', ctypes.POINTER(libm17n__MSymbolStruct))]
+
+libm17n__lib = None
+libm17n__msymbol = None
+libm17n__mplist = None
+libm17n__mconv_buffer_converter = None
+libm17n__mconv_reset_converter = None
+libm17n__mconv_rebind_buffer = None
+libm17n__mconv_encode = None
+libm17n__minput_open_im = None
+libm17n__minput_create_ic = None
+libm17n__minput_reset_ic = None
+libm17n__minput_filter = None
+libm17n__minput_lookup = None
+libm17n__mtext = None
+libm17n__mtext_len = None
+libm17n__Mcoding_utf_8 = None
+
+_utf8_converter = None
+
+def mtext_to_string(mtext_pointer):
+ '''Return the text contained in an MText object as a Python string
+
+ :param mtext_pointer: pointer to the MText object to get the text from
+ :type mtext_pointer: pointer to an libm17n MText object
+ :rtype: string
+ '''
+ libm17n__mconv_reset_converter(_utf8_converter)
+ # one Unicode character cannot have more than 6 UTF-8 bytes
+ # (actually not more than 4 ...)
+ conversion_buffer = bytes(libm17n__mtext_len(mtext_pointer) * 6)
+ libm17n__mconv_rebind_buffer(
+ _utf8_converter, ctypes.c_char_p(conversion_buffer), ctypes.c_int(10))
+ libm17n__mconv_encode(_utf8_converter, mtext_pointer)
+ # maybe not all of the buffer was really used for the conversion,
+ # cut of the unused part:
+ conversion_buffer = conversion_buffer[0:conversion_buffer.find(b'\x00')]
+ return conversion_buffer.decode('utf-8')
+
+def _init():
+ '''Open libm17n and fill global variables for functions and
+ variables from libm17n
+ '''
+ global libm17n__lib
+ libm17n__lib = ctypes.CDLL('libm17n.so.0', mode = ctypes.RTLD_GLOBAL)
+ libm17n__lib.m17n_init()
+ global libm17n__mplist
+ libm17n__mplist = libm17n__lib.mplist
+ libm17n__mplist.argtypes = []
+ libm17n__mplist.restype = ctypes.POINTER(libm17n__MPlist)
+ global libm17n__mconv_buffer_converter
+ libm17n__mconv_buffer_converter = libm17n__lib.mconv_buffer_converter
+ libm17n__mconv_buffer_converter.argtypes = [
+ libm17n__MSymbol, ctypes.c_char_p, ctypes.c_int]
+ libm17n__mconv_buffer_converter.restype = ctypes.POINTER(
+ libm17n__MConverter)
+ global libm17n__mconv_reset_converter
+ libm17n__mconv_reset_converter = libm17n__lib.mconv_reset_converter
+ libm17n__mconv_reset_converter.argtypes = [
+ ctypes.POINTER(libm17n__MConverter)]
+ libm17n__mconv_reset_converter.restype = ctypes.c_int
+ global libm17n__mconv_rebind_buffer
+ libm17n__mconv_rebind_buffer = libm17n__lib.mconv_rebind_buffer
+ libm17n__mconv_rebind_buffer.argtypes = [
+ ctypes.POINTER(libm17n__MConverter), ctypes.c_char_p, ctypes.c_int]
+ libm17n__mconv_rebind_buffer.restype = ctypes.POINTER(libm17n__MConverter)
+ global libm17n__mconv_encode
+ libm17n__mconv_encode = libm17n__lib.mconv_encode
+ libm17n__mconv_encode.argtypes = [
+ ctypes.POINTER(libm17n__MConverter), ctypes.POINTER(libm17n__MText)]
+ libm17n__mconv_encode.restype = ctypes.c_int
+ global libm17n__msymbol
+ libm17n__msymbol = libm17n__lib.msymbol
+ libm17n__msymbol.argtypes = [ctypes.c_char_p]
+ libm17n__msymbol.restype = libm17n__MSymbol
+ global libm17n__minput_open_im
+ libm17n__minput_open_im = libm17n__lib.minput_open_im
+ libm17n__minput_open_im.argtypes = [
+ libm17n__MSymbol, libm17n__MSymbol, ctypes.c_void_p]
+ libm17n__minput_open_im.restype = ctypes.POINTER(libm17n__MInputMethod)
+ global libm17n__minput_create_ic
+ libm17n__minput_create_ic = libm17n__lib.minput_create_ic
+ libm17n__minput_create_ic.argtypes = [
+ ctypes.POINTER(libm17n__MInputMethod), ctypes.c_void_p]
+ libm17n__minput_create_ic.restype = ctypes.POINTER(libm17n__MInputContext)
+ global libm17n__minput_reset_ic
+ libm17n__minput_reset_ic = libm17n__lib.minput_reset_ic
+ libm17n__minput_reset_ic.argtypes = [ctypes.POINTER(libm17n__MInputContext)]
+ global libm17n__minput_filter
+ libm17n__minput_filter = libm17n__lib.minput_filter
+ libm17n__minput_filter.argtypes = [
+ ctypes.POINTER(libm17n__MInputContext),
+ libm17n__MSymbol,
+ ctypes.c_void_p]
+ libm17n__minput_filter.restype = ctypes.c_int
+ global libm17n__minput_lookup
+ libm17n__minput_lookup = libm17n__lib.minput_lookup
+ libm17n__minput_lookup.argtypes = [
+ ctypes.POINTER(libm17n__MInputContext),
+ libm17n__MSymbol,
+ ctypes.c_void_p,
+ ctypes.POINTER(libm17n__MText)]
+ libm17n__minput_lookup.restype = ctypes.c_int
+ global libm17n__mtext
+ libm17n__mtext = libm17n__lib.mtext
+ libm17n__mtext.argtypes = []
+ libm17n__mtext.restype = ctypes.POINTER(libm17n__MText)
+ global libm17n__mtext_len
+ libm17n__mtext_len = libm17n__lib.mtext_len
+ libm17n__mtext_len.argtypes = [ctypes.POINTER(libm17n__MText)]
+ libm17n__mtext_len.restype = ctypes.c_int
+ global libm17n__Mcoding_utf_8
+ libm17n__Mcoding_utf_8 = libm17n__MSymbol.in_dll(
+ ctypes.pythonapi, 'Mcoding_utf_8')
+ global _utf8_converter
+ _utf8_converter = libm17n__mconv_buffer_converter(
+ libm17n__Mcoding_utf_8, ctypes.c_char_p(None), ctypes.c_int(0))
+
+def _del():
+ '''Cleanup'''
+ libm17n__lib.m17n_fini()
+
+class __ModuleInitializer:
+ def __init__(self):
+ _init()
+ return
+
+ def __del__(self):
+ return
+
+__module_init = __ModuleInitializer()
+
+
+class Transliterator:
+ '''A class for transliterators using libm17n
+
+ Examples:
+
+ Russian transliteration:
+
+ >>> trans = Transliterator('ru-translit')
+ >>> trans.transliterate(list('y'))
+ '��'
+ >>> trans.transliterate(list('yo'))
+ '��'
+ >>> trans.transliterate(list('yo y'))
+ '�� ��'
+
+ Marathi transliteration:
+
+ >>> trans = Transliterator('mr-itrans')
+ >>> trans.transliterate(list('praviN'))
+ '���������������������'
+
+ Hindi-Inscript2 uses the AltGr key a lot, 'G-4' is
+ the MSymbol name for AltGr-4 and it transliterates
+ to something different than just '4':
+
+ >>> trans = Transliterator('hi-inscript2')
+ >>> trans.transliterate(['4', 'G-4'])
+ '������'
+
+ >>> trans = Transliterator('t-latn-post')
+ >>> trans.transliterate(list('gru"n'))
+ 'gr��n'
+
+ If initializing the transliterator fails, for example
+ because a non-existing input method was give as the argument,
+ a ValueError is raised:
+
+ >>> trans = Transliterator('ru-translitx')
+ Traceback (most recent call last):
+ File "/usr/lib64/python3.4/doctest.py", line 1318, in __run
+ compileflags, 1), test.globs)
+ File "<doctest __main__.Transliterator[8]>", line 1, in <module>
+ trans = Transliterator('ru-translitx')
+ File "m17n_translit.py", line 194, in __init__
+ raise ValueError('minput_open_im() failed')
+ ValueError: minput_open_im() failed
+ '''
+ def __init__(self, ime):
+ '''Initialize the input method to use for the transliteration
+
+ Raises ValueError if something fails.
+
+ :param ime: Full name of the m17n input method, for example
+ ���hi-inscript2��� or ���t-latn-post���
+ :type ime: string
+ '''
+ language = ime.split('-')[0]
+ name = '-'.join(ime.split('-')[1:])
+ self._im = libm17n__minput_open_im(
+ libm17n__msymbol(ctypes.c_char_p(language.encode('utf-8'))),
+ libm17n__msymbol(ctypes.c_char_p(name.encode('utf-8'))),
+ ctypes.c_void_p(None))
+ try:
+ _im_contents = self._im.contents
+ except ValueError: # NULL pointer access
+ raise ValueError('minput_open_im() failed')
+ self._ic = libm17n__minput_create_ic(self._im, ctypes.c_void_p(None))
+ try:
+ _ic_contents = self._ic.contents
+ except ValueError: # NULL pointer access
+ raise ValueError('minput_create_ic() failed')
+
+ def transliterate(self, msymbol_list):
+ '''Transliterate a list of Msymbol names
+
+ :param msymbol_list: A list of python strings which
+ are interpreted as the names of Msymbols
+ to transliterate
+ :rtype: string
+ '''
+ if type(msymbol_list) != type([]):
+ raise ValueError('Argument of transliterate() must be a list.')
+ libm17n__minput_reset_ic(self._ic)
+ output = ''
+ for symbol in msymbol_list + ['nil']:
+ _symbol = libm17n__msymbol(symbol.encode('utf-8'))
+ retval = libm17n__minput_filter(
+ self._ic, _symbol, ctypes.c_void_p(None))
+ if retval == 0:
+ _mt = libm17n__mtext()
+ retval = libm17n__minput_lookup(
+ self._ic, _symbol, ctypes.c_void_p(None), _mt)
+ if libm17n__mtext_len(_mt) > 0:
+ output += mtext_to_string(_mt)
+ if retval and symbol != 'nil':
+ output += symbol
+ return output
+
+if __name__ == "__main__":
+ import doctest
+ doctest.testmod()
8 years, 5 months
[ibus-typing-booster] master: Fix string formatting error in debug code (5b440b2)
by mfabian@fedoraproject.org
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 5b440b282390aef3d2bba9408ac1f753fc62c2ce
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Mon Dec 14 11:39:38 2015 +0100
Fix string formatting error in debug code
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index 9ed1240..6aca2eb 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -878,17 +878,18 @@ class tabengine (IBus.Engine):
if debug_level > 1:
sys.stderr.write(
"do_process_key_event(keyval=%(kv)s, "
+ %{'kv': keyval}
+ "keycode=%(kc)s, state=%(st)s)\n"
- %{'kv': keyval, 'kc': keycode, 'st': state})
+ %{'kc': keycode, 'st': state})
key = KeyEvent(keyval, keycode, state)
if debug_level > 1:
sys.stderr.write(
"process_key_event() after KeyEvent() "
- + "key.val=%(kval)s "
- + "IBus.keyval_to_unicode(%(key.code)s)=%(uc)s\n"
- %{'kval': key.val,
- 'key.code': key.code,
- 'uc': IBus.keyval_to_unicode(key.code)})
+ + "key.code=%(key.code)s "
+ %{'key.code': key.code}
+ + "IBus.keyval_to_unicode(%(key.val)s)='%(uc)s'\n"
+ %{'key.val': key.val,
+ 'uc': IBus.keyval_to_unicode(key.val)})
result = self._process_key_event (key)
return result
@@ -912,9 +913,9 @@ class tabengine (IBus.Engine):
"_process_key_event() self._editor.is_empty ():\n")
sys.stderr.write(
"key.val=%(key.val)s "
- + "IBus.keyval_to_unicode(key.val)=%(keychar)s\n"
- %{'key.val': key.val,
- 'keychar': IBus.keyval_to_unicode(key.val)})
+ %{'key.val': key.val}
+ + "IBus.keyval_to_unicode(key.val)='%(keychar)s'\n"
+ %{'keychar': IBus.keyval_to_unicode(key.val)})
sys.stderr.write(
"IBus.keyval_name(key.val)=%s\n"
%IBus.keyval_name(key.val))
8 years, 5 months
[ibus-typing-booster] master: Remove clearing of NumLock/MOD2 flag when processing keys (7aeccb6)
by mfabian@fedoraproject.org
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : master
>---------------------------------------------------------------
commit 7aeccb6d2ad644abdc3a09487f599d98f10408e3
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Dec 8 13:56:56 2015 +0100
Remove clearing of NumLock/MOD2 flag when processing keys
Inherited from ibus table, not needed here.
>---------------------------------------------------------------
ibus-typing-booster/engine/hunspell_table.py | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/ibus-typing-booster/engine/hunspell_table.py b/ibus-typing-booster/engine/hunspell_table.py
index 98c6965..9ed1240 100644
--- a/ibus-typing-booster/engine/hunspell_table.py
+++ b/ibus-typing-booster/engine/hunspell_table.py
@@ -889,8 +889,6 @@ class tabengine (IBus.Engine):
%{'kval': key.val,
'key.code': key.code,
'uc': IBus.keyval_to_unicode(key.code)})
- # ignore NumLock mask
- key.state &= ~IBus.ModifierType.MOD2_MASK
result = self._process_key_event (key)
return result
8 years, 5 months
[ibus-typing-booster] release-1.3.0: Release 1.3.0 (1e4799a)
by mfabian@fedoraproject.org
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : release-1.3.0
>---------------------------------------------------------------
commit 1e4799af24b6060717799b9606f414726a50cf0b
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Tue Dec 15 22:58:48 2015 +0100
Release 1.3.0
>---------------------------------------------------------------
ibus-typing-booster/ChangeLog | 11 +++++++++++
ibus-typing-booster/configure.ac | 4 ++--
ibus-typing-booster/ibus-typing-booster.pc.in | 2 +-
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/ibus-typing-booster/ChangeLog b/ibus-typing-booster/ChangeLog
index 61bce35..802932d 100644
--- a/ibus-typing-booster/ChangeLog
+++ b/ibus-typing-booster/ChangeLog
@@ -1,4 +1,15 @@
* Author: Mike FABIAN <mfabian(a)redhat.com>
+* 15 Dez 2015 Released 1.3.0 version
+* Use libm17n directly instead of going through libtranslit
+* Forward key events triggering a commit using ���forward_key_event()��� instead of relying on ���return False��� (Resolves: rhbz#1291238)
+* Add code to use F1-F9 as well as keys to select candidates for commit or remove
+* Don���t commit invisible candidates with select keys with numbers greater than the length of a page of the candidate list
+* Control-arrow-left and Control-arrow-right now commit when the edges of the pre��dit string are reached
+* Alt-<number> does not delete a prediction anymore, now only Control-<number> does this
+* Add an option to disable the use of the digits 1-9 as selection keys (useful if one wants easier number input, selection then works only with the F1-F9 keys)
+* Support input methods using AltGr (e.g. mr-inscript2) and Alt keys (e.g. ta-lk-renganathan) (Resolves: rhbz#1051405, rhbz#772665)
+
+* Author: Mike FABIAN <mfabian(a)redhat.com>
* 02 Nov 2015 Released 1.2.15 version
* Use open() instead of codecs.open() to make the input method help button work again (Resolves: rhbz#1276992)
* Fix some pylint warnings
diff --git a/ibus-typing-booster/configure.ac b/ibus-typing-booster/configure.ac
index 2627871..0eb942e 100755
--- a/ibus-typing-booster/configure.ac
+++ b/ibus-typing-booster/configure.ac
@@ -23,8 +23,8 @@
m4_define([package_name], [ibus-typing-booster])
m4_define([ibus_released], [1])
m4_define([ibus_major_version], [1])
-m4_define([ibus_minor_version], [2])
-m4_define([ibus_micro_version], [15])
+m4_define([ibus_minor_version], [3])
+m4_define([ibus_micro_version], [0])
m4_define(ibus_maybe_datestamp,
m4_esyscmd([if test x]ibus_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
diff --git a/ibus-typing-booster/ibus-typing-booster.pc.in b/ibus-typing-booster/ibus-typing-booster.pc.in
index 3999933..e2335a5 100755
--- a/ibus-typing-booster/ibus-typing-booster.pc.in
+++ b/ibus-typing-booster/ibus-typing-booster.pc.in
@@ -11,7 +11,7 @@ enginedir=/usr/share/ibus/engine
Name: IBus-Typing-Booster
Description: Table Based Input Method Framework for Intelligent Input Bus for Linux / Unix OS
-Version: 1.2.15
+Version: 1.3.0
Requires:
Libs:
Cflags:
8 years, 5 months
[ibus-typing-booster] release-1.3.0: Update German translation (ee9fbbb)
by mfabian@fedoraproject.org
Repository : http://git.fedorahosted.org/git/?p=ibus-typing-booster.git
On branch : release-1.3.0
>---------------------------------------------------------------
commit ee9fbbb63286d3cf0bd6b0e544c652735a572908
Author: Mike FABIAN <mfabian(a)redhat.com>
Date: Wed Dec 16 00:34:31 2015 +0100
Update German translation
>---------------------------------------------------------------
ibus-typing-booster/po/de.po | 60 +++++++++++++-----------
ibus-typing-booster/po/ibus-typing-booster.pot | 58 ++++++++++++-----------
2 files changed, 63 insertions(+), 55 deletions(-)
diff --git a/ibus-typing-booster/po/de.po b/ibus-typing-booster/po/de.po
index 49da678..31961f6 100644
--- a/ibus-typing-booster/po/de.po
+++ b/ibus-typing-booster/po/de.po
@@ -10,8 +10,8 @@ msgid ""
msgstr ""
"Project-Id-Version: ibus-typing-booster 0.0.16\n"
"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
-"POT-Creation-Date: 2015-11-02 14:16+0900\n"
-"PO-Revision-Date: 2015-09-24 13:51+0200\n"
+"POT-Creation-Date: 2015-12-15 23:37+0100\n"
+"PO-Revision-Date: 2015-12-16 00:35+0100\n"
"Last-Translator: Mike FABIAN <mfabian(a)redhat.com>\n"
"Language-Team: German <trans-de(a)lists.fedoraproject.org>\n"
"Language: de\n"
@@ -29,16 +29,16 @@ msgstr "Einstellungen"
msgid "Configure ibus-typing-booster ���%(name)s���"
msgstr "Ibus Typing Booster \"%(name)s\" Einstellungen"
-#: setup/main.py:103
+#: setup/main.py:101
#, python-format
msgid "Unknown format of engine name: IBUS_ENGINE_NAME=%(name)s"
msgstr "Unbekanntes Format des Enginenamens: IBUS_ENGINE_NAME=%(name)s"
-#: setup/main.py:108
+#: setup/main.py:107
msgid "IBUS_ENGINE_NAME environment variable is not set."
msgstr "Die IBUS_ENGINE_NAME Umgebungsvariable variable is nicht gesetzt."
-#: setup/main.py:112
+#: setup/main.py:111
msgid ""
"Cannot determine the config file for this engine. Please use the --config-"
"file option."
@@ -60,29 +60,29 @@ msgstr "Ibus l��uft nicht."
msgid "Preferences for ibus-typing-booster \"%(symbol)s\""
msgstr "Ibus Typing Booster \"%(symbol)s\" Einstellungen"
-#: setup/main.py:262
+#: setup/main.py:273
msgid "Another instance of this app is already running."
msgstr "Eine Instanz dieses Programms l��uft schon."
-#: setup/main.py:357
+#: setup/main.py:368
msgid "Open File ..."
msgstr "��ffne Datei"
-#: setup/main.py:375
+#: setup/main.py:386
#, python-format
msgid "Learned successfully from file %(filename)s."
msgstr "Das Lernen aus der Datei %(filename)s war erfolgreich."
-#: setup/main.py:384
+#: setup/main.py:395
#, python-format
msgid "Learning from file %(filename)s failed."
msgstr "Fehler beim Lernen aus der Datai %(filename)s."
-#: setup/main.py:393
+#: setup/main.py:404
msgid "Are you sure?"
msgstr "Sind Sie sicher?"
-#: setup/main.py:400
+#: setup/main.py:411
msgid ""
"Do you really want to delete all language \n"
"data learned from typing or reading files?"
@@ -90,75 +90,79 @@ msgstr ""
"Wollen Sie wirklich alle Sprachdaten l��schen, die aus den\n"
"Usereingaben oder aus Dateien gelernt wurden?"
-#: setup/setup.glade:29
+#: setup/setup.glade:35
msgid "Close"
msgstr "Schlie��en"
-#: setup/setup.glade:77
+#: setup/setup.glade:83
msgid "Enable suggestions by Tab key"
msgstr "Vorschl��ge nur bei Dr��cken von TAB"
-#: setup/setup.glade:101
+#: setup/setup.glade:106
msgid "Candidate window page size:"
msgstr "Anzahl der Vorschl��ge pro Seite:"
-#: setup/setup.glade:137
+#: setup/setup.glade:142
msgid "Input Method:"
msgstr "Eingabemethode:"
-#: setup/setup.glade:161
+#: setup/setup.glade:167
msgid "Display total number of candidates"
msgstr "Gesamtzahl der Kandidaten anzeigen"
-#: setup/setup.glade:186
+#: setup/setup.glade:192
msgid "Minimum number of chars for completion:"
msgstr "Mindestanzahl Zeichen f��r Vervollst��ndigung"
-#: setup/setup.glade:219
+#: setup/setup.glade:225
msgid "Input Method Help"
msgstr "Hilfe f��r Eingabemethode:"
-#: setup/setup.glade:258
+#: setup/setup.glade:239
+msgid "Use digits as select keys"
+msgstr "Ziffern als Selektionstasten benutzen"
+
+#: setup/setup.glade:282
msgid "Options"
msgstr "Optionen"
-#: setup/setup.glade:291
+#: setup/setup.glade:315
msgid "Install dictionary"
msgstr "Installiere W��rterbuch"
-#: setup/setup.glade:305
+#: setup/setup.glade:329
msgid "Install pyhunspell"
msgstr "pyhunspell installieren"
-#: setup/setup.glade:321
+#: setup/setup.glade:345
msgid "Learn from text file"
msgstr "Aus Textdatei lernen"
-#: setup/setup.glade:340
+#: setup/setup.glade:363
msgid "Install the dictionary package for this engine"
msgstr "Installiere das W��rterbuchpaket f��r diesen Engine"
-#: setup/setup.glade:350
+#: setup/setup.glade:373
msgid "Install pyhunspell package to get spellchecking suggestions"
msgstr ""
"Das pyhunspell Paket installieren um Tippfehlerkorrekturvorschl��ge zu "
"bekommen"
-#: setup/setup.glade:364
+#: setup/setup.glade:387
msgid "Learn your style by reading a text file"
msgstr "Ihren Stil aus einer Textdatei lernen"
-#: setup/setup.glade:378
+#: setup/setup.glade:401
msgid ""
"Delete all personal language data learned from typing or from reading files"
msgstr ""
"Alle Daten l��schen, die aus den Benutzereingaben oder aus Dateien gelernt "
"wurden"
-#: setup/setup.glade:389
+#: setup/setup.glade:413
msgid "Delete learned data"
msgstr "Gelernte Daten l��schen"
-#: setup/setup.glade:426
+#: setup/setup.glade:450
msgid "Dictionaries and personal data"
msgstr "W��rterb��cher und pers��nliche Daten"
diff --git a/ibus-typing-booster/po/ibus-typing-booster.pot b/ibus-typing-booster/po/ibus-typing-booster.pot
index 2147297..cbfcb25 100644
--- a/ibus-typing-booster/po/ibus-typing-booster.pot
+++ b/ibus-typing-booster/po/ibus-typing-booster.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
-"POT-Creation-Date: 2015-11-02 14:16+0900\n"
+"POT-Creation-Date: 2015-12-15 23:37+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL(a)li.org>\n"
@@ -26,16 +26,16 @@ msgstr ""
msgid "Configure ibus-typing-booster ���%(name)s���"
msgstr ""
-#: setup/main.py:103
+#: setup/main.py:101
#, python-format
msgid "Unknown format of engine name: IBUS_ENGINE_NAME=%(name)s"
msgstr ""
-#: setup/main.py:108
+#: setup/main.py:107
msgid "IBUS_ENGINE_NAME environment variable is not set."
msgstr ""
-#: setup/main.py:112
+#: setup/main.py:111
msgid ""
"Cannot determine the config file for this engine. Please use the --config-"
"file option."
@@ -55,99 +55,103 @@ msgstr ""
msgid "Preferences for ibus-typing-booster \"%(symbol)s\""
msgstr ""
-#: setup/main.py:262
+#: setup/main.py:273
msgid "Another instance of this app is already running."
msgstr ""
-#: setup/main.py:357
+#: setup/main.py:368
msgid "Open File ..."
msgstr ""
-#: setup/main.py:375
+#: setup/main.py:386
#, python-format
msgid "Learned successfully from file %(filename)s."
msgstr ""
-#: setup/main.py:384
+#: setup/main.py:395
#, python-format
msgid "Learning from file %(filename)s failed."
msgstr ""
-#: setup/main.py:393
+#: setup/main.py:404
msgid "Are you sure?"
msgstr ""
-#: setup/main.py:400
+#: setup/main.py:411
msgid ""
"Do you really want to delete all language \n"
"data learned from typing or reading files?"
msgstr ""
-#: setup/setup.glade:29
+#: setup/setup.glade:35
msgid "Close"
msgstr ""
-#: setup/setup.glade:77
+#: setup/setup.glade:83
msgid "Enable suggestions by Tab key"
msgstr ""
-#: setup/setup.glade:101
+#: setup/setup.glade:106
msgid "Candidate window page size:"
msgstr ""
-#: setup/setup.glade:137
+#: setup/setup.glade:142
msgid "Input Method:"
msgstr ""
-#: setup/setup.glade:161
+#: setup/setup.glade:167
msgid "Display total number of candidates"
msgstr ""
-#: setup/setup.glade:186
+#: setup/setup.glade:192
msgid "Minimum number of chars for completion:"
msgstr ""
-#: setup/setup.glade:219
+#: setup/setup.glade:225
msgid "Input Method Help"
msgstr ""
-#: setup/setup.glade:258
+#: setup/setup.glade:239
+msgid "Use digits as select keys"
+msgstr ""
+
+#: setup/setup.glade:282
msgid "Options"
msgstr ""
-#: setup/setup.glade:291
+#: setup/setup.glade:315
msgid "Install dictionary"
msgstr ""
-#: setup/setup.glade:305
+#: setup/setup.glade:329
msgid "Install pyhunspell"
msgstr ""
-#: setup/setup.glade:321
+#: setup/setup.glade:345
msgid "Learn from text file"
msgstr ""
-#: setup/setup.glade:340
+#: setup/setup.glade:363
msgid "Install the dictionary package for this engine"
msgstr ""
-#: setup/setup.glade:350
+#: setup/setup.glade:373
msgid "Install pyhunspell package to get spellchecking suggestions"
msgstr ""
-#: setup/setup.glade:364
+#: setup/setup.glade:387
msgid "Learn your style by reading a text file"
msgstr ""
-#: setup/setup.glade:378
+#: setup/setup.glade:401
msgid ""
"Delete all personal language data learned from typing or from reading files"
msgstr ""
-#: setup/setup.glade:389
+#: setup/setup.glade:413
msgid "Delete learned data"
msgstr ""
-#: setup/setup.glade:426
+#: setup/setup.glade:450
msgid "Dictionaries and personal data"
msgstr ""
8 years, 5 months