diff options
author | Hideaki ABE <abe.sendai@gmail.com> | 2009-06-02 11:11:37 +0900 |
---|---|---|
committer | Hideaki ABE <abe.sendai@gmail.com> | 2009-06-02 11:11:37 +0900 |
commit | 0afbf6500ca414ed4a2242fcf7607a1f8d840f97 (patch) | |
tree | 7bff1dd5cf0f001f02a80602426a9a4b41761bae | |
parent | b08c6836a6a46f87d42717d654a7d3c56a937c97 (diff) | |
parent | 9a2b0369493ce74f2529633e4d0baefbee81215c (diff) | |
download | ibus-anthy-0afbf6500ca414ed4a2242fcf7607a1f8d840f97.tar.gz |
Merge branch 'test' into setup_ui_new
-rw-r--r-- | engine/engine.py | 18 | ||||
-rw-r--r-- | engine/jastring.py | 2 | ||||
-rw-r--r-- | engine/segment.py | 7 | ||||
-rw-r--r-- | engine/tables.py | 18 |
4 files changed, 20 insertions, 25 deletions
diff --git a/engine/engine.py b/engine/engine.py index aaf6531..6ccbabf 100644 --- a/engine/engine.py +++ b/engine/engine.py @@ -29,6 +29,7 @@ from tables import * from ibus import keysyms from ibus import modifier import jastring +from segment import unichar_half_to_full sys.path.append(path.join(os.getenv('IBUS_ANTHY_PKGDATADIR'), 'setup')) from anthyprefs import AnthyPrefs @@ -829,18 +830,7 @@ class Engine(ibus.EngineBase): elif mode == 2: if self.__convert_mode == CONV_MODE_HALF_WIDTH_KATAKANA: return True - if self.__convert_mode == CONV_MODE_HIRAGANA or \ - self.__convert_mode == CONV_MODE_KATAKANA or \ - self.__convert_mode == CONV_MODE_OFF or \ - self.__convert_mode == CONV_MODE_ANTHY: - self.__convert_mode = CONV_MODE_HALF_WIDTH_KATAKANA - else: - if CONV_MODE_LATIN_0 <= self.__convert_mode <= CONV_MODE_LATIN_3: - self.__convert_mode += 1 - if self.__convert_mode > CONV_MODE_LATIN_3: - self.__convert_mode = CONV_MODE_LATIN_1 - else: - self.__convert_mode = CONV_MODE_LATIN_0 + self.__convert_mode = CONV_MODE_HALF_WIDTH_KATAKANA elif mode == 3: if CONV_MODE_WIDE_LATIN_0 <= self.__convert_mode <= CONV_MODE_WIDE_LATIN_3: self.__convert_mode += 1 @@ -874,7 +864,7 @@ class Engine(ibus.EngineBase): char = unichr(keyval) wide_char = None#symbol_rule.get(char, None) if wide_char == None: - wide_char = ibus.unichar_half_to_full(char) + wide_char = unichar_half_to_full(char) self.__commit_string(wide_char) return True @@ -1079,7 +1069,7 @@ class Engine(ibus.EngineBase): char = unichr(keysyms.space) wide_char = symbol_rule.get(char, None) if wide_char == None: - wide_char = ibus.unichar_half_to_full(char) + wide_char = unichar_half_to_full(char) self.__commit_string(wide_char) return True diff --git a/engine/jastring.py b/engine/jastring.py index c9cd734..f913d0d 100644 --- a/engine/jastring.py +++ b/engine/jastring.py @@ -22,7 +22,7 @@ import romaji import kana -from ibus import unichar_half_to_full +from segment import unichar_half_to_full SymbolTable = {} for i in range(32, 127): diff --git a/engine/segment.py b/engine/segment.py index 7d968fe..a91607a 100644 --- a/engine/segment.py +++ b/engine/segment.py @@ -19,9 +19,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from ibus import unichar_half_to_full +#from ibus import unichar_half_to_full +from ibus import unichar_half_to_full as h_to_f from tables import * +def unichar_half_to_full(c): + tdl = {'"': u'\u201d', "'": u'\u2019', '`': u'\u2018'} + return tdl[c] if c in tdl else h_to_f(c) + class Segment(object): def __init__(self, enchars=u"", jachars=u""): self._enchars = enchars diff --git a/engine/tables.py b/engine/tables.py index dcccf69..107a4e9 100644 --- a/engine/tables.py +++ b/engine/tables.py @@ -237,21 +237,21 @@ symbol_rule = { u"," : u"、", u"." : u"。", u"!" : u"!", - u"\"" : u""", + u"\"" : u"\u201d", u"#" : u"#", u"$" : u"$", u"%" : u"%", u"&" : u"&", - u"'" : u"'", + u"'" : u"\u2019", u"(" : u"(", u")" : u")", - u"~" : u"~", - u"-" : u"-", + u"~" : u"\uff5e", + u"-" : u"ー", u"=" : u"=", u"^" : u"^", u"\\" : u"\", u"|" : u"|", - u"`" : u"`", + u"`" : u"\u2018", u"@" : u"@", u"{" : u"{", u"[" : u"「", @@ -584,20 +584,20 @@ hiragana_katakana_table = { u"、" : (u"、", u"、"), u"。" : (u"。", u"。"), u"!" : (u"!", u"!"), - u""" : (u""", u"\""), + u"\u201d" : (u"\u201d", u"\""), u"#" : (u"#", u"#"), u"$" : (u"$", u"$"), u"%" : (u"%", u"%"), u"&" : (u"&", u"&"), - u"'" : (u"'", u"'"), + u"\u2019" : (u"\u2019", u"'"), u"(" : (u"(", u"("), u")" : (u")", u")"), - u"~" : (u"~", u"~"), + u"\uff5e" : (u"\uff5e", u"~"), u"=" : (u"=", u"="), u"^" : (u"^", u"^"), u"\" : (u"\", u"\\"), u"|" : (u"|", u"|"), - u"`" : (u"`", u"`"), + u"\u2018" : (u"\u2018", u"`"), u"@" : (u"@", u"@"), u"{" : (u"{", u"{"), u"「" : (u"「", u"「"), |