summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2009-05-30 15:04:46 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2009-05-30 15:04:46 +0800
commitb8113559288c08e2f279bccf4e1eadb35a95e8b9 (patch)
treea9e349d879df556aa036f3b6c58b8c4f2e80339a
parentba22c5983d2d7987db530f99ed7db65338d1b877 (diff)
downloadibus-anthy-b8113559288c08e2f279bccf4e1eadb35a95e8b9.tar.gz
apply patch from Hideaki ABE.
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac2
-rw-r--r--engine/engine.py546
-rw-r--r--engine/factory.py27
-rw-r--r--engine/ibus-engine-anthy.in2
-rw-r--r--engine/jastring.py52
-rw-r--r--engine/tables.py53
-rw-r--r--ibus-anthy.spec.in1
-rw-r--r--po/POTFILES.in2
-rw-r--r--po/fr.po209
-rw-r--r--po/ja.po224
-rw-r--r--po/zh_CN.po208
-rw-r--r--setup/Makefile.am45
-rw-r--r--setup/anthyprefs.py188
-rw-r--r--setup/ibus-setup-anthy.in23
-rw-r--r--setup/main.py213
-rw-r--r--setup/prefs.py99
-rw-r--r--setup/setup.glade987
18 files changed, 2791 insertions, 91 deletions
diff --git a/Makefile.am b/Makefile.am
index 376fb50..9134d0a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,6 +20,7 @@
SUBDIRS = \
engine \
+ setup \
icons \
m4 \
po \
diff --git a/configure.ac b/configure.ac
index 8b57163..eb9d978 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,6 +98,8 @@ ibus-anthy.spec
engine/Makefile
engine/ibus-engine-anthy
engine/anthy.xml.in
+setup/Makefile
+setup/ibus-setup-anthy
icons/Makefile
m4/Makefile
])
diff --git a/engine/engine.py b/engine/engine.py
index de87b74..5ec772f 100644
--- a/engine/engine.py
+++ b/engine/engine.py
@@ -19,6 +19,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+import os
+from os import path
import sys
import gobject
import ibus
@@ -28,6 +30,9 @@ from ibus import keysyms
from ibus import modifier
import jastring
+sys.path.append(path.join(os.getenv('IBUS_ANTHY_PKGDATADIR'), 'setup'))
+from anthyprefs import AnthyPrefs
+
from gettext import dgettext
_ = lambda a : dgettext("ibus-anthy", a)
N_ = lambda a : a
@@ -43,15 +48,34 @@ CONV_MODE_ANTHY, \
CONV_MODE_HIRAGANA, \
CONV_MODE_KATAKANA, \
CONV_MODE_HALF_WIDTH_KATAKANA, \
+CONV_MODE_LATIN_0, \
CONV_MODE_LATIN_1, \
CONV_MODE_LATIN_2, \
CONV_MODE_LATIN_3, \
+CONV_MODE_WIDE_LATIN_0, \
CONV_MODE_WIDE_LATIN_1, \
CONV_MODE_WIDE_LATIN_2, \
-CONV_MODE_WIDE_LATIN_3 = range(11)
+CONV_MODE_WIDE_LATIN_3 = range(13)
+
+KP_Table = {}
+for k, v in zip(['KP_Add', 'KP_Decimal', 'KP_Divide', 'KP_Enter', 'KP_Equal',
+ 'KP_Multiply', 'KP_Separator', 'KP_Space', 'KP_Subtract'],
+ ['plus', 'period', 'slash', 'Return', 'equal',
+ 'asterisk', 'comma', 'space', 'minus']):
+ KP_Table[keysyms.__getattribute__(k)] = keysyms.__getattribute__(v)
+for s in dir(keysyms):
+ if s.startswith('KP_'):
+ v = keysyms.name_to_keycode(s[3:])
+ if v:
+ KP_Table[keysyms.name_to_keycode(s)] = v
class Engine(ibus.EngineBase):
__typing_mode = jastring.TYPING_MODE_ROMAJI
+
+ __setup_pid = 0
+ __prefs = None
+ __keybind = {}
+
def __init__(self, bus, object_path):
super(Engine, self).__init__(bus, object_path)
@@ -63,9 +87,20 @@ class Engine(ibus.EngineBase):
self.__input_mode = INPUT_MODE_HIRAGANA
self.__prop_dict = {}
- self.__lookup_table = ibus.LookupTable(page_size=9, round=True)
+# self.__lookup_table = ibus.LookupTable(page_size=9, round=True)
+ size = self.__prefs.get_value('common', 'page_size')
+ self.__lookup_table = ibus.LookupTable(page_size=size, round=True)
self.__prop_list = self.__init_props()
+ mode = self.__prefs.get_value('common', 'input_mode')
+ mode = 'InputMode.' + ['Hiragana', 'Katakana', 'HalfWidthKatakana',
+ 'Latin', 'WideLatin'][mode]
+ self.__input_mode_activate(mode, ibus.PROP_STATE_CHECKED)
+
+ mode = self.__prefs.get_value('common', 'typing_method')
+ mode = 'TypingMode.' + ['Romaji', 'Kana'][mode]
+ self.__input_mode_activate(mode, ibus.PROP_STATE_CHECKED)
+
# use reset to init values
self.__reset()
@@ -140,6 +175,9 @@ class Engine(ibus.EngineBase):
typing_mode_prop.set_sub_props(props)
anthy_props.append(typing_mode_prop)
+ anthy_props.append(ibus.Property(key=u"setup",
+ tooltip=_(u"Configure Anthy")))
+
return anthy_props
def update_preedit(self, string, attrs, cursor_pos, visible):
@@ -225,7 +263,8 @@ class Engine(ibus.EngineBase):
def process_key_event(self, keyval, state):
try:
- return self.process_key_event_internal(keyval, state)
+# return self.process_key_event_internal(keyval, state)
+ return self.process_key_event_internal2(keyval, state)
except:
import traceback
traceback.print_exc()
@@ -234,8 +273,8 @@ class Engine(ibus.EngineBase):
def process_key_event_internal(self, keyval, state):
is_press = (state & modifier.RELEASE_MASK) == 0
- state = state & (modifier.SHIFT_MASK | \
- modifier.CONTROL_MASK | \
+ state = state & (modifier.SHIFT_MASK |
+ modifier.CONTROL_MASK |
modifier.MOD1_MASK)
# ignore key release events
@@ -308,7 +347,10 @@ class Engine(ibus.EngineBase):
if self.__typing_mode_activate(prop_name, state):
return
else:
- self.__prop_dict[prop_name].set_state(state)
+ if prop_name == 'setup':
+ self.__start_setup()
+ else:
+ self.__prop_dict[prop_name].set_state(state)
def __input_mode_activate(self, prop_name, state):
if not prop_name.startswith(u"InputMode."):
@@ -381,11 +423,16 @@ class Engine(ibus.EngineBase):
def focus_in(self):
self.register_properties(self.__prop_list)
self.__refresh_typing_mode_property()
- self.__reset()
- self.__invalidate()
+# self.__reset()
+# self.__invalidate()
def focus_out(self):
- pass
+ mode = self.__prefs.get_value('common', 'behivior_on_focus_out')
+ if mode == 0:
+ self.__reset()
+ self.__invalidate()
+ elif mode == 1:
+ self.__on_key_return()
# begine convert
def __begin_anthy_convert(self):
@@ -393,9 +440,8 @@ class Engine(ibus.EngineBase):
return
self.__convert_mode = CONV_MODE_ANTHY
- self.__preedit_ja_string.insert(u"\0")
-
- text, cursor = self.__preedit_ja_string.get_hiragana()
+# text, cursor = self.__preedit_ja_string.get_hiragana()
+ text, cursor = self.__preedit_ja_string.get_hiragana(True)
self.__context.set_string(text.encode("utf8"))
conv_stat = anthy.anthy_conv_stat()
@@ -443,13 +489,17 @@ class Engine(ibus.EngineBase):
self.__need_update = True
gobject.idle_add(self.__update, priority = gobject.PRIORITY_LOW)
- def __get_preedit(self):
+# def __get_preedit(self):
+ def __get_preedit(self, commit=False):
if self.__input_mode == INPUT_MODE_HIRAGANA:
- text, cursor = self.__preedit_ja_string.get_hiragana()
+# text, cursor = self.__preedit_ja_string.get_hiragana()
+ text, cursor = self.__preedit_ja_string.get_hiragana(commit)
elif self.__input_mode == INPUT_MODE_KATAKANA:
- text, cursor = self.__preedit_ja_string.get_katakana()
+# text, cursor = self.__preedit_ja_string.get_katakana()
+ text, cursor = self.__preedit_ja_string.get_katakana(commit)
elif self.__input_mode == INPUT_MODE_HALF_WIDTH_KATAKANA:
- text, cursor = self.__preedit_ja_string.get_half_width_katakana()
+# text, cursor = self.__preedit_ja_string.get_half_width_katakana()
+ text, cursor = self.__preedit_ja_string.get_half_width_katakana(commit)
else:
text, cursor = u"", 0
return text, cursor
@@ -472,11 +522,18 @@ class Engine(ibus.EngineBase):
self.__update_anthy_convert_chars()
return
if self.__convert_mode == CONV_MODE_HIRAGANA:
- text, cursor = self.__preedit_ja_string.get_hiragana()
+# text, cursor = self.__preedit_ja_string.get_hiragana()
+ text, cursor = self.__preedit_ja_string.get_hiragana(True)
elif self.__convert_mode == CONV_MODE_KATAKANA:
- text, cursor = self.__preedit_ja_string.get_katakana()
+# text, cursor = self.__preedit_ja_string.get_katakana()
+ text, cursor = self.__preedit_ja_string.get_katakana(True)
elif self.__convert_mode == CONV_MODE_HALF_WIDTH_KATAKANA:
- text, cursor = self.__preedit_ja_string.get_half_width_katakana()
+# text, cursor = self.__preedit_ja_string.get_half_width_katakana()
+ text, cursor = self.__preedit_ja_string.get_half_width_katakana(True)
+ elif self.__convert_mode == CONV_MODE_LATIN_0:
+ text, cursor = self.__preedit_ja_string.get_latin()
+ if text == text.lower():
+ self.__convert_mode = CONV_MODE_LATIN_1
elif self.__convert_mode == CONV_MODE_LATIN_1:
text, cursor = self.__preedit_ja_string.get_latin()
text = text.lower()
@@ -486,6 +543,10 @@ class Engine(ibus.EngineBase):
elif self.__convert_mode == CONV_MODE_LATIN_3:
text, cursor = self.__preedit_ja_string.get_latin()
text = text.capitalize()
+ elif self.__convert_mode == CONV_MODE_WIDE_LATIN_0:
+ text, cursor = self.__preedit_ja_string.get_wide_latin()
+ if text == text.lower():
+ self.__convert_mode = CONV_MODE_WIDE_LATIN_1
elif self.__convert_mode == CONV_MODE_WIDE_LATIN_1:
text, cursor = self.__preedit_ja_string.get_wide_latin()
text = text.lower()
@@ -545,7 +606,8 @@ class Engine(ibus.EngineBase):
return False
if self.__convert_mode == CONV_MODE_OFF:
- text, cursor = self.__get_preedit()
+# text, cursor = self.__get_preedit()
+ text, cursor = self.__get_preedit(True)
self.__commit_string(text)
elif self.__convert_mode == CONV_MODE_ANTHY:
i = 0
@@ -638,8 +700,8 @@ class Engine(ibus.EngineBase):
self.cursor_down()
return True
- def __on_key_space(self):
- if self.__input_mode == INPUT_MODE_WIDE_LATIN:
+ def __on_key_space(self, wide=False):
+ if self.__input_mode == INPUT_MODE_WIDE_LATIN or wide:
# Input Wide space U+3000
wide_char = symbol_rule[unichr(keysyms.space)]
self.__commit_string(wide_char)
@@ -740,7 +802,7 @@ class Engine(ibus.EngineBase):
return False
if keyval == keysyms._0:
- return True
+ keyval = keysyms._9 + 1
index = keyval - keysyms._1
candidates = self.__lookup_table.get_candidates_in_current_page()
@@ -773,19 +835,26 @@ class Engine(ibus.EngineBase):
self.__convert_mode == CONV_MODE_ANTHY:
self.__convert_mode = CONV_MODE_HALF_WIDTH_KATAKANA
else:
- if self.__convert_mode >= CONV_MODE_LATIN_1 and self.__convert_mode <= CONV_MODE_LATIN_3:
+ 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_1
+ self.__convert_mode = CONV_MODE_LATIN_0
elif mode == 3:
- if self.__convert_mode >= CONV_MODE_WIDE_LATIN_1 and self.__convert_mode <= CONV_MODE_WIDE_LATIN_3:
+ if CONV_MODE_WIDE_LATIN_0 <= self.__convert_mode <= CONV_MODE_WIDE_LATIN_3:
self.__convert_mode += 1
if self.__convert_mode > CONV_MODE_WIDE_LATIN_3:
self.__convert_mode = CONV_MODE_WIDE_LATIN_1
else:
- self.__convert_mode = CONV_MODE_WIDE_LATIN_1
+ self.__convert_mode = CONV_MODE_WIDE_LATIN_0
+ elif mode == 4:
+ 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
else:
print >> sys.stderr, "Unkown convert mode (%d)!" % mode
return False
@@ -803,7 +872,7 @@ class Engine(ibus.EngineBase):
elif self.__input_mode == INPUT_MODE_WIDE_LATIN:
# Input Wide Latin chars
char = unichr(keyval)
- wide_char = symbol_rule.get(char, None)
+ wide_char = None#symbol_rule.get(char, None)
if wide_char == None:
wide_char = ibus.unichar_half_to_full(char)
self.__commit_string(wide_char)
@@ -822,3 +891,424 @@ class Engine(ibus.EngineBase):
self.__invalidate()
return True
+#=======================================================================
+ @classmethod
+ def CONFIG_RELOADED(cls, bus):
+ print 'RELOADED'
+ if not cls.__prefs:
+ cls.__prefs = AnthyPrefs(bus)
+
+ keybind = {}
+ for k in cls.__prefs.keys('shortcut/default'):
+ cmd = '_Engine__cmd_' + k
+ for s in cls.__prefs.get_value('shortcut/default', k):
+ keybind.setdefault(cls._s_to_key(s), []).append(cmd)
+ cls.__keybind = keybind
+
+ jastring.JaString._prefs = cls.__prefs
+
+ @classmethod
+ def CONFIG_VALUE_CHANGED(cls, bus, section, name, value):
+ print 'VALUE_CHAMGED =', section, name, value
+ section = section[len(cls.__prefs._prefix) + 1:]
+ if section.startswith('shortcut/'):
+ cmd = '_Engine__cmd_' + name
+ old = cls.__prefs.get_value('shortcut/default', name)
+ value = value if value != [''] else []
+ for s in set(old).difference(value):
+ cls.__keybind.get(cls._s_to_key(s), []).remove(cmd)
+
+ keys = cls.__prefs.keys('shortcut/default')
+ for s in set(value).difference(old):
+ cls.__keybind.setdefault(cls._s_to_key(s), []).append(cmd)
+ cls.__keybind.get(cls._s_to_key(s)).sort(
+ lambda a, b: cmp(keys.index(a[13:]), keys.index(b[13:])))
+
+ cls.__prefs.set_value('shortcut/default', name, value)
+ elif section == 'common':
+ cls.__prefs.set_value(section, name, value)
+
+ @classmethod
+ def _s_to_key(cls, s):
+ keyval = keysyms.name_to_keycode(s.split('+')[-1])
+ s = s.lower()
+ state = ('shift+' in s and modifier.SHIFT_MASK or 0) | (
+ 'ctrl+' in s and modifier.CONTROL_MASK or 0) | (
+ 'alt+' in s and modifier.MOD1_MASK or 0)
+ return cls._mk_key(keyval, state)
+
+ @staticmethod
+ def _mk_key(keyval, state):
+ if state & (modifier.CONTROL_MASK | modifier.MOD1_MASK):
+ if unichr(keyval) in u'!"#$%^\'()*+,-./:;<=>?@[\]^_`{|}~':
+ state |= modifier.SHIFT_MASK
+ elif keysyms.a <= keyval <= keysyms.z:
+ keyval -= (keysyms.a - keysyms.A)
+
+ return repr([int(state), int(keyval)])
+
+ def process_key_event_internal2(self, keyval, state):
+
+ is_press = (state & modifier.RELEASE_MASK) == 0
+
+ state = state & (modifier.SHIFT_MASK |
+ modifier.CONTROL_MASK |
+ modifier.MOD1_MASK)
+
+ # ignore key release events
+ if not is_press:
+ return False
+
+ if keyval in KP_Table and self.__prefs.get_value('common',
+ 'ten_key_mode'):
+ keyval = KP_Table[keyval]
+
+ key = self._mk_key(keyval, state)
+ for cmd in self.__keybind.get(key, []):
+ print 'cmd =', cmd
+ try:
+ if getattr(self, cmd)(keyval, state):
+ return True
+ except:
+ print >> sys.stderr, 'Unknow command = %s' % cmd
+
+ if state & (modifier.CONTROL_MASK | modifier.MOD1_MASK):
+ return False
+
+ if (keysyms.exclam <= keyval <= keysyms.asciitilde or
+ keyval == keysyms.yen):
+ ret = self.__on_key_common(keyval)
+ if (unichr(keyval) in u',.' and
+ self.__prefs.get_value('common', 'behivior_on_period')):
+ return self.__cmd_convert(keyval, state)
+ return ret
+ else:
+ if not self.__preedit_ja_string.is_empty():
+ return True
+ return False
+
+ #mode_keys
+ def __set_input_mode(self, mode):
+ if not self.__preedit_ja_string.is_empty():
+ return False
+
+ self.__input_mode_activate(mode, ibus.PROP_STATE_CHECKED)
+
+ return True
+
+ def __cmd_on_off(self, keyval, state):
+ if self.__input_mode == INPUT_MODE_LATIN:
+ return self.__set_input_mode(u'InputMode.Hiragana')
+ else:
+ return self.__set_input_mode(u'InputMode.Latin')
+
+ def __cmd_circle_input_mode(self, keyval, state):
+ modes = {
+ INPUT_MODE_HIRAGANA: u"InputMode.Katakana",
+ INPUT_MODE_KATAKANA: u"InputMode.HalfWidthKatakana",
+ INPUT_MODE_HALF_WIDTH_KATAKANA: u"InputMode.Latin",
+ INPUT_MODE_LATIN: u"InputMode.WideLatin",
+ INPUT_MODE_WIDE_LATIN: u"InputMode.Hiragana"
+ }
+ return self.__set_input_mode(modes[self.__input_mode])
+
+ def __cmd_circle_kana_mode(self, keyval, state):
+ modes = {
+ INPUT_MODE_HIRAGANA: u"InputMode.Katakana",
+ INPUT_MODE_KATAKANA: u"InputMode.HalfWidthKatakana",
+ INPUT_MODE_HALF_WIDTH_KATAKANA: u"InputMode.Hiragana",
+ INPUT_MODE_LATIN: u"InputMode.Hiragana",
+ INPUT_MODE_WIDE_LATIN: u"InputMode.Hiragana"
+ }
+ return self.__set_input_mode(modes[self.__input_mode])
+
+ def __cmd_latin_mode(self, keyval, state):
+ return self.__set_input_mode(u'InputMode.Latin')
+
+ def __cmd_wide_latin_mode(self, keyval, state):
+ return self.__set_input_mode(u'InputMode.WideLatin')
+
+ def __cmd_hiragana_mode(self, keyval, state):
+ return self.__set_input_mode(u'InputMode.Hiragana')
+
+ def __cmd_katakana_mode(self, keyval, state):
+ return self.__set_input_mode(u'InputMode.Katakana')
+
+ def __cmd_half_katakana(self, keyval, state):
+ return self.__set_input_mode(u'InputMode.HalfWidthKatakana')
+
+ def __cmd_cancel_pseudo_ascii_mode_key(self, keyval, state):
+ pass
+
+ def __cmd_circle_typing_method(self, keyval, state):
+ if not self.__preedit_ja_string.is_empty():
+ return False
+
+ modes = {
+ jastring.TYPING_MODE_KANA: u"TypingMode.Romaji",
+ jastring.TYPING_MODE_ROMAJI: u"TypingMode.Kana",
+ }
+ self.__typing_mode_activate(modes[self.__typing_mode],
+ ibus.PROP_STATE_CHECKED)
+ return True
+
+ #edit_keys
+ def __cmd_insert_space(self, keyval, state):
+ if self.__input_mode in [INPUT_MODE_LATIN,
+ INPUT_MODE_HALF_WIDTH_KATAKANA]:
+ return self.__cmd_insert_half_space(keyval, state)
+ else:
+ return self.__cmd_insert_wide_space(keyval, state)
+
+ def __cmd_insert_alternate_space(self, keyval, state):
+ if not self.__input_mode in [INPUT_MODE_LATIN,
+ INPUT_MODE_HALF_WIDTH_KATAKANA]:
+ return self.__cmd_insert_half_space(keyval, state)
+ else:
+ return self.__cmd_insert_wide_space(keyval, state)
+
+ def __cmd_insert_half_space(self, keyval, state):
+ if not self.__preedit_ja_string.is_empty():
+ return False
+ self.__commit_string(unichr(keysyms.space))
+ return True
+
+ def __cmd_insert_wide_space(self, keyval, state):
+ if not self.__preedit_ja_string.is_empty():
+ return False
+ char = unichr(keysyms.space)
+ wide_char = symbol_rule.get(char, None)
+ if wide_char == None:
+ wide_char = ibus.unichar_half_to_full(char)
+ self.__commit_string(wide_char)
+ return True
+
+ def __cmd_backspace(self, keyval, state):
+ return self.__on_key_back_space()
+
+ def __cmd_delete(self, keyval, state):
+ return self.__on_key_delete()
+
+ def __cmd_commit(self, keyval, state):
+ return self.__on_key_return()
+
+ def __cmd_convert(self, keyval, state):
+ if self.__preedit_ja_string.is_empty() or \
+ self.__input_mode != INPUT_MODE_HIRAGANA:
+ return False
+ if self.__convert_mode != CONV_MODE_ANTHY:
+ self.__begin_anthy_convert()
+ self.__invalidate()
+ elif self.__convert_mode == CONV_MODE_ANTHY:
+ self.__lookup_table_visible = True
+ self.cursor_down()
+ return True
+
+ def __cmd_predict(self, keyval, state):
+ pass
+
+ def __cmd_cancel(self, keyval, state):
+ if not self.__preedit_ja_string.is_empty() and \
+ self.__convert_mode == CONV_MODE_OFF:
+ return self.__on_key_escape()
+ return False
+
+ def __cmd_cancel_all(self, keyval, state):
+ return self.__cmd_cancel(keyval, state)
+
+ def __cmd_reconvert(self, keyval, state):
+ pass
+
+ def __cmd_do_nothing(self, keyval, state):
+ return True
+
+ #caret_keys
+ def __move_caret(self, i):
+ if self.__lookup_table_visible:
+ return False
+
+ if self.__preedit_ja_string.is_empty():
+ return False
+
+ if self.__convert_mode == CONV_MODE_OFF:
+ self.__preedit_ja_string.move_cursor(
+ -len(self.__preedit_ja_string.get_latin()[0]) if i == 0 else
+ i if i in [-1, 1] else
+ len(self.__preedit_ja_string.get_latin()[0]))
+ self.__invalidate()
+ return True
+
+ return False
+
+ def __cmd_move_caret_first(self, keyval, state):
+ return self.__move_caret(0)
+
+ def __cmd_move_caret_last(self, keyval, state):
+ return self.__move_caret(2)
+
+ def __cmd_move_caret_forward(self, keyval, state):
+ return self.__move_caret(1)
+
+ def __cmd_move_caret_backward(self, keyval, state):
+ return self.__move_caret(-1)
+
+ #segments_keys
+ def __select_segment(self, i):
+ if self.__preedit_ja_string.is_empty():
+ return False
+
+ if self.__convert_mode == CONV_MODE_OFF:
+ return False
+ elif self.__convert_mode != CONV_MODE_ANTHY:
+ return True
+
+ pos = 0 if i == 0 else \
+ self.__cursor_pos + i if i in [-1, 1] else \
+ len(self.__segments) - 1
+
+ if 0 <= pos < len(self.__segments) and pos != self.__cursor_pos:
+ self.__cursor_pos = pos
+ self.__lookup_table_visible = False
+ self.__fill_lookup_table()
+ self.__invalidate()
+
+ return True
+
+ def __cmd_select_first_segment(self, keyval, state):
+ if self.__lookup_table_visible:
+ return False
+
+ return self.__select_segment(0)
+
+ def __cmd_select_last_segment(self, keyval, state):
+ if self.__lookup_table_visible:
+ return False
+
+ return self.__select_segment(2)
+
+ def __cmd_select_next_segment(self, keyval, state):
+ return self.__select_segment(1)
+
+ def __cmd_select_prev_segment(self, keyval, state):
+ return self.__select_segment(-1)
+
+ def __cmd_shrink_segment(self, keyval, state):
+ if self.__convert_mode == CONV_MODE_ANTHY:
+ self.__shrink_segment(-1)
+ return True
+
+ def __cmd_expand_segment(self, keyval, state):
+ if self.__convert_mode == CONV_MODE_ANTHY:
+ self.__shrink_segment(1)
+ return True
+
+ def __cmd_commit_first_segment(self, keyval, state):
+ pass
+
+ def __cmd_commit_selected_segment(self, keyval, state):
+ pass
+
+ #candidates_keys
+ def __select_candidate(self, pos):
+ if not self.__lookup_table_visible:
+ return False
+
+ if not self.__lookup_table.set_cursor_pos_in_current_page(pos):
+ return False
+
+ candidate = self.__lookup_table.get_current_candidate().text
+ index = self.__lookup_table.get_cursor_pos()
+ self.__segments[self.__cursor_pos] = index, candidate
+ self.__invalidate()
+ return True
+
+ def __cmd_select_first_candidate(self, keyval, state):
+ return self.__select_candidate(0)
+
+ def __cmd_select_last_candidate(self, keyval, state):
+ return self.__select_candidate(self.__lookup_table.get_page_size() - 1)
+
+ def __cmd_select_next_candidate(self, keyval, state):
+ return self.__on_key_down()
+
+ def __cmd_select_prev_candidate(self, keyval, state):
+ return self.__on_key_up()
+
+ def __cmd_candidates_page_up(self, keyval, state):
+ return self.__on_key_page_up()
+
+ def __cmd_candidates_page_down(self, keyval, state):
+ return self.__on_key_page_down()
+
+ #direct_select_keys
+ def __cmd_select_candidates_1(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ def __cmd_select_candidates_2(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ def __cmd_select_candidates_3(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ def __cmd_select_candidates_4(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ def __cmd_select_candidates_5(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ def __cmd_select_candidates_6(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ def __cmd_select_candidates_7(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ def __cmd_select_candidates_8(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ def __cmd_select_candidates_9(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ def __cmd_select_candidates_0(self, keyval, state):
+ return self.__on_key_number(keyval)
+
+ #convert_keys
+ def __cmd_convert_to_char_type_forward(self, keyval, state):
+ pass
+
+ def __cmd_convert_to_char_type_backward(self, keyval, state):
+ pass
+
+ def __cmd_convert_to_hiragana(self, keyval, state):
+ return self.__on_key_conv(0)
+
+ def __cmd_convert_to_katakana(self, keyval, state):
+ return self.__on_key_conv(1)
+
+ def __cmd_convert_to_half(self, keyval, state):
+ return self.__on_key_conv(2)
+
+ def __cmd_convert_to_half_katakana(self, keyval, state):
+ return self.__on_key_conv(2)
+
+ def __cmd_convert_to_wide_latin(self, keyval, state):
+ return self.__on_key_conv(3)
+
+ def __cmd_convert_to_latin(self, keyval, state):
+ return self.__on_key_conv(4)
+
+ #dictonary_keys
+ def __cmd_dict_admin(self, keyval, state):
+ pass
+
+ def __cmd_add_word(self, keyval, state):
+ pass
+
+ def __start_setup(self):
+ if Engine.__setup_pid != 0:
+ pid, state = os.waitpid(Engine.__setup_pid, os.P_NOWAIT)
+ if pid != Engine.__setup_pid:
+ return
+ Engine.__setup_pid = 0
+ setup_cmd = path.join(os.getenv('LIBEXECDIR'), "ibus-setup-anthy")
+ Engine.__setup_pid = os.spawnl(os.P_NOWAIT, setup_cmd, "ibus-setup-anthy")
+
diff --git a/engine/factory.py b/engine/factory.py
index d460bde..eee85dc 100644
--- a/engine/factory.py
+++ b/engine/factory.py
@@ -19,32 +19,45 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-import os
-from os import path
import ibus
import engine
+import os
from gettext import dgettext
_ = lambda a : dgettext("ibus-anthy", a)
N_ = lambda a : a
-FACTORY_PATH = "/com/redhat/IBus/engines/Anthy/Factory"
-ENGINE_PATH = "/com/redhat/IBus/engines/Anthy/Engine/"
class EngineFactory(ibus.EngineFactoryBase):
+ FACTORY_PATH = "/com/redhat/IBus/engines/Anthy/Factory"
+ ENGINE_PATH = "/com/redhat/IBus/engines/Anthy/Engine"
NAME = _("Anthy")
LANG = "ja"
- ICON = path.join(os.getenv("IBUS_ANTHY_PKGDATADIR"), "icons/ibus-anthy.png")
+ ICON = os.getenv("IBUS_ANTHY_PKGDATADIR") + "/icons/ibus-anthy.png"
AUTHORS = "Huang Peng <shawn.p.huang@gmail.com>"
CREDITS = "GPLv2"
def __init__(self, bus):
self.__bus = bus
- self.__id = 0
+ engine.Engine.CONFIG_RELOADED(bus)
super(EngineFactory, self).__init__(bus)
+ self.__id = 0
+ self.__config = self.__bus.get_config()
+
+ self.__config.connect("reloaded", self.__config_reloaded_cb)
+ self.__config.connect("value-changed", self.__config_value_changed_cb)
+
def create_engine(self, engine_name):
if engine_name == "anthy":
self.__id += 1
- return engine.Engine(self.__bus, "/org/freedesktop/IBus/Anthy/%d" % self.__id)
+ return engine.Engine(self.__bus, "%s/%d" % (self.ENGINE_PATH, self.__id))
+
return super(EngineFactory, self).create_engine(engine_name)
+
+ def __config_reloaded_cb(self, config):
+ engine.Engine.CONFIG_RELOADED(self.__bus)
+
+ def __config_value_changed_cb(self, config, section, name, value):
+ engine.Engine.CONFIG_VALUE_CHANGED(self.__bus, section, name, value)
+
diff --git a/engine/ibus-engine-anthy.in b/engine/ibus-engine-anthy.in
index 01b0b62..fb7c09a 100644
--- a/engine/ibus-engine-anthy.in
+++ b/engine/ibus-engine-anthy.in
@@ -21,9 +21,11 @@
prefix=@prefix@
datarootdir=@datarootdir@
exec_prefix=@exec_prefix@
+libexecdir=@libexecdir@
pyexecdir=@pyexecdir@
export PYTHONPATH=@pyexecdir@:$PYTHONPATH
export IBUS_PREFIX=@prefix@
export IBUS_ANTHY_PKGDATADIR=@datarootdir@/@PACKAGE@
+export LIBEXECDIR=$libexecdir
exec python @datarootdir@/@PACKAGE@/engine/main.py $@
diff --git a/engine/jastring.py b/engine/jastring.py
index db067ef..c9cd734 100644
--- a/engine/jastring.py
+++ b/engine/jastring.py
@@ -22,6 +22,19 @@
import romaji
import kana
+from ibus import unichar_half_to_full
+
+SymbolTable = {}
+for i in range(32, 127):
+ if not chr(i).isalnum():
+ SymbolTable[unichar_half_to_full(chr(i))] = chr(i)
+
+NumberTable = {}
+for i in range(10):
+ NumberTable[unichar_half_to_full(str(i))] = str(i)
+
+PeriodTable = {u'。': u'.', u'、': u',', u'。': u'.', u'、': u','}
+
TYPING_MODE_ROMAJI, \
TYPING_MODE_KANA, \
TYPING_MODE_THUMB_SHIFT = range(3)
@@ -95,23 +108,38 @@ class JaString:
elif self.__cursor > len(self.__segments):
self.__cursor = len(self.__segments)
- def get_hiragana(self):
+ def _chk_text(self, s):
+ period = self._prefs.get_value('common', 'period_style')
+ symbol = self._prefs.get_value('common', 'half_width_symbol')
+ number = self._prefs.get_value('common', 'half_width_number')
+ ret = ''
+ for c in s:
+ c = c if not period else PeriodTable.get(c, c)
+ c = c if not symbol else SymbolTable.get(c, c)
+ c = c if not number else NumberTable.get(c, c)
+ ret += c
+ return ret
+
+ def get_hiragana(self, commit=False):
conv = lambda s: s.to_hiragana()
- text_before = u"".join(map(conv, self.__segments[:self.__cursor]))
- text_after = u"".join(map(conv, self.__segments[self.__cursor:]))
- return text_before + text_after, len(text_before)
+ R = lambda s: s if not (commit and s[-1:] == u'n') else s[:-1] + u'ん'
+ text_before = R(u"".join(map(conv, self.__segments[:self.__cursor])))
+ text_after = R(u"".join(map(conv, self.__segments[self.__cursor:])))
+ return self._chk_text(text_before + text_after), len(text_before)
- def get_katakana(self):
+ def get_katakana(self, commit=False):
conv = lambda s: s.to_katakana()
- text_before = u"".join(map(conv, self.__segments[:self.__cursor]))
- text_after = u"".join(map(conv, self.__segments[self.__cursor:]))
- return text_before + text_after, len(text_before)
+ R = lambda s: s if not (commit and s[-1:] == u'n') else s[:-1] + u'ン'
+ text_before = R(u"".join(map(conv, self.__segments[:self.__cursor])))
+ text_after = R(u"".join(map(conv, self.__segments[self.__cursor:])))
+ return self._chk_text(text_before + text_after), len(text_before)
- def get_half_width_katakana(self):
+ def get_half_width_katakana(self, commit=False):
conv = lambda s: s.to_half_width_katakana()
- text_before = u"".join(map(conv, self.__segments[:self.__cursor]))
- text_after = u"".join(map(conv, self.__segments[self.__cursor:]))
- return text_before + text_after, len(text_before)
+ R = lambda s: s if not (commit and s[-1:] == u'n') else s[:-1] + u'ン'
+ text_before = R(u"".join(map(conv, self.__segments[:self.__cursor])))
+ text_after = R(u"".join(map(conv, self.__segments[self.__cursor:])))
+ return self._chk_text(text_before + text_after), len(text_before)
def get_latin(self):
conv = lambda s: s.to_latin()
diff --git a/engine/tables.py b/engine/tables.py
index 6a19979..bd77920 100644
--- a/engine/tables.py
+++ b/engine/tables.py
@@ -21,7 +21,7 @@
# string, result, cont
romaji_typing_rule = {
- u"-" : u"ー",
+ u"-" : u"-",
u"a" : u"あ",
u"i" : u"い",
u"u" : u"う",
@@ -188,6 +188,11 @@ romaji_typing_rule = {
u"fu" : u"ふ",
u"fe" : u"ふぇ",
u"fo" : u"ふぉ",
+ u"fya" : u"ふゃ",
+ u"fyi" : u"ふぃ",
+ u"fyu" : u"ふゅ",
+ u"fye" : u"ふぇ",
+ u"fyo" : u"ふょ",
u"ma" : u"ま",
u"mi" : u"み",
u"mu" : u"む",
@@ -232,21 +237,21 @@ symbol_rule = {
u"," : u"、",
u"." : u"。",
u"!" : u"!",
- u"\"" : u"”",
+ u"\"" : u""",
u"#" : u"#",
u"$" : u"$",
u"%" : u"%",
u"&" : u"&",
- u"'" : u"’",
+ u"'" : u"'",
u"(" : u"(",
u")" : u")",
- u"~" : u"〜",
- u"-" : u"ー",
+ u"~" : u"~",
+ u"-" : u"-",
u"=" : u"=",
u"^" : u"^",
u"\\" : u"\",
u"|" : u"|",
- u"`" : u"‘",
+ u"`" : u"`",
u"@" : u"@",
u"{" : u"{",
u"[" : u"「",
@@ -262,6 +267,18 @@ symbol_rule = {
u"/" : u"/",
u"_" : u"_",
u"¥" : u"¥",
+
+ # numbers
+ u'0': u'0',
+ u'1': u'1',
+ u'2': u'2',
+ u'3': u'3',
+ u'4': u'4',
+ u'5': u'5',
+ u'6': u'6',
+ u'7': u'7',
+ u'8': u'8',
+ u'9': u'9',
}
# this is only used with romaji_typing_rule
@@ -308,6 +325,8 @@ romaji_correction_rule = {
u"nx" : (u"ん", u"x"),
u"nz" : (u"ん", u"z"),
u"n\0" : (u"ん", u""),
+ u"n," : (u"ん", u","),
+ u"n." : (u"ん", u"."),
}
# a port of 101kana.sty from scim-anthy
@@ -420,7 +439,7 @@ kana_typing_rule = {
u"?" : u"・",
u"_" : u"ろ",
- u"¥" : u"ー",
+ u"¥" : u"-",
}
kana_voiced_consonant_rule = {
@@ -565,20 +584,20 @@ hiragana_katakana_table = {
u"、" : (u"、", u"、"),
u"。" : (u"。", u"。"),
u"!" : (u"!", u"!"),
- u"”" : (u"”", u"\""),
+ u""" : (u""", u"\""),
u"#" : (u"#", u"#"),
u"$" : (u"$", u"$"),
u"%" : (u"%", u"%"),
u"&" : (u"&", u"&"),
- u"’" : (u"’", u"'"),
+ u"'" : (u"'", u"'"),
u"(" : (u"(", u"("),
u")" : (u")", u")"),
- u"〜" : (u"〜", u"~"),
+ u"~" : (u"~", u"~"),
u"=" : (u"=", u"="),
u"^" : (u"^", u"^"),
u"\" : (u"\", u"\\"),
u"|" : (u"|", u"|"),
- u"‘" : (u"‘", u"`"),
+ u"`" : (u"`", u"`"),
u"@" : (u"@", u"@"),
u"{" : (u"{", u"{"),
u"「" : (u"「", u"「"),
@@ -594,4 +613,16 @@ hiragana_katakana_table = {
u"/" : (u"/", u"/"),
u"_" : (u"_", u"_"),
u"¥" : (u"¥", u"¥"),
+
+ # numbers
+ u'0': (u'0', u'0'),
+ u'1': (u'1', u'1'),
+ u'2': (u'2', u'2'),
+ u'3': (u'3', u'3'),
+ u'4': (u'4', u'4'),
+ u'5': (u'5', u'5'),
+ u'6': (u'6', u'6'),
+ u'7': (u'7', u'7'),
+ u'8': (u'8', u'8'),
+ u'9': (u'9', u'9'),
}
diff --git a/ibus-anthy.spec.in b/ibus-anthy.spec.in
index 233aa55..922e189 100644
--- a/ibus-anthy.spec.in
+++ b/ibus-anthy.spec.in
@@ -50,6 +50,7 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitearch}/anthy.py*
%{python_sitearch}/_anthy.so
%{_libexecdir}/ibus-engine-anthy
+%{_libexecdir}/ibus-setup-anthy
%{_datadir}/@PACKAGE@
%{_datadir}/ibus/component/*
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8b0fdd0..aea6c81 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,3 +3,5 @@
./engine/tables.py
./engine/engine.py
./engine/factory.py
+./setup/main.py
+./setup/setup.glade
diff --git a/po/fr.po b/po/fr.po
index 7db3ac0..4e38f3c 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -8,49 +8,236 @@ msgid ""
msgstr ""
"Project-Id-Version: ibus-anthy VERSION\n"
"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
-"POT-Creation-Date: 2008-09-03 15:11+0800\n"
+"POT-Creation-Date: 2009-05-28 10:22+0900\n"
"PO-Revision-Date: 2009-02-23 03:31+0100\n"
"Last-Translator: Julroy67 <julroy67@gmail.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: engine/engine.py:90
+#: engine/engine.py:125
msgid "Switch input mode"
msgstr "Changer de méthode d'entrée"
-#: engine/engine.py:96
+#: engine/engine.py:131
msgid "Hiragana"
msgstr "Hiragana"
-#: engine/engine.py:99
+#: engine/engine.py:134
msgid "Katakana"
msgstr "Katakana"
-#: engine/engine.py:102
+#: engine/engine.py:137
msgid "Half width katakana"
msgstr ""
-#: engine/engine.py:105
+#: engine/engine.py:140
msgid "Latin"
msgstr "Latin"
-#: engine/engine.py:108
+#: engine/engine.py:143
msgid "Wide Latin"
msgstr "Latin large"
-#: engine/engine.py:122
+#: engine/engine.py:157
msgid "Switch typing mode"
msgstr "Changer méthode d'écriture"
-#: engine/engine.py:128
+#: engine/engine.py:163
msgid "Romaji"
msgstr "Romaji"
-#: engine/engine.py:131
+#: engine/engine.py:166
msgid "Kana"
msgstr "Kana"
-#: engine/factory.py:35
+#: engine/engine.py:179
+msgid "Configure Anthy"
+msgstr ""
+
+#: engine/factory.py:34
msgid "Anthy"
msgstr "Anthy"
+
+#: setup/main.py:72
+msgid "Confirm"
+msgstr ""
+
+#: setup/main.py:73
+msgid "Are you sure to close Setup?"
+msgstr ""
+
+#: setup/main.py:86
+msgid "Notice!"
+msgstr ""
+
+#: setup/main.py:87
+msgid "Are you sure to close Setup without save configure?"
+msgstr ""
+
+#: setup/main.py:166
+msgid "Please press a key (or a key combination)"
+msgstr ""
+
+#: setup/main.py:167
+msgid "The dialog willbe closed when the key is released"
+msgstr ""
+
+#: setup/main.py:186
+msgid "Invalid keysym"
+msgstr ""
+
+#: setup/main.py:187
+msgid "This keysym is not valid"
+msgstr ""
+
+#: setup/setup.glade:7
+msgid "Setup - IBus-Anthy"
+msgstr ""
+
+#: setup/setup.glade:43
+#, fuzzy
+msgid ""
+"Romaji\n"
+"Kana"
+msgstr "Romaji"
+
+#: setup/setup.glade:58
+msgid ""
+"Hiragana\n"
+"Katakana\n"
+"Half Width Katakana\n"
+"Latin\n"
+"Wide Latin"
+msgstr ""
+
+#: setup/setup.glade:75
+msgid "_Typing Method:"
+msgstr ""
+
+#: setup/setup.glade:90
+msgid "_Input Mode:"
+msgstr ""
+
+#: setup/setup.glade:106
+msgid "<b>Initial Setting</b>"
+msgstr ""
+
+#: setup/setup.glade:140
+msgid ""
+"Clear\n"
+"Commit\n"
+"Hold\n"
+msgstr ""
+
+#: setup/setup.glade:157
+msgid ""
+"Do Nothing\n"
+"Auto Convert"
+msgstr ""
+
+#: setup/setup.glade:173
+msgid "Behaivior on _Focus Out:"
+msgstr ""
+
+#: setup/setup.glade:188
+msgid "_Behavior on Period:"
+msgstr ""
+
+#: setup/setup.glade:202
+msgid ""
+"、。\n"
+",.\n"
+msgstr ""
+
+#: setup/setup.glade:216
+msgid ""
+"Ten Key Mode\n"
+"Usual Mode\n"
+msgstr ""
+
+#: setup/setup.glade:233
+msgid "Ten _Key Type:"
+msgstr ""
+
+#: setup/setup.glade:248
+msgid "_Period Style:"
+msgstr ""
+
+#: setup/setup.glade:264
+msgid "<b>Behaivior</b>"
+msgstr ""
+
+#: setup/setup.glade:298
+msgid "Half Width _Symbol"
+msgstr ""
+
+#: setup/setup.glade:319
+msgid "Candidate _Window Page Size:"
+msgstr ""
+
+#: setup/setup.glade:350
+msgid "Half Width _Number"
+msgstr ""
+
+#: setup/setup.glade:370
+msgid "<b>Other</b>"
+msgstr ""
+
+#: setup/setup.glade:389
+msgid "Co_mmon"
+msgstr ""
+
+#: setup/setup.glade:407
+msgid "_Key Customize"
+msgstr ""
+
+#: setup/setup.glade:471
+msgid "De_fault"
+msgstr ""
+
+#: setup/setup.glade:515
+msgid "Key bin_ding"
+msgstr ""
+
+#: setup/setup.glade:528
+msgid ""
+"<span size='xx-large'><b>IBus-Anthy</b></span>\n"
+"\n"
+"<big>The Anthy engine for IBus input platform</big>\n"
+"\n"
+"URL : http://code.google.com/p/ibus/\n"
+"\n"
+msgstr ""
+
+#: setup/setup.glade:546
+msgid "Abo_ut"
+msgstr ""
+
+#: setup/setup.glade:617
+msgid "Edit Shortcut"
+msgstr ""
+
+#: setup/setup.glade:652
+msgid "Key Code:"
+msgstr ""
+
+#: setup/setup.glade:673
+msgid "..."
+msgstr ""
+
+#: setup/setup.glade:698
+msgid "Modifier:"
+msgstr ""
+
+#: setup/setup.glade:712
+msgid "A_lternate"
+msgstr ""
+
+#: setup/setup.glade:722
+msgid "Co_ntrol"
+msgstr ""
+
+#: setup/setup.glade:735
+msgid "_Shift"
+msgstr ""
diff --git a/po/ja.po b/po/ja.po
index 1ee232b..2806efd 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ibus-anthy VERSION\n"
"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
-"POT-Creation-Date: 2008-09-03 15:11+0800\n"
+"POT-Creation-Date: 2009-05-28 10:22+0900\n"
"PO-Revision-Date: 2009-03-16 12:31+1000\n"
"Last-Translator: UTUMI Hirosi <utuhiro78@yahoo.co.jp>\n"
"Language-Team: Japanese <gnome-translation@gnome.gr.jp>\n"
@@ -15,42 +15,244 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: engine/engine.py:90
+#: engine/engine.py:125
msgid "Switch input mode"
msgstr "入力モード切替"
-#: engine/engine.py:96
+#: engine/engine.py:131
msgid "Hiragana"
msgstr "ひらがな"
-#: engine/engine.py:99
+#: engine/engine.py:134
msgid "Katakana"
msgstr "カタカナ"
-#: engine/engine.py:102
+#: engine/engine.py:137
msgid "Half width katakana"
msgstr "半角カタカナ"
-#: engine/engine.py:105
+#: engine/engine.py:140
msgid "Latin"
msgstr "英数"
-#: engine/engine.py:108
+#: engine/engine.py:143
msgid "Wide Latin"
msgstr "全角英数"
-#: engine/engine.py:122
+#: engine/engine.py:157
msgid "Switch typing mode"
msgstr "入力モード切替"
-#: engine/engine.py:128
+#: engine/engine.py:163
msgid "Romaji"
msgstr "ローマ字"
-#: engine/engine.py:131
+#: engine/engine.py:166
msgid "Kana"
msgstr "かな"
-#: engine/factory.py:35
+#: engine/engine.py:179
+msgid "Configure Anthy"
+msgstr "Anthyの設定"
+
+#: engine/factory.py:34
msgid "Anthy"
msgstr "Anthy"
+
+#: setup/main.py:72
+msgid "Confirm"
+msgstr "確認"
+
+#: setup/main.py:73
+msgid "Are you sure to close Setup?"
+msgstr "この設定ツールを終了します。よろしいですか?"
+
+#: setup/main.py:86
+msgid "Notice!"
+msgstr "注意!"
+
+#: setup/main.py:87
+msgid "Are you sure to close Setup without save configure?"
+msgstr "変更を保存せずに終了します。よろしいですか?"
+
+#: setup/main.py:166
+msgid "Please press a key (or a key combination)"
+msgstr "キーを入力してください"
+
+#: setup/main.py:167
+msgid "The dialog willbe closed when the key is released"
+msgstr "このダイアログはキーリリース時に閉じられます"
+
+#: setup/main.py:186
+msgid "Invalid keysym"
+msgstr "無効なキーシンボル"
+
+#: setup/main.py:187
+msgid "This keysym is not valid"
+msgstr "このキーシンボルは有効ではありません"
+
+#: setup/setup.glade:7
+msgid "Setup - IBus-Anthy"
+msgstr "IBus-Anthyの設定"
+
+#: setup/setup.glade:43
+msgid ""
+"Romaji\n"
+"Kana"
+msgstr ""
+"ローマ字\n"
+"かな"
+
+#: setup/setup.glade:58
+msgid ""
+"Hiragana\n"
+"Katakana\n"
+"Half Width Katakana\n"
+"Latin\n"
+"Wide Latin"
+msgstr ""
+"ひらがな\n"
+"カタカナ\n"
+"半角カタカナ\n"
+"英数\n"
+"全角英数"
+
+#: setup/setup.glade:75
+msgid "_Typing Method:"
+msgstr "入力タイプ(_T):"
+
+#: setup/setup.glade:90
+msgid "_Input Mode:"
+msgstr "入力モード(_I):"
+
+#: setup/setup.glade:106
+msgid "<b>Initial Setting</b>"
+msgstr "<b>初期値の設定</b>"
+
+#: setup/setup.glade:140
+msgid ""
+"Clear\n"
+"Commit\n"
+"Hold\n"
+msgstr ""
+"消去\n"
+"確定\n"
+"保持\n"
+
+#: setup/setup.glade:157
+msgid ""
+"Do Nothing\n"
+"Auto Convert"
+msgstr ""
+"何もしない\n"
+"自動変換"
+
+#: setup/setup.glade:173
+msgid "Behaivior on _Focus Out:"
+msgstr "フォーカスアウト時のふるまい(_F):"
+
+#: setup/setup.glade:188
+msgid "_Behavior on Period:"
+msgstr "句読点入力時のふるまい(_B):"
+
+#: setup/setup.glade:202
+msgid ""
+"、。\n"
+",.\n"
+msgstr ""
+"、。\n"
+",.\n"
+
+#: setup/setup.glade:216
+msgid ""
+"Ten Key Mode\n"
+"Usual Mode\n"
+msgstr ""
+"テンキーコードのまま\n"
+"非テンキーコードに変換\n"
+
+#: setup/setup.glade:233
+msgid "Ten _Key Type:"
+msgstr "テンキータイプ(_K):"
+
+#: setup/setup.glade:248
+msgid "_Period Style:"
+msgstr "句読点スタイル(_P):"
+
+#: setup/setup.glade:264
+msgid "<b>Behaivior</b>"
+msgstr "<b>ふるまい</b>"
+
+#: setup/setup.glade:298
+msgid "Half Width _Symbol"
+msgstr "常に記号を半角にする(_S)"
+
+#: setup/setup.glade:319
+msgid "Candidate _Window Page Size:"
+msgstr "候補ウインドウの項目数(_W):"
+
+#: setup/setup.glade:350
+msgid "Half Width _Number"
+msgstr "常に数字を半角にする(_N)"
+
+#: setup/setup.glade:370
+msgid "<b>Other</b>"
+msgstr "<b>その他</b>"
+
+#: setup/setup.glade:389
+msgid "Co_mmon"
+msgstr "全般(_M)"
+
+#: setup/setup.glade:407
+msgid "_Key Customize"
+msgstr "キーカスタマイズ(_K)"
+
+#: setup/setup.glade:471
+msgid "De_fault"
+msgstr "デフォルト(_F)"
+
+#: setup/setup.glade:515
+msgid "Key bin_ding"
+msgstr "キー割当(_D)"
+
+#: setup/setup.glade:528
+msgid ""
+"<span size='xx-large'><b>IBus-Anthy</b></span>\n"
+"\n"
+"<big>The Anthy engine for IBus input platform</big>\n"
+"\n"
+"URL : http://code.google.com/p/ibus/\n"
+"\n"
+msgstr ""
+
+#: setup/setup.glade:546
+msgid "Abo_ut"
+msgstr "このプログラムについて(_U)"
+
+#: setup/setup.glade:617
+msgid "Edit Shortcut"
+msgstr "ショートカットの編集"
+
+#: setup/setup.glade:652
+msgid "Key Code:"
+msgstr "キーコード:"
+
+#: setup/setup.glade:673
+msgid "..."
+msgstr "..."
+
+#: setup/setup.glade:698
+msgid "Modifier:"
+msgstr "キー修飾:"
+
+#: setup/setup.glade:712
+msgid "A_lternate"
+msgstr ""
+
+#: setup/setup.glade:722
+msgid "Co_ntrol"
+msgstr ""
+
+#: setup/setup.glade:735
+msgid "_Shift"
+msgstr ""
diff --git a/po/zh_CN.po b/po/zh_CN.po
index f0b2313..7cae5ea 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ibus-anthy VERSION\n"
"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
-"POT-Creation-Date: 2008-09-03 15:11+0800\n"
+"POT-Creation-Date: 2009-05-28 10:22+0900\n"
"PO-Revision-Date: 2008-08-21 21:37+0800\n"
"Last-Translator: Huang Peng <shawn.p.huang@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,42 +15,228 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: engine/engine.py:90
+#: engine/engine.py:125
msgid "Switch input mode"
msgstr "切换输入模式"
-#: engine/engine.py:96
+#: engine/engine.py:131
msgid "Hiragana"
msgstr "平假名"
-#: engine/engine.py:99
+#: engine/engine.py:134
msgid "Katakana"
msgstr "片假名"
-#: engine/engine.py:102
+#: engine/engine.py:137
msgid "Half width katakana"
msgstr "半角片假名"
-#: engine/engine.py:105
+#: engine/engine.py:140
msgid "Latin"
msgstr "英数"
-#: engine/engine.py:108
+#: engine/engine.py:143
msgid "Wide Latin"
msgstr "全角英数"
-#: engine/engine.py:122
+#: engine/engine.py:157
msgid "Switch typing mode"
msgstr "切换输入模式"
-#: engine/engine.py:128
+#: engine/engine.py:163
msgid "Romaji"
msgstr ""
-#: engine/engine.py:131
+#: engine/engine.py:166
msgid "Kana"
msgstr ""
-#: engine/factory.py:35
+#: engine/engine.py:179
+msgid "Configure Anthy"
+msgstr ""
+
+#: engine/factory.py:34
msgid "Anthy"
msgstr ""
+
+#: setup/main.py:72
+msgid "Confirm"
+msgstr ""
+
+#: setup/main.py:73
+msgid "Are you sure to close Setup?"
+msgstr ""
+
+#: setup/main.py:86
+msgid "Notice!"
+msgstr ""
+
+#: setup/main.py:87
+msgid "Are you sure to close Setup without save configure?"
+msgstr ""
+
+#: setup/main.py:166
+msgid "Please press a key (or a key combination)"
+msgstr ""
+
+#: setup/main.py:167
+msgid "The dialog willbe closed when the key is released"
+msgstr ""
+
+#: setup/main.py:186
+msgid "Invalid keysym"
+msgstr ""
+
+#: setup/main.py:187
+msgid "This keysym is not valid"
+msgstr ""
+
+#: setup/setup.glade:7
+msgid "Setup - IBus-Anthy"
+msgstr ""
+
+#: setup/setup.glade:43
+msgid ""
+"Romaji\n"
+"Kana"
+msgstr ""
+
+#: setup/setup.glade:58
+msgid ""
+"Hiragana\n"
+"Katakana\n"
+"Half Width Katakana\n"
+"Latin\n"
+"Wide Latin"
+msgstr ""
+
+#: setup/setup.glade:75
+msgid "_Typing Method:"
+msgstr ""
+
+#: setup/setup.glade:90
+msgid "_Input Mode:"
+msgstr ""
+
+#: setup/setup.glade:106
+msgid "<b>Initial Setting</b>"
+msgstr ""
+
+#: setup/setup.glade:140
+msgid ""
+"Clear\n"
+"Commit\n"
+"Hold\n"
+msgstr ""
+
+#: setup/setup.glade:157
+msgid ""
+"Do Nothing\n"
+"Auto Convert"
+msgstr ""
+
+#: setup/setup.glade:173
+msgid "Behaivior on _Focus Out:"
+msgstr ""
+
+#: setup/setup.glade:188
+msgid "_Behavior on Period:"
+msgstr ""
+
+#: setup/setup.glade:202
+msgid ""
+"、。\n"
+",.\n"
+msgstr ""
+
+#: setup/setup.glade:216
+msgid ""
+"Ten Key Mode\n"
+"Usual Mode\n"
+msgstr ""
+
+#: setup/setup.glade:233
+msgid "Ten _Key Type:"
+msgstr ""
+
+#: setup/setup.glade:248
+msgid "_Period Style:"
+msgstr ""
+
+#: setup/setup.glade:264
+msgid "<b>Behaivior</b>"
+msgstr ""
+
+#: setup/setup.glade:298
+msgid "Half Width _Symbol"
+msgstr ""
+
+#: setup/setup.glade:319
+msgid "Candidate _Window Page Size:"
+msgstr ""
+
+#: setup/setup.glade:350
+msgid "Half Width _Number"
+msgstr ""
+
+#: setup/setup.glade:370
+msgid "<b>Other</b>"
+msgstr ""
+
+#: setup/setup.glade:389
+msgid "Co_mmon"
+msgstr ""
+
+#: setup/setup.glade:407
+msgid "_Key Customize"
+msgstr ""
+
+#: setup/setup.glade:471
+msgid "De_fault"
+msgstr ""
+
+#: setup/setup.glade:515
+msgid "Key bin_ding"
+msgstr ""
+
+#: setup/setup.glade:528
+msgid ""
+"<span size='xx-large'><b>IBus-Anthy</b></span>\n"
+"\n"
+"<big>The Anthy engine for IBus input platform</big>\n"
+"\n"
+"URL : http://code.google.com/p/ibus/\n"
+"\n"
+msgstr ""
+
+#: setup/setup.glade:546
+msgid "Abo_ut"
+msgstr ""
+
+#: setup/setup.glade:617
+msgid "Edit Shortcut"
+msgstr ""
+
+#: setup/setup.glade:652
+msgid "Key Code:"
+msgstr ""
+
+#: setup/setup.glade:673
+msgid "..."
+msgstr ""
+
+#: setup/setup.glade:698
+msgid "Modifier:"
+msgstr ""
+
+#: setup/setup.glade:712
+msgid "A_lternate"
+msgstr ""
+
+#: setup/setup.glade:722
+msgid "Co_ntrol"
+msgstr ""
+
+#: setup/setup.glade:735
+msgid "_Shift"
+msgstr ""
diff --git a/setup/Makefile.am b/setup/Makefile.am
new file mode 100644
index 0000000..6dbefa8
--- /dev/null
+++ b/setup/Makefile.am
@@ -0,0 +1,45 @@
+# vim:set noet ts=4:
+#
+# ibus-pinyin - The PinYin engine for IBus
+#
+# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.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 2, 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, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+setup_anthy_PYTHON = \
+ prefs.py \
+ anthyprefs.py \
+ main.py \
+ setup.glade \
+ $(NULL)
+
+setup_anthydir = $(datadir)/ibus-anthy/setup
+
+libexec_SCRIPTS = ibus-setup-anthy
+
+CLEANFILES = \
+ *.pyc \
+ $(NULL)
+
+EXTRA_DIST = \
+ ibus-setup-anthy.in \
+ $(NULL)
+
+test:
+ $(ENV) DBUS_DEBUG=true \
+ LANG=en_US \
+ PYTHONPATH=$(abs_top_srcdir):$(pyexecdir) \
+ $(PYTHON) $(srcdir)/main.py
+
diff --git a/setup/anthyprefs.py b/setup/anthyprefs.py
new file mode 100644
index 0000000..5f2d6a2
--- /dev/null
+++ b/setup/anthyprefs.py
@@ -0,0 +1,188 @@
+# -*- coding: utf-8 -*-
+
+
+from prefs import Prefs
+
+
+__all__ = ['AnthyPrefs']
+
+
+class AnthyPrefs(Prefs):
+ _prefix = 'engine/anthy'
+
+ def __init__(self, bus=None, config=None):
+ super(AnthyPrefs, self).__init__(bus, config)
+ self.default = _config
+
+ self.fetch_all()
+
+ def keys(self, section):
+ if section.startswith('shortcut/'):
+ return _cmd_keys
+ return self.default[section].keys()
+
+
+_cmd_keys = [
+ "on_off",
+ "circle_input_mode",
+ "circle_kana_mode",
+ "latin_mode",
+ "wide_latin_mode",
+ "hiragana_mode",
+ "katakana_mode",
+ "half_katakana",
+ "cancel_pseudo_ascii_mode_key",
+ "circle_typing_method",
+
+ "insert_space",
+ "insert_alternate_space",
+ "insert_half_space",
+ "insert_wide_space",
+ "backspace",
+ "delete",
+ "commit",
+ "convert",
+ "predict",
+ "cancel",
+ "cancel_all",
+ "reconvert",
+ "do_nothing",
+
+ "select_first_candidate",
+ "select_last_candidate",
+ "select_next_candidate",
+ "select_prev_candidate",
+ "candidates_page_up",
+ "candidates_page_down",
+
+ "move_caret_first",
+ "move_caret_last",
+ "move_caret_forward",
+ "move_caret_backward",
+
+ "select_first_segment",
+ "select_last_segment",
+ "select_next_segment",
+ "select_prev_segment",
+ "shrink_segment",
+ "expand_segment",
+ "commit_first_segment",
+ "commit_selected_segment",
+
+ "select_candidates_1",
+ "select_candidates_2",
+ "select_candidates_3",
+ "select_candidates_4",
+ "select_candidates_5",
+ "select_candidates_6",
+ "select_candidates_7",
+ "select_candidates_8",
+ "select_candidates_9",
+ "select_candidates_0",
+
+ "convert_to_char_type_forward",
+ "convert_to_char_type_backward",
+ "convert_to_hiragana",
+ "convert_to_katakana",
+ "convert_to_half",
+ "convert_to_half_katakana",
+ "convert_to_wide_latin",
+ "convert_to_latin",
+
+ "dict_admin",
+ "add_word",
+]
+
+_config = {
+ 'common': {
+ 'input_mode': 0,
+ 'typing_method': 0,
+
+ 'period_style': 0,
+ 'ten_key_mode': 0,
+ 'behivior_on_focus_out': 0,
+ 'behivior_on_period': 0,
+
+ 'page_size': 10,
+ 'half_width_symbol': False,
+ 'half_width_number': False
+ },
+ 'shortcut/default': {
+ #mode_keys
+ 'on_off': ['Ctrl+J'],
+ 'circle_input_mode': ['Ctrl+comma', 'Ctrl+less'],
+ 'circle_kana_mode': ['Ctrl+period', 'Ctrl+greater', 'Hiragana_Katakana'],
+ 'latin_mode': [],
+ 'wide_latin_mode': [],
+ 'hiragana_mode': [],
+ 'katakana_mode': [],
+ 'half_katakana': [],
+ 'cancel_pseudo_ascii_mode_key': ['Escape'],
+ 'circle_typing_method': ['Alt+Romaji', 'Ctrl+slash'],
+
+ #edit_keys
+ 'insert_space': ['space'],
+ 'insert_alternate_space': ['Shift+space'],
+ 'insert_half_space': [],
+ 'insert_wide_space': [],
+ 'backspace': ['BackSpace', 'Ctrl+H'],
+ 'delete': ['Delete', 'Ctrl+D'],
+ 'commit': ['Return', 'KP_Enter', 'Ctrl+J', 'Ctrl+M'],
+ 'convert': ['space', 'KP_Space', 'Henkan'],
+ 'predict': ['Tab', 'ISO_Left_Tab'],
+ 'cancel': ['Escape', 'Ctrl+G'],
+ 'cancel_all': [],
+ 'reconvert': ['Shift+Henkan'],
+ 'do_nothing': [],
+
+ #caret_keys
+ 'move_caret_first': ['Ctrl+A', 'Home'],
+ 'move_caret_last': ['Ctrl+E', 'End'],
+ 'move_caret_forward': ['Right', 'Ctrl+F'],
+ 'move_caret_backward': ['Left', 'Ctrl+B'],
+
+ #segments_keys
+ 'select_first_segment': ['Ctrl+A', 'Home'],
+ 'select_last_segment': ['Ctrl+E', 'End'],
+ 'select_next_segment': ['Right', 'Ctrl+F'],
+ 'select_prev_segment': ['Left', 'Ctrl+B'],
+ 'shrink_segment': ['Shift+Left', 'Ctrl+I'],
+ 'expand_segment': ['Shift+Right', 'Ctrl+O'],
+ 'commit_first_segment': ['Shift+Down'],
+ 'commit_selected_segment': ['Ctrl+Down'],
+
+ #candidates_keys
+ 'select_first_candidate': ['Home'],
+ 'select_last_candidate': ['End'],
+ 'select_next_candidate': ['space', 'KP_Space', 'Tab', 'ISO_Left_Tab', 'Henkan', 'Down', 'KP_Add', 'Ctrl+N'],
+ 'select_prev_candidate': ['Shift+Tab', 'Shift+ISO_Left_Tab', 'Up', 'KP_Subtract', 'Ctrl+P'],
+ 'candidates_page_up': ['Page_Up'],
+ 'candidates_page_down': ['Page_Down', 'KP_Tab'],
+
+ #direct_select_keys
+ 'select_candidates_1': ['1'],
+ 'select_candidates_2': ['2'],
+ 'select_candidates_3': ['3'],
+ 'select_candidates_4': ['4'],
+ 'select_candidates_5': ['5'],
+ 'select_candidates_6': ['6'],
+ 'select_candidates_7': ['7'],
+ 'select_candidates_8': ['8'],
+ 'select_candidates_9': ['9'],
+ 'select_candidates_0': ['0'],
+
+ #convert_keys
+ 'convert_to_char_type_forward': ['Muhenkan'],
+ 'convert_to_char_type_backward': [],
+ 'convert_to_hiragana': ['F6'],
+ 'convert_to_katakana': ['F7'],
+ 'convert_to_half': ['F8'],
+ 'convert_to_half_katakana': ['Shift+F8'],
+ 'convert_to_wide_latin': ['F9'],
+ 'convert_to_latin': ['F10'],
+
+ #dictonary_keys
+ 'dict_admin': ['F11'],
+ 'add_word': ['F12'],
+ },
+}
diff --git a/setup/ibus-setup-anthy.in b/setup/ibus-setup-anthy.in
new file mode 100644
index 0000000..c2bcb09
--- /dev/null
+++ b/setup/ibus-setup-anthy.in
@@ -0,0 +1,23 @@
+#!/bin/sh
+# vim:set noet ts=4:
+#
+# ibus-tmpl - The Input Bus template project
+#
+# Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.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 2, 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, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+exec python @prefix@/share/ibus-anthy/setup/main.py $@
+
diff --git a/setup/main.py b/setup/main.py
new file mode 100644
index 0000000..bb903d7
--- /dev/null
+++ b/setup/main.py
@@ -0,0 +1,213 @@
+from os import path
+import gtk
+from gtk import glade
+from ibus import keysyms, modifier
+from gettext import dgettext
+
+from anthyprefs import AnthyPrefs
+
+
+_ = lambda a : dgettext('ibus-anthy', a)
+
+def l_to_s(l):
+ return str(sorted([str(s) for s in l])).replace("'", '')
+
+def s_to_l(s):
+ return [] if s == '[]' else s[1:-1].replace(' ', '').split(',')
+
+
+class AnthySetup(object):
+ def __init__(self):
+ self.prefs = prefs = AnthyPrefs()
+
+ glade.textdomain("ibus-anthy")
+ glade_file = path.join(path.dirname(__file__), "setup.glade")
+ self.xml = xml = glade.XML(glade_file)
+
+ for name in ['input_mode', 'typing_method',
+ 'period_style', 'ten_key_mode',
+ 'behivior_on_focus_out', 'behivior_on_period',
+ 'half_width_symbol', 'half_width_number']:
+ xml.get_widget(name).set_active(prefs.get_value('common', name))
+
+ xml.get_widget('page_size').set_value(prefs.get_value('common',
+ 'page_size'))
+
+ tv = xml.get_widget('shortcut')
+ tv.append_column(gtk.TreeViewColumn('Command',
+ gtk.CellRendererText(), text=0))
+ tv.append_column(gtk.TreeViewColumn('Shortcut',
+ gtk.CellRendererText(), text=1))
+ tv.get_selection().connect_after('changed',
+ self.on_selection_changed, 0)
+ ls = gtk.ListStore(str, str)
+ sec = 'shortcut/default'
+ for k in self.prefs.keys(sec):
+ ls.append([k, l_to_s(self.prefs.get_value(sec, k))])
+ tv.set_model(ls)
+
+ tv = xml.get_widget('treeview2')
+ tv.append_column(gtk.TreeViewColumn('', gtk.CellRendererText(), text=0))
+ tv.get_selection().connect_after('changed',
+ self.on_selection_changed, 1)
+ tv.set_model(gtk.ListStore(str))
+
+ xml.signal_autoconnect(self)
+
+ def on_selection_changed(self, widget, id):
+ set_sensitive = lambda a, b: self.xml.get_widget(a).set_sensitive(b)
+ flg = True if widget.get_selected()[1] else False
+ for name in [['btn_default', 'btn_edit'], ['button5', 'button6']][id]:
+ set_sensitive(name, flg)
+
+ def on_main_delete(self, widget, event):
+ self.on_btn_cancel_clicked(widget)
+ return True
+
+ def on_btn_ok_clicked(self, widget):
+ if self.xml.get_widget('btn_apply').state == gtk.STATE_INSENSITIVE:
+ gtk.main_quit()
+ return True
+ dlg = self.xml.get_widget('quit_check')
+ dlg.set_markup('<big><b>%s</b></big>' % _('Confirm'))
+ dlg.format_secondary_text(_('Are you sure to close Setup?'))
+ id = dlg.run()
+ dlg.hide()
+ if id == gtk.RESPONSE_OK:
+ self.prefs.commit_all()
+ gtk.main_quit()
+ return True
+
+ def on_btn_cancel_clicked(self, widget):
+ if self.xml.get_widget('btn_apply').state == gtk.STATE_INSENSITIVE:
+ gtk.main_quit()
+ return True
+ dlg = self.xml.get_widget('quit_check_without_save')
+ dlg.set_markup('<big><b>%s</b></big>' % _('Notice!'))
+ dlg.format_secondary_text(_('Are you sure to close Setup without save configure?'))
+ id = dlg.run()
+ dlg.hide()
+ if id == gtk.RESPONSE_OK:
+ gtk.main_quit()
+ return True
+
+ def on_btn_apply_clicked(self, widget):
+ self.prefs.commit_all()
+ widget.set_sensitive(False)
+
+ def on_cb_changed(self, widget):
+ self.prefs.set_value('common', widget.name, widget.get_active())
+ self.xml.get_widget('btn_apply').set_sensitive(True)
+
+ def on_sb_changed(self, widget):
+ self.prefs.set_value('common', widget.name, widget.get_value_as_int())
+ self.xml.get_widget('btn_apply').set_sensitive(True)
+
+ def on_ck_toggled(self, widget):
+ self.prefs.set_value('common', widget.name, widget.get_active())
+ self.xml.get_widget('btn_apply').set_sensitive(True)
+
+ def on_btn_edit_clicked(self, widget):
+ ls, it = self.xml.get_widget('shortcut').get_selection().get_selected()
+ m = self.xml.get_widget('treeview2').get_model()
+ m.clear()
+ for s in s_to_l(ls.get(it, 1)[0]):
+ m.append([s])
+ self.xml.get_widget('entry2').set_text('')
+ for w in ['checkbutton6', 'checkbutton7', 'checkbutton8']:
+ self.xml.get_widget(w).set_active(False)
+ dlg = self.xml.get_widget('edit_shortcut')
+ id = dlg.run()
+ dlg.hide()
+ if id == gtk.RESPONSE_OK:
+ new = l_to_s([m[i][0] for i in range(len(m))])
+ if new != ls.get(it, 1)[0]:
+ self.prefs.set_value('shortcut/default', ls.get(it, 0)[0], s_to_l(new))
+ ls.set(it, 1, new)
+ self.xml.get_widget('btn_apply').set_sensitive(True)
+
+ def on_btn_default_clicked(self, widget):
+ ls, it = self.xml.get_widget('shortcut').get_selection().get_selected()
+ sec = 'shortcut/default'
+ new = l_to_s(self.prefs.default[sec][ls.get(it, 0)[0]])
+ if new != ls.get(it, 1)[0]:
+ self.prefs.set_value(sec, ls.get(it, 0)[0], s_to_l(new))
+ ls.set(it, 1, new)
+ self.xml.get_widget('btn_apply').set_sensitive(True)
+
+ def on_shortcut_key_release_event(self, widget, event):
+ if event.hardware_keycode in [36, 65]:
+ self.on_btn_edit_clicked(None)
+
+ def on_shortcut_click_event(self, widget, event):
+ if event.type == gtk.gdk._2BUTTON_PRESS:
+ widget.dc = True
+ elif event.type == gtk.gdk.BUTTON_RELEASE:
+ if hasattr(widget, 'dc') and widget.dc:
+ self.on_btn_edit_clicked(None)
+ widget.dc = False
+
+ def on_key_input_dialog_key_press_event(self, widget, event):
+ return True
+
+ def on_key_input_dialog_key_release_event(self, widget, event):
+ widget.e = (event.keyval, event.state)
+ widget.response(gtk.RESPONSE_OK)
+ return True
+
+ def on_entry2_changed(self, widget):
+ if not widget.get_text():
+ self.xml.get_widget('button4').set_sensitive(False)
+ else:
+ self.xml.get_widget('button4').set_sensitive(True)
+
+ def on_button7_clicked(self, widget):
+ dlg = self.xml.get_widget('key_input_dialog')
+ dlg.set_markup('<big><b>%s</b></big>' % _('Please press a key (or a key combination)'))
+ dlg.format_secondary_text(_('The dialog willbe closed when the key is released'))
+ id = dlg.run()
+ dlg.hide()
+ if id == gtk.RESPONSE_OK:
+ key, state = dlg.e
+ if (state & (modifier.CONTROL_MASK | modifier.ALT_MASK) and
+ ord('a') <= key <= ord('z')):
+ key = ord(chr(key).upper())
+ self.xml.get_widget('entry2').set_text(keysyms.keycode_to_name(key))
+
+ for w, i in [('checkbutton6', modifier.CONTROL_MASK),
+ ('checkbutton7', modifier.ALT_MASK),
+ ('checkbutton8', modifier.SHIFT_MASK)]:
+ self.xml.get_widget(w).set_active(True if state & i else False)
+
+ def on_button4_clicked(self, widget):
+ s = self.xml.get_widget('entry2').get_text()
+ if not s or not keysyms.name_to_keycode(s):
+ dlg = self.xml.get_widget('invalid_keysym')
+ dlg.set_markup('<big><b>%s</b></big>' % _('Invalid keysym'))
+ dlg.format_secondary_text(_('This keysym is not valid'))
+ dlg.run()
+ dlg.hide()
+ return True
+ for w, m in [('checkbutton6', 'Ctrl+'),
+ ('checkbutton7', 'Alt+'),
+ ('checkbutton8', 'Shift+')]:
+ if self.xml.get_widget(w).get_active():
+ s = m + s
+ l = self.xml.get_widget('treeview2').get_model()
+ for i in range(len(l)):
+ if l[i][0] == s:
+ return True
+ l.append([s])
+
+ def on_button6_clicked(self, widget):
+ l, i = self.xml.get_widget('treeview2').get_selection().get_selected()
+ if i:
+ l.remove(i)
+
+ def run(self):
+ gtk.main()
+
+
+if __name__ == "__main__":
+ AnthySetup().run()
+
diff --git a/setup/prefs.py b/setup/prefs.py
new file mode 100644
index 0000000..7d67994
--- /dev/null
+++ b/setup/prefs.py
@@ -0,0 +1,99 @@
+from ibus import Bus
+
+
+class Prefs(object):
+ _prefix = 'engine/dummy'
+
+ def __init__(self, bus=None, config=None):
+ self.default = {}
+ self.modified = {}
+ self.new = {}
+
+ self._config = config if config else \
+ bus.get_config() if bus else \
+ Bus().get_config()
+
+ def keys(self, section):
+ return self.default[section].keys()
+
+ def sections(self):
+ return self.default.keys()
+
+ def get_value(self, section, key):
+ try:
+ return self.new[section][key]
+ except:
+ try:
+ return self.modified[section][key]
+ except:
+ return self.default[section][key]
+
+ def set_value(self, section, key, value):
+ self.default[section][key]
+ self.new.setdefault(section, {})[key] = value
+
+ def fetch_all(self):
+ for s in self.sections():
+ self.fetch_section(s)
+
+ def fetch_section(self, section):
+ for k in self.keys(section):
+ self.fetch_item(section, k)
+
+ def fetch_item(self, section, key):
+ s = '/'.join(
+ [s for s in '/'.join([self._prefix, section]).split('/') if s])
+ v = self._config.get_value(s, key, None)
+ if v != None:
+ self.modified.setdefault(section, {})[key] = v if v != [''] else []
+
+ def commit_all(self):
+ for s in self.new.keys():
+ self.commit_section(s)
+
+ def commit_section(self, section):
+ if section in self.new:
+ for k in self.new[section].keys():
+ self.commit_item(section, k)
+
+ def commit_item(self, section, key):
+ if section in self.new and key in self.new[section]:
+ s = '/'.join(
+ [s for s in '/'.join([self._prefix, section]).split('/') if s])
+ v = self.new[section][key]
+ if v == []:
+ v = ['']
+ self._config.set_value(s, key, v)
+ self.modified.setdefault(section, {})[key] = v
+ del(self.new[section][key])
+
+ def undo_all(self):
+ self.new.clear()
+
+ def undo_section(self, section):
+ try:
+ del(self.new[section])
+ except:
+ pass
+
+ def undo_item(self, section, key):
+ try:
+ del(self.new[section][key])
+ except:
+ pass
+
+ def set_default_all(self):
+ for s in self.sections():
+ self.set_default_section(s)
+
+ def set_default_section(self, section):
+ for k in self.keys(section):
+ self.set_default_item(section, k)
+
+ def set_default_item(self, section, key):
+ try:
+ if key in self.modified[section] or key in self.new[section]:
+ self.new[section][key] = self.default[section][key]
+ except:
+ pass
+
diff --git a/setup/setup.glade b/setup/setup.glade
new file mode 100644
index 0000000..faa88ea
--- /dev/null
+++ b/setup/setup.glade
@@ -0,0 +1,987 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
+<glade-interface>
+ <widget class="GtkDialog" id="main">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Setup - IBus-Anthy</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <signal name="delete_event" handler="on_main_delete"/>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkNotebook" id="notebook1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">6</property>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">8</property>
+ <child>
+ <widget class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="top_padding">8</property>
+ <property name="bottom_padding">8</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">8</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <widget class="GtkComboBox" id="typing_method">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Romaji
+Kana</property>
+ <signal name="changed" handler="on_cb_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="input_mode">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Hiragana
+Katakana
+Half Width Katakana
+Latin
+Wide Latin</property>
+ <signal name="changed" handler="on_cb_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label21">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Typing Method:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">typing_method</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Input Mode:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">input_mode</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label16">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Initial Setting&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="top_padding">8</property>
+ <property name="bottom_padding">8</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkTable" id="table2">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">8</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <widget class="GtkComboBox" id="behivior_on_focus_out">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Clear
+Commit
+Hold
+</property>
+ <signal name="changed" handler="on_cb_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="behivior_on_period">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Do Nothing
+Auto Convert</property>
+ <signal name="changed" handler="on_cb_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label23">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Behaivior on _Focus Out:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">behivior_on_focus_out</property>
+ </widget>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label24">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Behavior on Period:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">behivior_on_period</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="period_style">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">、。
+,.
+</property>
+ <signal name="changed" handler="on_cb_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="ten_key_mode">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Ten Key Mode
+Usual Mode
+</property>
+ <signal name="changed" handler="on_cb_changed"/>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label26">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Ten _Key Type:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">ten_key_mode</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Period Style:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">period_style</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Behaivior&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="top_padding">8</property>
+ <property name="bottom_padding">8</property>
+ <property name="left_padding">12</property>
+ <child>
+ <widget class="GtkTable" id="table3">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="column_spacing">8</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <widget class="GtkCheckButton" id="half_width_symbol">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Half Width _Symbol</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_ck_toggled"/>
+ <accelerator key="S" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label25">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Candidate _Window Page Size:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">page_size</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="page_size">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">10 0 10 1 0 0</property>
+ <property name="climb_rate">0.97999999999999998</property>
+ <signal name="value_changed" handler="on_sb_changed"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="half_width_number">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Half Width _Number</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_ck_toggled"/>
+ <accelerator key="N" modifiers="GDK_MOD1_MASK" signal="grab_focus"/>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label22">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Other&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Co_mmon</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">vbox1</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="border_width">4</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkLabel" id="label28">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Key Customize</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">shortcut</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <child>
+ <widget class="GtkTreeView" id="shortcut">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <signal name="button_press_event" handler="on_shortcut_click_event"/>
+ <signal name="button_release_event" handler="on_shortcut_click_event"/>
+ <signal name="key_release_event" handler="on_shortcut_key_release_event"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="spacing">4</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="btn_default">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_btn_default_clicked"/>
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-undo</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label27">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">De_fault</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="btn_edit">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-edit</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_btn_edit_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Key bin_ding</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">vbox2</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="about">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;span size='xx-large'&gt;&lt;b&gt;IBus-Anthy&lt;/b&gt;&lt;/span&gt;
+
+&lt;big&gt;The Anthy engine for IBus input platform&lt;/big&gt;
+
+URL : http://code.google.com/p/ibus/
+
+</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_START</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Abo_ut</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">about</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="btn_apply">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-apply</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">-10</property>
+ <signal name="clicked" handler="on_btn_apply_clicked"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="btn_cancel">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">-6</property>
+ <signal name="clicked" handler="on_btn_cancel_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="btn_ok">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">-5</property>
+ <signal name="clicked" handler="on_btn_ok_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkDialog" id="edit_shortcut">
+ <property name="width_request">340</property>
+ <property name="height_request">300</property>
+ <property name="title" translatable="yes">Edit Shortcut</property>
+ <property name="modal">True</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">1</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <child>
+ <widget class="GtkTreeView" id="treeview2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label30">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Key Code:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="entry2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <signal name="changed" handler="on_entry2_changed"/>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">...</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button7_clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label29">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Modifier:</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">A_lternate</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton6">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Co_ntrol</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton8">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Shift</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="button4">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button4_clicked"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button5">
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-refresh</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button5_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button6">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-delete</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button6_clicked"/>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="cancelbutton2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="okbutton2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">-5</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkMessageDialog" id="quit_check">
+ <property name="border_width">5</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="message_type">GTK_MESSAGE_QUESTION</property>
+ <property name="buttons">GTK_BUTTONS_OK_CANCEL</property>
+ <property name="text">Confirm</property>
+ <property name="secondary_text">Are you sure to close Setup?</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox6">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area6">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkMessageDialog" id="quit_check_without_save">
+ <property name="border_width">5</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="message_type">GTK_MESSAGE_WARNING</property>
+ <property name="buttons">GTK_BUTTONS_OK_CANCEL</property>
+ <property name="text">Notice!</property>
+ <property name="secondary_text">Are you sure to close Setup without save configure?</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox7">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area7">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkMessageDialog" id="key_input_dialog">
+ <property name="border_width">5</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="buttons">GTK_BUTTONS_CANCEL</property>
+ <property name="text">Please press a key (or a key combination)</property>
+ <property name="secondary_text">The dialog willbe closed when the key is released</property>
+ <signal name="key_press_event" handler="on_key_input_dialog_key_press_event"/>
+ <signal name="key_release_event" handler="on_key_input_dialog_key_release_event"/>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox8">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area8">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <widget class="GtkMessageDialog" id="invalid_keysym">
+ <property name="border_width">5</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="message_type">GTK_MESSAGE_WARNING</property>
+ <property name="buttons">GTK_BUTTONS_OK</property>
+ <property name="text">Invalid keysym</property>
+ <property name="secondary_text">This keysym is not valid</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox9">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area9">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>