Skip to content

Commit

Permalink
Add setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ueno committed Nov 8, 2009
1 parent f4a9032 commit ef5e430
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 16 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

SUBDIRS = \
engine \
setup \
icons \
m4 \
po \
Expand Down
27 changes: 27 additions & 0 deletions engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import ibus
from ibus import keysyms
from ibus import modifier
import os, os.path
import skk

from gettext import dgettext
Expand Down Expand Up @@ -58,6 +59,8 @@ def previous_candidate(self):
return self.__candidate

class Engine(ibus.EngineBase):
__setup_pid = 0

def __init__(self, bus, object_path):
super(Engine, self).__init__(bus, object_path)
self.__is_invalidate = False
Expand Down Expand Up @@ -107,6 +110,10 @@ def __init_props(self):
input_mode_prop.set_sub_props(props)
skk_props.append(input_mode_prop)

skk_props.append(ibus.Property(key=u"setup",
icon=u"ibus-setup",
tooltip=_(u"Configure SKK")))

return skk_props

def __input_mode_activate(self, prop_name, state):
Expand Down Expand Up @@ -258,6 +265,15 @@ def fill_lookup_table(self, candidates):
for candidate in candidates:
self.__lookup_table.append_candidate(ibus.Text(candidate))

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 = os.path.join(os.getenv('LIBEXECDIR'), 'ibus-setup-skk')
Engine.__setup_pid = os.spawnl(os.P_NOWAIT, setup_cmd, 'ibus-setup-skk')

def focus_in(self):
self.register_properties(self.__prop_list)

Expand All @@ -271,3 +287,14 @@ def property_activate(self, prop_name, state):
# print "PropertyActivate(%s, %d)" % (prop_name, state)
if state == ibus.PROP_STATE_CHECKED:
self.__input_mode_activate(prop_name, state)
else:
if prop_name == 'setup':
self.__start_setup()

@classmethod
def CONFIG_RELOADED(cls, bus):
print 'RELOADED'

@classmethod
def CONFIG_VALUE_CHANGED(cls, bus, section, name, value):
print 'VALUE_CHAMGED =', section, name, value
8 changes: 3 additions & 5 deletions engine/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class EngineFactory(ibus.EngineFactoryBase):

def __init__(self, bus):
self.__bus = bus
# engine.Engine.CONFIG_RELOADED(bus)
engine.Engine.CONFIG_RELOADED(bus)
super(EngineFactory, self).__init__(bus)

self.__id = 0
Expand All @@ -56,10 +56,8 @@ def create_engine(self, engine_name):
return super(EngineFactory, self).create_engine(engine_name)

def __config_reloaded_cb(self, config):
pass
# engine.Engine.CONFIG_RELOADED(self.__bus)
engine.Engine.CONFIG_RELOADED(self.__bus)

def __config_value_changed_cb(self, config, section, name, value):
pass
# engine.Engine.CONFIG_VALUE_CHANGED(self.__bus, section, name, value)
engine.Engine.CONFIG_VALUE_CHANGED(self.__bus, section, name, value)

4 changes: 4 additions & 0 deletions engine/skk.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ def __init__(self, filename='/usr/share/skk/SKK-JISYO.L',
self.__encoding = encoding
self.load()

path = property(lambda self: self.__path)

def load(self):
self.__okuri_ari = list()
self.__okuri_nasi = list()
Expand Down Expand Up @@ -411,6 +413,8 @@ def __init__(self, filename='~/.skk-ibus-jisyo',
self.__encoding = encoding
self.load()

path = property(lambda self: self.__path)

def load(self):
self.__dict = dict()
with open(self.__path, 'a+') as fp:
Expand Down
9 changes: 5 additions & 4 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
./python-config.py
./engine/main.py
./engine/engine.py
./engine/factory.py
python-config.py
engine/main.py
engine/engine.py
engine/factory.py
[type: gettext/glade]setup/ibus-skk-preferences.ui
46 changes: 39 additions & 7 deletions po/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ibus-skk 1.2.0.20091108\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-11-08 08:13+0900\n"
"POT-Creation-Date: 2009-11-08 16:45+0900\n"
"PO-Revision-Date: 2009-11-08 08:14+0900\n"
"Last-Translator: Daiki Ueno <ueno@unixuser.org>\n"
"Language-Team: Japanese\n"
Expand All @@ -17,26 +17,58 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"

#: engine/engine.py:85
#: ../engine/engine.py:88
msgid "Switch input mode"
msgstr "入力モード切替"

#: engine/engine.py:91
#: ../engine/engine.py:94
msgid "Hiragana"
msgstr "ひらがな"

#: engine/engine.py:94
#: ../engine/engine.py:97
msgid "Katakana"
msgstr "カタカナ"

#: engine/engine.py:97
#: ../engine/engine.py:100
msgid "Latin"
msgstr "英数"

#: engine/engine.py:100
#: ../engine/engine.py:103
msgid "Wide Latin"
msgstr "全角英数"

#: engine/factory.py:34
#: ../engine/engine.py:115
msgid "Configure SKK"
msgstr "SKKの設定"

#: ../engine/factory.py:34 ../setup/ibus-skk-preferences.ui.h:5
msgid "SKK"
msgstr "SKK"

#: ../setup/ibus-skk-preferences.ui.h:1
msgid "<b>Dictionaries</b>"
msgstr "<b>辞書</b>"

#: ../setup/ibus-skk-preferences.ui.h:2
msgid "<b>Others</b>"
msgstr "<b>その他</b>"

#: ../setup/ibus-skk-preferences.ui.h:3
msgid "About"
msgstr "情報"

#: ../setup/ibus-skk-preferences.ui.h:4
msgid "Period Style"
msgstr "句読点の形式"

#: ../setup/ibus-skk-preferences.ui.h:6
msgid "SKK input method for IBus"
msgstr "IBus入力プラットフォーム用SKKエンジン"

#: ../setup/ibus-skk-preferences.ui.h:7
msgid "System Dictionary"
msgstr "システム辞書"

#: ../setup/ibus-skk-preferences.ui.h:8
msgid "User Dictionary"
msgstr "ユーザ辞書"

0 comments on commit ef5e430

Please sign in to comment.