From 462564eb711a203282ac8d18bd6d1e96c775e84d Mon Sep 17 00:00:00 2001 From: Huang Peng Date: Mon, 30 Jun 2008 08:57:20 +0800 Subject: [PATCH] Remove engines. --- configure.ac | 29 -- engine/Makefile.am | 6 +- engine/anthy/.gitignore | 3 - engine/anthy/Makefile.am | 79 ----- engine/anthy/anthy.i | 115 -------- engine/anthy/engine.py | 526 ---------------------------------- engine/anthy/factory.py | 54 ---- engine/anthy/ibus-engine-anthy.in | 23 -- engine/anthy/main.py | 84 ------ engine/anthy/tables.py | 351 ----------------------- engine/anthy/test.py | 21 -- engine/enchant/.gitignore | 1 - engine/enchant/Makefile.am | 42 --- engine/enchant/engine.py | 191 ------------ engine/enchant/factory.py | 54 ---- engine/enchant/ibus-engine-enchant.in | 23 -- engine/enchant/main.py | 84 ------ ibus.spec.in | 33 --- icons/Makefile.am | 2 - icons/ibus-anthy.png | Bin 1722 -> 0 bytes 20 files changed, 4 insertions(+), 1717 deletions(-) delete mode 100644 engine/anthy/.gitignore delete mode 100644 engine/anthy/Makefile.am delete mode 100644 engine/anthy/anthy.i delete mode 100644 engine/anthy/engine.py delete mode 100644 engine/anthy/factory.py delete mode 100644 engine/anthy/ibus-engine-anthy.in delete mode 100644 engine/anthy/main.py delete mode 100644 engine/anthy/tables.py delete mode 100755 engine/anthy/test.py delete mode 100644 engine/enchant/.gitignore delete mode 100644 engine/enchant/Makefile.am delete mode 100644 engine/enchant/engine.py delete mode 100644 engine/enchant/factory.py delete mode 100644 engine/enchant/ibus-engine-enchant.in delete mode 100644 engine/enchant/main.py delete mode 100644 icons/ibus-anthy.png diff --git a/configure.ac b/configure.ac index bba4602..e340e6c 100644 --- a/configure.ac +++ b/configure.ac @@ -88,37 +88,12 @@ PKG_CHECK_MODULES(QT, [ Qt >= 4.3.5 ]) - -# check anthy -PKG_CHECK_MODULES(ANTHY, [ - anthy -]) - - -# check swig -AC_PATH_PROG(SWIG, swig) -if test x"$SWIG" == x""; then - AC_MSG_ERROR([can not find swig]) -fi -AC_SUBST(SWIG) - # check env AC_PATH_PROG(ENV, env) AC_SUBST(ENV) # check python AM_PATH_PYTHON([2.5]) -PYTHON_CONFIG=`type -p python$PYTHON_VERSION-config` -if test "$PYTHON_CONFIG" != ""; then - PYTHON_CFLAGS=`$PYTHON_CONFIG --includes` - PYTHON_LIBS=`$PYTHON_CONFIG --libs` -else - PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes` - PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs` -fi -AC_SUBST(PYTHON_CFLAGS) -AC_SUBST(PYTHON_LIBS) - # define GETTEXT_* variables GETTEXT_PACKAGE=ibus @@ -140,10 +115,6 @@ daemon/ibus-daemon panel/Makefile panel/ibus-panel engine/Makefile -engine/anthy/Makefile -engine/anthy/ibus-engine-anthy -engine/enchant/Makefile -engine/enchant/ibus-engine-enchant gtk2/Makefile qt4/Makefile icons/Makefile diff --git a/engine/Makefile.am b/engine/Makefile.am index 38d1a92..d67d694 100644 --- a/engine/Makefile.am +++ b/engine/Makefile.am @@ -20,6 +20,8 @@ # Boston, MA 02111-1307 USA SUBDIRS = \ - anthy \ - enchant \ $(NULL) + +install-data-hook: + $(MKDIR_P) $(DESTDIR)$(pkgdatadir)/engine + diff --git a/engine/anthy/.gitignore b/engine/anthy/.gitignore deleted file mode 100644 index 89eb2ce..0000000 --- a/engine/anthy/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -anthy.py -anthy_wrap.c -ibus-engine-anthy diff --git a/engine/anthy/Makefile.am b/engine/anthy/Makefile.am deleted file mode 100644 index 8400268..0000000 --- a/engine/anthy/Makefile.am +++ /dev/null @@ -1,79 +0,0 @@ -# vim:set noet ts=4: -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -engine_anthy_PYTHON = \ - engine.py \ - factory.py \ - main.py \ - tables.py \ - test.py \ - $(NULL) - -engine_anthydir = $(pkgdatadir)/engine/anthy - -anthy_DATA = \ - anthy.py \ - $(NULL) - -anthy_LTLIBRARIES = _anthy.la - -anthydir = @pyexecdir@ - -_anthy_la_SOURCES = \ - $(NULL) - -nodist__anthy_la_SOURCES = \ - anthy_wrap.c \ - $(NULL) - -_anthy_la_CFLAGS = \ - @ANTHY_CFLAGS@ \ - @PYTHON_CFLAGS@ \ - $(NULL) - -_anthy_la_LDFLAGS = \ - @ANTHY_LIBS@ \ - -rpath $(anthydir) \ - -avoid-version \ - -module \ - $(NULL) - -libexec_SCRIPTS = ibus-engine-anthy - -anthy.py anthy_wrap.c: anthy.i - $(SWIG) -python -I/usr/include -o anthy_wrap.c $(srcdir)/anthy.i - -test: - $(ENV) PYTHONPATH=$(top_srcdir):$(builddir)/.libs $(PYTHON) $(srcdir)/main.py - -EXTRA_DIST = \ - anthy.i \ - ibus-engine-anthy.in \ - $(NULL) - -CLEANFILES = \ - anthy.py \ - anthy_wrap.* \ - *.pyc \ - $(MULL) - -DISTCLEANFILES = \ - $(MULL) diff --git a/engine/anthy/anthy.i b/engine/anthy/anthy.i deleted file mode 100644 index 355986a..0000000 --- a/engine/anthy/anthy.i +++ /dev/null @@ -1,115 +0,0 @@ -/* vim:set et ts=4: */ -/* - * ibus - The Input Bus - * - * Copyright (c) 2007-2008 Huang Peng - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA - */ -%module anthy -%{ - /* Put header files here or function declarations like below */ -#include -%} - -%init %{ - anthy_init (); -%} - -/* anthy_context_t */ -%include anthy/anthy.h -struct anthy_context {}; -%extend anthy_context { - anthy_context () { - return anthy_create_context (); - } - - void reset () { - anthy_reset_context (self); - } - - int set_string (char *str) { - return anthy_set_string (self, str); - } - - void resize_segment (int a1, int a2) { - anthy_resize_segment (self, a1, a2); - } - - int get_stat (struct anthy_conv_stat *a1) { - return anthy_get_stat (self, a1); - } - - int get_segment_stat (int a1, struct anthy_segment_stat *a2) { - return anthy_get_segment_stat (self, a1, a2); - } - - char *get_segment (int a1, int a2) { - int len; - static char temp[512]; - - len = anthy_get_segment (self, a1, a2, temp, sizeof (temp)); - if (len >= 0) - return temp; - else - return NULL; - } - - int commit_segment (int a1, int a2) { - return anthy_commit_segment (self, a1, a2); - } - - int set_prediction_string (const char *a1) { - return anthy_set_prediction_string (self, a1); - } - - int get_prediction_stat (struct anthy_prediction_stat *a1) { - return anthy_get_prediction_stat (self, a1); - } - - char *get_prediction (int a1) { - int len; - static char temp[512]; - - len = anthy_get_prediction (self, a1, temp, sizeof (temp)); - - if (len >= 0) - return temp; - else - return NULL; - } - - int commit_prediction (int a1) { - return anthy_commit_prediction(self, a1); - } - - void _print () { - anthy_print_context (self); - } - - int _set_encoding (int encoding) { - return anthy_context_set_encoding (self, encoding); - } - - int set_reconversion_mode (int mode) { - return anthy_set_reconversion_mode (self, mode); - } - - ~anthy_context () { - anthy_release_context (self); - } -}; - diff --git a/engine/anthy/engine.py b/engine/anthy/engine.py deleted file mode 100644 index b16b90a..0000000 --- a/engine/anthy/engine.py +++ /dev/null @@ -1,526 +0,0 @@ -# vim:set noet ts=4: -# -*- coding: utf-8 -*- -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -import gobject -import gtk -import pango -import dbus -import ibus -import anthy -from tables import * -from ibus import keysyms -from ibus import interface -MODE_HIRAGANA, \ -MODE_KATAKANA, \ -MODE_HALF_WIDTH_KATAKANA, \ -MODE_LATIN, \ -MODE_WIDE_LATIN = range (0, 5) - -_ = lambda a: a - -class Engine (interface.IEngine): - def __init__ (self, dbusconn, object_path): - interface.IEngine.__init__ (self, dbusconn, object_path) - self._dbusconn = dbusconn - - # create anthy context - self._context = anthy.anthy_context () - self._context._set_encoding (anthy.ANTHY_UTF8_ENCODING) - - # init state - self._input_mode = MODE_HIRAGANA - self._prop_dict = {} - - self._lookup_table = ibus.LookupTable () - self._prop_list = self._init_props () - - # use reset to init values - self._reset () - - def _init_props (self): - props = ibus.PropList () - - # init input mode properties - mode_prop = ibus.Property (name = "InputMode", - type = ibus.PROP_TYPE_MENU, - label = "あ", - tooltip = "Switch input mode") - self._prop_dict["InputMode"] = mode_prop - - mode_props = ibus.PropList () - mode_props.append (ibus.Property (name = "InputMode.Hiragana", - type = ibus.PROP_TYPE_RADIO, - label = "Hiragana")) - mode_props.append (ibus.Property (name = "InputMode.Katakana", - type = ibus.PROP_TYPE_RADIO, - label = "Katakana")) - mode_props.append (ibus.Property (name = "InputMode.HalfWidthKatakana", - type = ibus.PROP_TYPE_RADIO, - label = "Half width katakana")) - mode_props.append (ibus.Property (name = "InputMode.Latin", - type = ibus.PROP_TYPE_RADIO, - label = "Latin")) - mode_props.append (ibus.Property (name = "InputMode.WideLatin", - type = ibus.PROP_TYPE_RADIO, - label = "Wide Latin")) - - mode_props[self._input_mode].set_state (ibus.PROP_STATE_CHECKED) - - for prop in mode_props: - self._prop_dict[prop.get_name ()] = prop - - mode_prop.set_sub_props (mode_props) - props.append (mode_prop) - - - # init test property - test_prop = ibus.Property (name = "TestProp", - type = ibus.PROP_TYPE_TOGGLE, - label = "あ", - tooltip = "test property") - self._prop_dict["TestProp"] = test_prop - props.append (test_prop) - - - return props - - # reset values of engine - def _reset (self): - self._input_chars = u"" - self._convert_chars = u"" - self._cursor_pos = 0 - self._need_update = False - self._convert_begined = False - self._segments = [] - self._lookup_table.clean () - self._lookup_table_visible = False - - # begine convert - def _begin_convert (self): - if self._convert_begined: - return - self._convert_begined = True - - self._context.set_string (self._input_chars.encode ("utf-8")) - conv_stat = anthy.anthy_conv_stat () - self._context.get_stat (conv_stat) - - for i in xrange (0, conv_stat.nr_segment): - buf = self._context.get_segment (i, 0) - text = unicode (buf, "utf-8") - self._segments.append ((0, text)) - - self._cursor_pos = 0 - self._fill_lookup_table () - self._lookup_table_visible = False - - def _fill_lookup_table (self): - # get segment stat - seg_stat = anthy.anthy_segment_stat () - self._context.get_segment_stat (self._cursor_pos, seg_stat) - - # fill lookup_table - self._lookup_table.clean () - for i in xrange (0, seg_stat.nr_candidate): - buf = self._context.get_segment (self._cursor_pos, i) - candidate = unicode (buf, "utf-8") - self._lookup_table.append_candidate (candidate) - - - def _invalidate (self): - if self._need_update: - return - self._need_update = True - gobject.idle_add (self._update, priority = gobject.PRIORITY_LOW) - - def _page_up (self): - # only process cursor down in convert mode - if not self._convert_begined: - return False - - if not self._lookup_table.page_up (): - return False - - candidate = self._lookup_table.get_current_candidate ()[0] - index = self._lookup_table.get_cursor_pos () - self._segments[self._cursor_pos] = index, candidate - self._invalidate () - return True - - def _page_down (self): - # only process cursor down in convert mode - if not self._convert_begined: - return False - - if not self._lookup_table.page_down (): - return False - - candidate = self._lookup_table.get_current_candidate ()[0] - index = self._lookup_table.get_cursor_pos () - self._segments[self._cursor_pos] = index, candidate - self._invalidate () - return True - - def _cursor_up (self): - # only process cursor down in convert mode - if not self._convert_begined: - return False - - if not self._lookup_table.cursor_up (): - return False - - candidate = self._lookup_table.get_current_candidate ()[0] - index = self._lookup_table.get_cursor_pos () - self._segments[self._cursor_pos] = index, candidate - self._invalidate () - return True - - def _cursor_down (self): - # only process cursor down in convert mode - if not self._convert_begined: - return False - - if not self._lookup_table.cursor_down (): - return False - - candidate = self._lookup_table.get_current_candidate ()[0] - index = self._lookup_table.get_cursor_pos () - self._segments[self._cursor_pos] = index, candidate - self._invalidate () - return True - - def _commit_string (self, text): - self._reset () - self.CommitString (text) - self._invalidate () - - def _update_input_chars (self): - begin, end = max (self._cursor_pos - 4, 0), self._cursor_pos - - for i in range (begin, end): - text = self._input_chars[i:end] - romja = romaji_typing_rule.get (text, None) - if romja != None: - self._input_chars = u"".join ((self._input_chars[:i], romja, self._input_chars[end:])) - self._cursor_pos -= len(text) - self._cursor_pos += len(romja) - - attrs = ibus.AttrList () - attrs.append (ibus.AttributeUnderline (pango.UNDERLINE_SINGLE, 0, len (self._input_chars.encode ("utf-8")))) - - self.UpdatePreedit (dbus.String (self._input_chars), - attrs.to_dbus_value (), - dbus.Int32 (self._cursor_pos), - len (self._input_chars) > 0) - self.UpdateAuxString (u"", ibus.AttrList ().to_dbus_value (), False) - self.UpdateLookupTable (self._lookup_table.to_dbus_value (), self._lookup_table_visible) - - def _update_convert_chars (self): - self._convert_chars = u"" - pos = 0 - i = 0 - for seg_index, text in self._segments: - self._convert_chars += text - if i <= self._cursor_pos: - pos += len (text) - i += 1 - - attrs = ibus.AttrList () - attrs.append (ibus.AttributeUnderline (pango.UNDERLINE_SINGLE, 0, len (self._convert_chars))) - attrs.append (ibus.AttributeBackground (ibus.RGB (200, 200, 240), - pos - len (self._segments[self._cursor_pos][1]), - pos)) - self.UpdatePreedit (dbus.String (self._convert_chars), - attrs.to_dbus_value (), - dbus.Int32 (pos), - True) - aux_string = u"( %d / %d )" % (self._lookup_table.get_cursor_pos () + 1, self._lookup_table.get_number_of_candidates()) - self.UpdateAuxString (aux_string, ibus.AttrList ().to_dbus_value (), self._lookup_table_visible) - self.UpdateLookupTable (self._lookup_table.to_dbus_value (), self._lookup_table_visible) - - def _update (self): - self._need_update = False - if self._convert_begined == False: - self._update_input_chars () - else: - self._update_convert_chars () - - def _on_key_return (self): - if not self._input_chars: - return False - if self._convert_begined == False: - self._commit_string (self._input_chars) - else: - i = 0 - for seg_index, text in self._segments: - self._context.commit_segment (i, seg_index) - self._commit_string (self._convert_chars) - return True - - def _on_key_escape (self): - if not self._input_chars: - return False - self._reset () - self._invalidate () - return True - - def _on_key_back_space (self): - if not self._input_chars: - return False - - if self._convert_begined: - self._convert_begined = False - self._cursor_pos = len (self._input_chars) - self._lookup_table.clean () - self._lookup_table_visible = False - elif self._cursor_pos > 0: - self._input_chars = self._input_chars[:self._cursor_pos - 1] + self._input_chars [self._cursor_pos:] - self._cursor_pos -= 1 - - self._invalidate () - return True - - def _on_key_delete (self): - if not self._input_chars: - return False - - if self._convert_begined: - self._convert_begined = False - self._cursor_pos = len (self._input_chars) - self._lookup_table.clean () - self._lookup_table_visible = False - elif self._cursor_pos < len (self._input_chars): - self._input_chars = self._input_chars[:self._cursor_pos] + self._input_chars [self._cursor_pos + 1:] - - self._invalidate () - return True - - def _on_key_space (self): - if not self._input_chars: - return False - if self._convert_begined == False: - self._begin_convert () - self._invalidate () - else: - self._lookup_table_visible = True - self._cursor_down () - return True - - def _on_key_up (self): - if not self._input_chars: - return False - self._lookup_table_visible = True - self._cursor_up () - return True - - def _on_key_down (self): - if not self._input_chars: - return False - self._lookup_table_visible = True - self._cursor_down () - return True - - def _on_key_page_up (self): - if not self._input_chars: - return False - if self._lookup_table_visible == True: - self._page_up () - return True - - def _on_key_page_down (self): - if not self._input_chars: - return False - if self._lookup_table_visible == True: - self._page_down () - return True - - def _on_key_left (self): - if not self._input_chars: - return False - if self._cursor_pos == 0: - return True - self._cursor_pos -= 1 - self._lookup_table_visible = False - self._fill_lookup_table () - self._invalidate () - return True - - def _on_key_right (self): - if not self._input_chars: - return False - - if self._convert_begined: - max_pos = len (self._segments) - 1 - else: - max_pos = len (self._input_chars) - if self._cursor_pos == max_pos: - return True - self._cursor_pos += 1 - self._lookup_table_visible = False - self._fill_lookup_table () - self._invalidate () - - return True - - def _on_key_number (self, index): - if not self._input_chars: - return False - - if self._convert_begined and self._lookup_table_visible: - candidates = self._lookup_table.get_canidates_in_current_page () - if self._lookup_table.set_cursor_pos_in_current_page (index): - index = self._lookup_table.get_cursor_pos () - candidate = self._lookup_table.get_current_candidate ()[0] - self._segments[self._cursor_pos] = index, candidate - self._lookup_table_visible = False - self._on_key_right () - self._invalidate () - return True - - - def _on_key_common (self, keyval): - if self._convert_begined: - i = 0 - for seg_index, text in self._segments: - self._context.commit_segment (i, seg_index) - self._commit_string (self._convert_chars) - self._input_chars += unichr (keyval) - self._cursor_pos += 1 - self._invalidate () - return True - - def _process_key_event (self, keyval, is_press, state): - # ignore key release events - if not is_press: - return False - - if keyval == keysyms.Return: - return self._on_key_return () - elif keyval == keysyms.Escape: - return self._on_key_escape () - elif keyval == keysyms.BackSpace: - return self._on_key_back_space () - elif keyval == keysyms.Delete or keyval == keysyms.KP_Delete: - return self._on_key_delete () - elif keyval == keysyms.space: - return self._on_key_space () - elif keyval >= keysyms._1 and keyval <= keysyms._9: - index = keyval - keysyms._1 - return self._on_key_number (index) - elif keyval == keysyms.Page_Up or keyval == keysyms.KP_Page_Up: - return self._on_key_page_up () - elif keyval == keysyms.Page_Down or keyval == keysyms.KP_Page_Down: - return self._on_key_page_down () - elif keyval == keysyms.Up: - return self._on_key_up () - elif keyval == keysyms.Down: - return self._on_key_down () - elif keyval == keysyms.Left: - return self._on_key_left () - elif keyval == keysyms.Right: - return self._on_key_right () - elif keyval in xrange (keysyms.a, keysyms.z + 1) or \ - keyval in xrange (keysyms.A, keysyms.Z + 1): - return self._on_key_common (keyval) - else: - return True - - return False - - def _property_activate (self, prop_name, state): - prop = self._prop_dict[prop_name] - prop.set_state (state) - - if state == ibus.PROP_STATE_CHECKED: - if prop_name == "InputMode.Hiragana": - prop = self._prop_dict["InputMode"] - prop.set_label (_("あ")) - self._input_mode = MODE_HIRAGANA - self._update_property (prop) - elif prop_name == "InputMode.Katakana": - prop = self._prop_dict["InputMode"] - prop.set_label (_("ア")) - self._input_mode = MODE_KATAKANA - self._update_property (prop) - elif prop_name == "InputMode.HalfWidthKatakana": - prop = self._prop_dict["InputMode"] - prop.set_label (_("ア")) - self._input_mode = MODE_HALF_WIDTH_KATAKANA - self._update_property (prop) - elif prop_name == "InputMode.Latin": - prop = self._prop_dict["InputMode"] - self._input_mode = MODE_LATIN - prop.set_label (_("A")) - self._update_property (prop) - elif prop_name == "InputMode.WideLatin": - prop = self._prop_dict["InputMode"] - prop.set_label (_("A")) - self._input_mode = MODE_WIDE_LATIN - self._update_property (prop) - - def _update_property (self, prop): - self.UpdateProperty (prop.to_dbus_value ()) - - # methods for dbus rpc - def ProcessKeyEvent (self, keyval, is_press, state): - try: - return self._process_key_event (keyval, is_press, state) - except Exception, e: - print e - return False - - def FocusIn (self): - self.RegisterProperties (self._prop_list.to_dbus_value ()) - print "FocusIn" - - def FocusOut (self): - print "FocusOut" - - def SetCursorLocation (self, x, y, w, h): - pass - - def Reset (self): - print "Reset" - - def PageUp (self): - self._page_up () - - def PageDown (self): - self._page_down () - - def CursorUp (self): - self._cursor_up () - - def CursorDown (self): - self._cursor_down () - - def SetEnable (self, enable): - self._enable = enable - if self._enable: - self.RegisterProperties (self._prop_list.to_dbus_value ()) - - def PropertyActivate (self, prop_name, prop_state): - self._property_activate (prop_name, prop_state) - - def Destroy (self): - print "Destroy" - diff --git a/engine/anthy/factory.py b/engine/anthy/factory.py deleted file mode 100644 index ca89fc5..0000000 --- a/engine/anthy/factory.py +++ /dev/null @@ -1,54 +0,0 @@ -# vim:set noet ts=4: -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -from ibus import interface -import engine - -FACTORY_PATH = "/com/redhat/IBus/engines/Anthy/Factory" -ENGINE_PATH = "/com/redhat/IBus/engines/Anthy/Engine/%d" - -class DemoEngineFactory (interface.IEngineFactory): - NAME = "Anthy" - LANG = "ja" - ICON = "ibus-anthy" - AUTHORS = "Huang Peng " - CREDITS = "GPLv2" - - def __init__ (self, dbusconn): - interface.IEngineFactory.__init__ (self, dbusconn, object_path = FACTORY_PATH) - self._dbusconn = dbusconn - self._max_engine_id = 1 - - def GetInfo (self): - return [ - self.NAME, - self.LANG, - self.ICON, - self.AUTHORS, - self.CREDITS - ] - - def CreateEngine (self): - engine_path = ENGINE_PATH % self._max_engine_id - self._max_engine_id += 1 - return engine.Engine (self._dbusconn, engine_path) - - diff --git a/engine/anthy/ibus-engine-anthy.in b/engine/anthy/ibus-engine-anthy.in deleted file mode 100644 index 8e1b2ca..0000000 --- a/engine/anthy/ibus-engine-anthy.in +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -python @prefix@/share/ibus/engine/anthy/main.py $@ - diff --git a/engine/anthy/main.py b/engine/anthy/main.py deleted file mode 100644 index be84968..0000000 --- a/engine/anthy/main.py +++ /dev/null @@ -1,84 +0,0 @@ -# vim:set noet ts=4: -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -import os -import sys -import getopt -import dbus -import dbus.connection -import dbus.mainloop.glib -import ibus -import factory -import gtk - -class IMApp: - def __init__ (self): - self._dbusconn = dbus.connection.Connection (ibus.IBUS_ADDR) - self._dbusconn.add_signal_receiver (self._disconnected_cb, - "Disconnected", - dbus_interface = dbus.LOCAL_IFACE) - self._engine = factory.DemoEngineFactory (self._dbusconn) - self._ibus = self._dbusconn.get_object (ibus.IBUS_NAME, ibus.IBUS_PATH) - self._ibus.RegisterFactories ([factory.FACTORY_PATH], **ibus.DEFAULT_ASYNC_HANDLERS) - - def run (self): - gtk.main () - - def _disconnected_cb (self): - print "disconnected" - gtk.main_quit () - - -def launch_engine (): - dbus.mainloop.glib.DBusGMainLoop (set_as_default=True) - IMApp ().run () - -def print_help (out, v = 0): - print >> out, "-h, --help show this message." - print >> out, "-d, --daemonize daemonize ibus" - sys.exit (v) - -def main (): - daemonize = False - shortopt = "hd" - longopt = ["help", "daemonize"] - try: - opts, args = getopt.getopt (sys.argv[1:], shortopt, longopt) - except getopt.GetoptError, err: - print_help (sys.stderr, 1) - - for o, a in opts: - if o in ("-h", "--help"): - print_help (sys.stdout) - elif o in ("-d", "--daemonize"): - daemonize = True - else: - print >> sys.stderr, "Unknown argument: %s" % o - print_help (sys.stderr, 1) - - if daemonize: - if os.fork (): - sys.exit () - - launch_engine () - -if __name__ == "__main__": - main () diff --git a/engine/anthy/tables.py b/engine/anthy/tables.py deleted file mode 100644 index 02a21ac..0000000 --- a/engine/anthy/tables.py +++ /dev/null @@ -1,351 +0,0 @@ -# vim:set noet ts=4: -# -*- encoding: utf-8 -*- -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -# string, result, cont -romaji_typing_rule = { - u"-" : u"ー", - u"a" : u"あ", - u"i" : u"い", - u"u" : u"う", - u"e" : u"え", - u"o" : u"お", - u"xa" : u"ぁ", - u"xi" : u"ぃ", - u"xu" : u"ぅ", - u"xe" : u"ぇ", - u"xo" : u"ぉ", - u"la" : u"ぁ", - u"li" : u"ぃ", - u"lu" : u"ぅ", - u"le" : u"ぇ", - u"lo" : u"ぉ", - u"wi" : u"うぃ", - u"we" : u"うぇ", - u"wha" : u"うぁ", - u"whi" : u"うぃ", - u"whe" : u"うぇ", - u"who" : u"うぉ", - u"va" : u"ヴぁ", - u"vi" : u"ヴぃ", - u"vu" : u"ヴ", - u"ve" : u"ヴぇ", - u"vo" : u"ヴぉ", - u"ka" : u"か", - u"ki" : u"き", - u"ku" : u"く", - u"ke" : u"け", - u"ko" : u"こ", - u"ga" : u"が", - u"gi" : u"ぎ", - u"gu" : u"ぐ", - u"ge" : u"げ", - u"go" : u"ご", - u"kya" : u"きゃ", - u"kyi" : u"きぃ", - u"kyu" : u"きゅ", - u"kye" : u"きぇ", - u"kyo" : u"きょ", - u"gya" : u"ぎゃ", - u"gyi" : u"ぎぃ", - u"gyu" : u"ぎゅ", - u"gye" : u"ぎぇ", - u"gyo" : u"ぎょ", - u"sa" : u"さ", - u"si" : u"し", - u"su" : u"す", - u"se" : u"せ", - u"so" : u"そ", - u"za" : u"ざ", - u"zi" : u"じ", - u"zu" : u"ず", - u"ze" : u"ぜ", - u"zo" : u"ぞ", - u"sya" : u"しゃ", - u"syi" : u"しぃ", - u"syu" : u"しゅ", - u"sye" : u"しぇ", - u"syo" : u"しょ", - u"sha" : u"しゃ", - u"shi" : u"し", - u"shu" : u"しゅ", - u"she" : u"しぇ", - u"sho" : u"しょ", - u"zya" : u"じゃ", - u"zyi" : u"じぃ", - u"zyu" : u"じゅ", - u"zye" : u"じぇ", - u"zyo" : u"じょ", - u"ja" : u"じゃ", - u"jya" : u"じゃ", - u"ji" : u"じ", - u"jyi" : u"じぃ", - u"ju" : u"じゅ", - u"jyu" : u"じゅ", - u"je" : u"じぇ", - u"jye" : u"じぇ", - u"jo" : u"じょ", - u"jyo" : u"じょ", - u"ta" : u"た", - u"ti" : u"ち", - u"tu" : u"つ", - u"tsu" : u"つ", - u"te" : u"て", - u"to" : u"と", - u"da" : u"だ", - u"di" : u"ぢ", - u"du" : u"づ", - u"de" : u"で", - u"do" : u"ど", - u"xtu" : u"っ", - u"xtsu" : u"っ", - u"ltu" : u"っ", - u"ltsu" : u"っ", - u"tya" : u"ちゃ", - u"tyi" : u"ちぃ", - u"tyu" : u"ちゅ", - u"tye" : u"ちぇ", - u"tyo" : u"ちょ", - u"cha" : u"ちゃ", - u"chi" : u"ち", - u"chu" : u"ちゅ", - u"che" : u"ちぇ", - u"cho" : u"ちょ", - u"dya" : u"ぢゃ", - u"dyi" : u"ぢぃ", - u"dyu" : u"ぢゅ", - u"dye" : u"ぢぇ", - u"dyo" : u"ぢょ", - u"tha" : u"てゃ", - u"thi" : u"てぃ", - u"thu" : u"てゅ", - u"the" : u"てぇ", - u"tho" : u"てょ", - u"dha" : u"でゃ", - u"dhi" : u"でぃ", - u"dhu" : u"でゅ", - u"dhe" : u"でぇ", - u"dho" : u"でょ", - u"na" : u"な", - u"ni" : u"に", - u"nu" : u"ぬ", - u"ne" : u"ね", - u"no" : u"の", - u"nya" : u"にゃ", - u"nyi" : u"にぃ", - u"nyu" : u"にゅ", - u"nye" : u"にぇ", - u"nyo" : u"にょ", - u"ha" : u"は", - u"hi" : u"ひ", - u"hu" : u"ふ", - u"fu" : u"ふ", - u"he" : u"へ", - u"ho" : u"ほ", - u"ba" : u"ば", - u"bi" : u"び", - u"bu" : u"ぶ", - u"be" : u"べ", - u"bo" : u"ぼ", - u"pa" : u"ぱ", - u"pi" : u"ぴ", - u"pu" : u"ぷ", - u"pe" : u"ぺ", - u"po" : u"ぽ", - u"hya" : u"ひゃ", - u"hyi" : u"ひぃ", - u"hyu" : u"ひゅ", - u"hye" : u"ひぇ", - u"hyo" : u"ひょ", - u"bya" : u"びゃ", - u"byi" : u"びぃ", - u"byu" : u"びゅ", - u"bye" : u"びぇ", - u"byo" : u"びょ", - u"pya" : u"ぴゃ", - u"pyi" : u"ぴぃ", - u"pyu" : u"ぴゅ", - u"pye" : u"ぴぇ", - u"pyo" : u"ぴょ", - u"fa" : u"ふぁ", - u"fi" : u"ふぃ", - u"fu" : u"ふ", - u"fe" : u"ふぇ", - u"fo" : u"ふぉ", - u"ma" : u"ま", - u"mi" : u"み", - u"mu" : u"む", - u"me" : u"め", - u"mo" : u"も", - u"mya" : u"みゃ", - u"myi" : u"みぃ", - u"myu" : u"みゅ", - u"mye" : u"みぇ", - u"myo" : u"みょ", - u"lya" : u"ゃ", - u"xya" : u"ゃ", - u"ya" : u"や", - u"lyu" : u"ゅ", - u"xyu" : u"ゅ", - u"yu" : u"ゆ", - u"lyo" : u"ょ", - u"xyo" : u"ょ", - u"yo" : u"よ", - u"ra" : u"ら", - u"ri" : u"り", - u"ru" : u"る", - u"re" : u"れ", - u"ro" : u"ろ", - u"rya" : u"りゃ", - u"ryi" : u"りぃ", - u"ryu" : u"りゅ", - u"rye" : u"りぇ", - u"ryo" : u"りょ", - u"xwa" : u"ゎ", - u"wa" : u"わ", - u"wo" : u"を", -# u"n'" : u"ん", - u"nn" : u"ん", - u"wyi" : u"ゐ", - u"wye" : u"ゑ", -} - -#hiragana, katakana, half_katakana -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"ゼ"), - 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"ブ"), - 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"ァ"), - 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"'"), - 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"_"), -} diff --git a/engine/anthy/test.py b/engine/anthy/test.py deleted file mode 100755 index cd67997..0000000 --- a/engine/anthy/test.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -import anthy -import sys - -ctx = anthy.anthy_context () -ctx._set_encoding (2) -if len(sys.argv) >= 2: - ctx.set_string (sys.argv[1]) -else: - ctx.set_string ("かまぁく") -conv_stat = anthy.anthy_conv_stat () -seg_stat = anthy.anthy_segment_stat () -ctx.get_stat (conv_stat) -for i in range (0, conv_stat.nr_segment): - ctx.get_segment_stat (i, seg_stat) - buf = " " - i = ctx.get_segment (i, 0, buf, 10) - print buf[:i] -# anthy.anthy_release_context (ctx) -ctx = None diff --git a/engine/enchant/.gitignore b/engine/enchant/.gitignore deleted file mode 100644 index 9c090bc..0000000 --- a/engine/enchant/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ibus-engine-enchant diff --git a/engine/enchant/Makefile.am b/engine/enchant/Makefile.am deleted file mode 100644 index 1c2329b..0000000 --- a/engine/enchant/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -# vim:set noet ts=4: -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -engine_enchant_PYTHON = \ - engine.py \ - factory.py \ - main.py \ - $(NULL) - -engine_enchantdir = $(pkgdatadir)/engine/enchant - -libexec_SCRIPTS = ibus-engine-enchant - -CLEANFILES = \ - *.pyc \ - $(NULL) - -EXTRA_DIST = \ - ibus-engine-enchant.in \ - $(NULL) - -test: - $(ENV) PYTHONPATH=$(top_srcdir) $(PYTHON) $(srcdir)/main.py - diff --git a/engine/enchant/engine.py b/engine/enchant/engine.py deleted file mode 100644 index 700d89a..0000000 --- a/engine/enchant/engine.py +++ /dev/null @@ -1,191 +0,0 @@ -# vim:set noet ts=4: -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -import gobject -import gtk -import pango -import dbus -import ibus -import enchant -from ibus import keysyms -from ibus import modifier -from ibus import interface - -class Engine (interface.IEngine): - _dict = enchant.Dict () - def __init__ (self, dbusconn, object_path): - interface.IEngine.__init__ (self, dbusconn, object_path) - self._dbusconn = dbusconn - self._is_invalidate = False - self._preedit_string = u"" - self._lookup_table = ibus.LookupTable () - self._prop_list = ibus.PropList () - self._prop_list.append (ibus.Property ("test", icon = "ibus-locale")) - - def _process_key_event (self, keyval, is_press, state): - # ignore key release events - if not is_press: - return False - - if self._preedit_string: - if keyval == keysyms.Return: - self._commit_string (self._preedit_string) - return True - elif keyval == keysyms.Escape: - self._preedit_string = u"" - self._update () - return True - elif keyval == keysyms.BackSpace: - self._preedit_string = self._preedit_string[:-1] - self._invalidate () - return True - elif keyval == keysyms.space: - if self._lookup_table.get_number_of_candidates () > 0: - self._commit_string (self._lookup_table.get_current_candidate ()[0]) - else: - self._commit_string (self._preedit_string) - return False - elif keyval >= keysyms._1 and keyval <= keysyms._9: - index = keyval - keysyms._1 - candidates = self._lookup_table.get_canidates_in_current_page () - if index >= len (candidates): - return False - candidate = candidates[index][0] - self._commit_string (candidate) - return True - elif keyval == keysyms.Page_Up or keyval == keysyms.KP_Page_Up: - if self._lookup_table.page_up (): - self._update_lookup_table () - return True - elif keyval == keysyms.Up: - self._cursor_up () - return True - elif keyval == keysyms.Down: - self._cursor_down () - return True - elif keyval == keysyms.Left or keyval == keysyms.Right: - return True - elif keyval == keysyms.Page_Down or keyval == keysyms.KP_Page_Down: - if self._lookup_table.page_down (): - self._update_lookup_table () - return True - if keyval in xrange (keysyms.a, keysyms.z + 1) or \ - keyval in xrange (keysyms.A, keysyms.Z + 1): - if state & (modifier.CONTROL_MASK | modifier.ALT_MASK) == 0: - self._preedit_string += unichr (keyval) - self._invalidate () - return True - else: - if keyval < 128 and self._preedit_string: - self._commit_string (self._preedit_string) - - return False - - def _invalidate (self): - if self._is_invalidate: - return - self._is_invalidate = True - gobject.idle_add (self._update, priority = gobject.PRIORITY_LOW) - - def _cursor_up (self): - if self._lookup_table.cursor_up (): - self._update_lookup_table () - return True - return False - - def _cursor_down (self): - if self._lookup_table.cursor_down (): - self._update_lookup_table () - return True - return False - - def _commit_string (self, text): - self.CommitString (text) - self._preedit_string = u"" - self._update () - - def _update (self): - preedit_len = len (self._preedit_string) - attrs = ibus.AttrList () - self._lookup_table.clean () - if preedit_len > 0: - if not self._dict.check (self._preedit_string): - attrs.append (ibus.AttributeForeground (0xff0000, 0, preedit_len)) - for text in self._dict.suggest (self._preedit_string): - self._lookup_table.append_candidate (text) - self.UpdateAuxString (self._preedit_string, attrs.to_dbus_value (), preedit_len > 0) - attrs.append (ibus.AttributeUnderline (pango.UNDERLINE_SINGLE, 0, preedit_len)) - self.UpdatePreedit (self._preedit_string, attrs.to_dbus_value (), dbus.Int32 (preedit_len), preedit_len > 0) - self._update_lookup_table () - self._is_invalidate = False - - def _update_lookup_table (self): - show = self._lookup_table.get_number_of_candidates () > 0 - self.UpdateLookupTable (self._lookup_table.to_dbus_value (), show) - - - # methods for dbus rpc - def ProcessKeyEvent (self, keyval, is_press, state): - try: - return self._process_key_event (keyval, is_press, state) - except Exception, e: - print e - return False - - def FocusIn (self): - self.RegisterProperties (self._prop_list.to_dbus_value ()) - print "FocusIn" - - def FocusOut (self): - print "FocusOut" - - def SetCursorLocation (self, x, y, w, h): - pass - - def Reset (self): - print "Reset" - - def PageUp (self): - print "PageUp" - - def PageDown (self): - print "PageDown" - - def CursorUp (self): - self._cursor_up () - - def CursorDown (self): - self._cursor_down () - - def SetEnable (self, enable): - self._enable = enable - if self._enable: - self.RegisterProperties (self._prop_list.to_dbus_value ()) - - def PropertyActivate (self, prop_name): - print "PropertyActivate (%s)" % prop_name - - def Destroy (self): - print "Destroy" - -class DemoEngine (Engine): - pass - diff --git a/engine/enchant/factory.py b/engine/enchant/factory.py deleted file mode 100644 index ddca013..0000000 --- a/engine/enchant/factory.py +++ /dev/null @@ -1,54 +0,0 @@ -# vim:set noet ts=4: -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -from ibus import interface -import engine - -FACTORY_PATH = "/com/redhat/IBus/engines/Demo/Factory" -ENGINE_PATH = "/com/redhat/IBus/engines/Demo/Engine/%d" - -class DemoEngineFactory (interface.IEngineFactory): - NAME = "Enchant" - LANG = "en" - ICON = "" - AUTHORS = "Huang Peng " - CREDITS = "GPLv2" - - def __init__ (self, dbusconn): - interface.IEngineFactory.__init__ (self, dbusconn, object_path = FACTORY_PATH) - self._dbusconn = dbusconn - self._max_engine_id = 1 - - def GetInfo (self): - return [ - self.NAME, - self.LANG, - self.ICON, - self.AUTHORS, - self.CREDITS - ] - - def CreateEngine (self): - engine_path = ENGINE_PATH % self._max_engine_id - self._max_engine_id += 1 - return engine.DemoEngine (self._dbusconn, engine_path) - - diff --git a/engine/enchant/ibus-engine-enchant.in b/engine/enchant/ibus-engine-enchant.in deleted file mode 100644 index 251160e..0000000 --- a/engine/enchant/ibus-engine-enchant.in +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -python @prefix@/share/ibus/engine/enchant/main.py $@ - diff --git a/engine/enchant/main.py b/engine/enchant/main.py deleted file mode 100644 index be84968..0000000 --- a/engine/enchant/main.py +++ /dev/null @@ -1,84 +0,0 @@ -# vim:set noet ts=4: -# -# ibus - The Input Bus -# -# Copyright (c) 2007-2008 Huang Peng -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library 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 Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this program; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA - -import os -import sys -import getopt -import dbus -import dbus.connection -import dbus.mainloop.glib -import ibus -import factory -import gtk - -class IMApp: - def __init__ (self): - self._dbusconn = dbus.connection.Connection (ibus.IBUS_ADDR) - self._dbusconn.add_signal_receiver (self._disconnected_cb, - "Disconnected", - dbus_interface = dbus.LOCAL_IFACE) - self._engine = factory.DemoEngineFactory (self._dbusconn) - self._ibus = self._dbusconn.get_object (ibus.IBUS_NAME, ibus.IBUS_PATH) - self._ibus.RegisterFactories ([factory.FACTORY_PATH], **ibus.DEFAULT_ASYNC_HANDLERS) - - def run (self): - gtk.main () - - def _disconnected_cb (self): - print "disconnected" - gtk.main_quit () - - -def launch_engine (): - dbus.mainloop.glib.DBusGMainLoop (set_as_default=True) - IMApp ().run () - -def print_help (out, v = 0): - print >> out, "-h, --help show this message." - print >> out, "-d, --daemonize daemonize ibus" - sys.exit (v) - -def main (): - daemonize = False - shortopt = "hd" - longopt = ["help", "daemonize"] - try: - opts, args = getopt.getopt (sys.argv[1:], shortopt, longopt) - except getopt.GetoptError, err: - print_help (sys.stderr, 1) - - for o, a in opts: - if o in ("-h", "--help"): - print_help (sys.stdout) - elif o in ("-d", "--daemonize"): - daemonize = True - else: - print >> sys.stderr, "Unknown argument: %s" % o - print_help (sys.stderr, 1) - - if daemonize: - if os.fork (): - sys.exit () - - launch_engine () - -if __name__ == "__main__": - main () diff --git a/ibus.spec.in b/ibus.spec.in index 2c4b75e..8408f59 100644 --- a/ibus.spec.in +++ b/ibus.spec.in @@ -33,26 +33,6 @@ Requires: %{name} = %{version}-%{release} %description qt This package contains ibus im module for qt4 -%package enchant -Summary: IBus enchant engine -Group: System Environment/Libraries -BuildRequires: python-enchant -Requires: %{name} = %{version}-%{release} python-enchant - -%description enchant -This package contains an enchant IM engine. - -%package anthy -Summary: Anthy japanese IM engine -Group: System Environment/Libraries -Requires: %{name} = %{version}-%{release} anthy - -%description anthy -This package contains the anthy IM engine - - -Requires: %{name}-xingma = %{version}-%{release} - %prep %setup -q @@ -88,7 +68,6 @@ rm -rf $RPM_BUILD_ROOT %dir %{_datadir}/ibus/icons/ %{_datadir}/ibus/daemon/* %{_datadir}/ibus/panel/* -%{_datadir}/ibus/engine/* %{_datadir}/ibus/icons/* %{_libexecdir}/ibus-daemon %{_libexecdir}/ibus-panel @@ -99,18 +78,6 @@ rm -rf $RPM_BUILD_ROOT %files qt %{_libdir}/qt4/plugins/inputmethods/libibus.so -%files enchant -%dir %{_datadir}/ibus/engine/enchant -%{_datadir}/ibus/engine/enchant/* -%{_libexecdir}/ibus-engine-enchant - -%files anthy -%{python_sitearch}/_anthy.so -%{python_sitearch}/anthy.* -%dir %{_datadir}/ibus/engine/anthy -%{_datadir}/ibus/engine/anthy/* -%{_libexecdir}/ibus-engine-anthy - %changelog * Wed Jun 25 2008 Huang Peng - 0.1.0-1 - The first version. diff --git a/icons/Makefile.am b/icons/Makefile.am index 667abe7..0f4b492 100644 --- a/icons/Makefile.am +++ b/icons/Makefile.am @@ -21,7 +21,6 @@ icons_DATA = \ engine-default.svg \ - ibus-anthy.png \ ibus-help.png \ ibus-keyboard.svg \ ibus-locale.svg \ @@ -32,7 +31,6 @@ iconsdir = $(pkgdatadir)/icons EXTRA_DIST = \ engine-default.svg \ - ibus-anthy.png \ ibus-help.png \ ibus-keyboard.svg \ ibus-locale.svg \ diff --git a/icons/ibus-anthy.png b/icons/ibus-anthy.png deleted file mode 100644 index 8d901880e0a9f01cf5ff2e14eedbc69efa78593d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1722 zcmV;r21WUaP)|wrp8BkOJ~@<>hj@_nzPWI6x7( ztS_0#l0C^U=bn3>^L)R*@Ar8*Klp$998E-$L}Y=8s9O!ZK}Ndww;ujr^vFwR?e6A* z8WCA`tH9UGxj#i@PoBswpIrXIYS~ftTj}^$U!#cVpLRU$Q!^MJ`WDB3>>?fkpfEQ` z+2RwNeB;7xz@7hn0u!NhV&gabm28EHj>iDppNW8oY?blQUnMg9iikWZBCdpQq~`yf zB@a&DMxrk2no3!{b!jh9o4_`o*s+~5@==A@_KPC&3lUlFJhbg^$nl@pvL{dM7Z%Fp z7oU}ZuHi}%F%k@>Npx(ty!TD%cDyT< zyEpHW5BFUNi^#ni!J|7k{ToF*g0jb19Qh-s_8!;>JT%vUN+}z|s%Bys(-mVl7GU{3 zU)ZUXs!E{QW7Phv8!#2^oKXhW3!*wM_`#?8DJS?EEvI#*>p8tE78bXUxk%9-Ft92jS=@sfc6BE zy68Ig6|^x_l1}lG7A~LazE?!d1OzHs`Zd8aAju(7*R&FVj683V>sD7~|V3&%S$fkY|<3EVYEx}TPz2Y6-QS23p%br$WtUH4?>{Rd_P0f3cJ|2V)%WGiVv&kMk$)74eejF& z{FYx!WGuRO4z)65^isW?ESK&BPsuYY_Db#krjctM*WVG5hegC$hDxb+%jys9JFC!# zID8-(J1*S5v7o}YD0Q<^>MfjBH8`FtMvCE0kquA?&{jhiOS zqPwA|-nnZ(1PAILWaZblkmQTe`g;>23T^{jI=D12b(Ep8`Oyl-+TGvt29`cexYony z5isJQd*}@&G1!;Fy2oc!^EvSnY;B#0+V5wxO5LL z^^RiDWB~#aqq!jfKz^w|2(%_7pp>#@eCP;<=W*18LtrXg+Kr%Y-BH4@Kuehn z3zQ2mK`9U$h|zQ=7t>=vH5$(>=IrSrni}#L9K8WcKQMkI7m75AF-L`_1Ob^W` z`vE8@^>+d-pO}DB3K9Eo?Zs_nZ@-#LD3mJ*@OEd8LEK!