summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2008-08-28 19:02:04 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2008-08-28 19:02:04 +0800
commit04e253668b792455afe722fc8ed849f663976e35 (patch)
treeb55fb1b6d4d015440120d5dadf6f9bf95422efd0
parent4a2a57d638f497c8d1366faceb800cf4117aeb77 (diff)
downloadibus-04e253668b792455afe722fc8ed849f663976e35.tar.gz
ibus-04e253668b792455afe722fc8ed849f663976e35.tar.xz
ibus-04e253668b792455afe722fc8ed849f663976e35.zip
Change defaul keyboard shortcuts
-rw-r--r--daemon/bus.py41
-rw-r--r--ibus/common.py19
-rw-r--r--po/ja.po25
-rw-r--r--po/zh_CN.po24
-rw-r--r--setup/main.py44
5 files changed, 104 insertions, 49 deletions
diff --git a/daemon/bus.py b/daemon/bus.py
index b8eee23..18c4619 100644
--- a/daemon/bus.py
+++ b/daemon/bus.py
@@ -31,9 +31,18 @@ from panel import Panel, DummyPanel
from config import Config, DefaultConfig
from register import Register
-CONFIG_GENERAL_SHORTCUT_TRIGGER = "/general/keyboard_shortcut_trigger"
-CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE = "/general/keyboard_shortcut_next_engine"
-CONFIG_GENERAL_SHORTCUT_PREV_ENGINE = "/general/keyboard_shortcut_prev_engine"
+CONFIG_GENERAL_SHORTCUT_TRIGGER = "/general/keyboard_shortcut_trigger"
+CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT = [
+ "Ctrl+space",
+ "Zenkaku_Hankaku",
+ "Hangul"]
+CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE = "/general/keyboard_shortcut_next_engine"
+CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT = [
+ "Ctrl+Shift+Release+Shift_L",
+ "Ctrl+Shift+Release+Shift_R",
+ ]
+CONFIG_GENERAL_SHORTCUT_PREV_ENGINE = "/general/keyboard_shortcut_prev_engine"
+CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT = []
class IBus(ibus.Object):
def __init__(self):
@@ -62,12 +71,14 @@ class IBus(ibus.Object):
self.__prev_key = None
self.__shortcut_trigger = self.__load_config_shortcut(
- CONFIG_GENERAL_SHORTCUT_TRIGGER, ["Ctrl+space"])
+ ibus.CONFIG_GENERAL_SHORTCUT_TRIGGER,
+ ibus.CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT)
self.__shortcut_next_engine = self.__load_config_shortcut(
- CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE,
- ["Ctrl+Shift+Release+Shift_L", "Ctrl+Shift+Release+Shift_R"])
+ ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE,
+ ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT)
self.__shortcut_prev_engine = self.__load_config_shortcut(
- CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE, [])
+ CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE,
+ CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT)
def __load_config_shortcut(self, config_key, default_value):
@@ -482,16 +493,18 @@ class IBus(ibus.Object):
conn.emit_dbus_signal("ConfigValueChanged", key, value)
# check daemon configure
- if key == CONFIG_GENERAL_SHORTCUT_TRIGGER:
+ if key == ibus.CONFIG_GENERAL_SHORTCUT_TRIGGER:
self.__shortcut_trigger = self.__load_config_shortcut(
- CONFIG_GENERAL_SHORTCUT_TRIGGER, ["Ctrl+space"])
- elif key == CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE:
+ ibus.CONFIG_GENERAL_SHORTCUT_TRIGGER,
+ ibus.CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT)
+ elif key == ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE:
self.__shortcut_next_engine = self.__load_config_shortcut(
- CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE,
- ["Ctrl+Shift+Release+Shift_L", "Ctrl+Shift+Release+Shift_R"])
- elif key == CONFIG_GENERAL_SHORTCUT_PREV_ENGINE:
+ ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE,
+ ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT)
+ elif key == ibus.CONFIG_GENERAL_SHORTCUT_PREV_ENGINE:
self.__shortcut_prev_engine = self.__load_config_shortcut(
- CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE, [])
+ ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE,
+ ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT)
def __config_destroy_cb(self, config):
if config == self.__config:
diff --git a/ibus/common.py b/ibus/common.py
index bd84862..11e8185 100644
--- a/ibus/common.py
+++ b/ibus/common.py
@@ -31,6 +31,12 @@ __all__ = (
"default_reply_handler",
"default_error_handler",
"DEFAULT_ASYNC_HANDLERS",
+ "CONFIG_GENERAL_SHORTCUT_TRIGGER",
+ "CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE",
+ "CONFIG_GENERAL_SHORTCUT_PREV_ENGINE",
+ "CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT",
+ "CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT",
+ "CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT",
"main",
"main_quit"
)
@@ -79,6 +85,19 @@ DEFAULT_ASYNC_HANDLERS = {
"error_handler" : default_error_handler
}
+CONFIG_GENERAL_SHORTCUT_TRIGGER = "/general/keyboard_shortcut_trigger"
+CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT = [
+ "Ctrl+space",
+ "Zenkaku_Hankaku",
+ "Hangul"]
+CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE = "/general/keyboard_shortcut_next_engine"
+CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT = [
+ "Ctrl+Shift+Release+Shift_L",
+ "Ctrl+Shift+Release+Shift_R",
+ ]
+CONFIG_GENERAL_SHORTCUT_PREV_ENGINE = "/general/keyboard_shortcut_prev_engine"
+CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT = []
+
__mainloop = None
def main():
diff --git a/po/ja.po b/po/ja.po
index 98aab25..410d22c 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -2,14 +2,13 @@
# Copyright (C) 2008 Huang Peng <shawn.p.huang@gmail.com>
# This file is distributed under the same license as the ibus package.
# UTUMI Hirosi <utuhiro78@yahoo.co.jp>, 2008.
-# , fuzzy
#
#
msgid ""
msgstr ""
"Project-Id-Version: ibus VERSION\n"
"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
-"POT-Creation-Date: 2008-08-27 17:45+0800\n"
+"POT-Creation-Date: 2008-08-28 19:00+0800\n"
"PO-Revision-Date: 2008-08-27 17:11+0900\n"
"Last-Translator: UTUMI Hirosi <utuhiro78@yahoo.co.jp>\n"
"Language-Team: Japanese <gnome-translation@gnome.gr.jp>\n"
@@ -389,23 +388,23 @@ msgstr "中国語 (繁体)"
msgid "iBus - Running"
msgstr "iBus - 実行中"
-#: setup/main.py:95
+#: setup/main.py:103
msgid "trigger"
msgstr "トリガー"
-#: setup/main.py:95
-msgid "next_engine"
+#: setup/main.py:113
+msgid "next engine"
msgstr "次のエンジン(_E)"
-#: setup/main.py:95
-msgid "prev_engine"
+#: setup/main.py:122
+msgid "prev engine"
msgstr "前のエンジン(_E)"
-#: setup/main.py:143
+#: setup/main.py:167
msgid "IBus daemon is not started. Do you want to start it now?"
msgstr "IBus デーモンが動いていません。起動しますか?"
-#: setup/main.py:159
+#: setup/main.py:182
msgid ""
"IBus has been started! If you can not use IBus, please add below lines in "
"$HOME/.bashrc, and relogin your desktop.\n"
@@ -414,19 +413,19 @@ msgid ""
" export QT_IM_MODULE=ibus"
msgstr ""
-#: setup/main.py:182 setup/setup.glade:365
+#: setup/main.py:204 setup/setup.glade:365
msgid "Engine"
msgstr "エンジン"
-#: setup/main.py:206
+#: setup/main.py:228
msgid "Started"
msgstr "開始"
-#: setup/main.py:215
+#: setup/main.py:237
msgid "Preload"
msgstr "プリロード"
-#: setup/main.py:224
+#: setup/main.py:246
#, python-format
msgid "Select keyboard shortcut for %s"
msgstr "%s のキーボードショートカットを選択"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index b098400..7a65928 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1.1.20080813\n"
"Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
-"POT-Creation-Date: 2008-08-27 17:45+0800\n"
+"POT-Creation-Date: 2008-08-28 19:00+0800\n"
"PO-Revision-Date: 2008-08-13 21:59+0800\n"
"Last-Translator: Huang Peng <shawn.p.huang@gmail.com>\n"
"Language-Team: Huang Peng <shawn.p.huang@gmail.com>\n"
@@ -387,23 +387,23 @@ msgstr "繁体中文"
msgid "iBus - Running"
msgstr "iBus - 运行"
-#: setup/main.py:95
+#: setup/main.py:103
msgid "trigger"
msgstr "开关"
-#: setup/main.py:95
-msgid "next_engine"
+#: setup/main.py:113
+msgid "next engine"
msgstr "下一个引擎"
-#: setup/main.py:95
-msgid "prev_engine"
+#: setup/main.py:122
+msgid "prev engine"
msgstr "上一个引擎"
-#: setup/main.py:143
+#: setup/main.py:167
msgid "IBus daemon is not started. Do you want to start it now?"
msgstr "IBus守护进程没有启动,您是否想现在启动它?"
-#: setup/main.py:159
+#: setup/main.py:182
msgid ""
"IBus has been started! If you can not use IBus, please add below lines in "
"$HOME/.bashrc, and relogin your desktop.\n"
@@ -416,19 +416,19 @@ msgstr ""
" export XMODIFIERS=@im=ibus\n"
" export QT_IM_MODULE=ibus"
-#: setup/main.py:182 setup/setup.glade:365
+#: setup/main.py:204 setup/setup.glade:365
msgid "Engine"
msgstr "输入法引擎"
-#: setup/main.py:206
+#: setup/main.py:228
msgid "Started"
msgstr "启动"
-#: setup/main.py:215
+#: setup/main.py:237
msgid "Preload"
msgstr "预加载"
-#: setup/main.py:224
+#: setup/main.py:246
#, python-format
msgid "Select keyboard shortcut for %s"
msgstr "选择%s的快捷键"
diff --git a/setup/main.py b/setup/main.py
index e5a273a..895a140 100644
--- a/setup/main.py
+++ b/setup/main.py
@@ -92,12 +92,36 @@ class Setup(object):
self.__checkbutton_auto_start.connect("toggled", self.__checkbutton_auto_start_toggled_cb)
# keyboard shortcut
- for name in (N_("trigger"), N_("next_engine"), N_("prev_engine")):
- shortcuts = self.__bus.config_get_value(CONFIG_GENERAL_SHORTCUT % name, [])
- button = self.__xml.get_widget("button_%s" % name)
- entry = self.__xml.get_widget("entry_%s" % name)
- entry.set_text(";".join(shortcuts))
- button.connect("clicked", self.__shortcut_button_clicked_cb, name, entry)
+ # trigger
+ shortcuts = self.__bus.config_get_value(
+ ibus.CONFIG_GENERAL_SHORTCUT_TRIGGER,
+ ibus.CONFIG_GENERAL_SHORTCUT_TRIGGER_DEFAULT)
+ button = self.__xml.get_widget("button_trigger")
+ entry = self.__xml.get_widget("entry_trigger")
+ entry.set_text("; ".join(shortcuts))
+ button.connect("clicked", self.__shortcut_button_clicked_cb,
+ N_("trigger"), ibus.CONFIG_GENERAL_SHORTCUT_TRIGGER, entry)
+
+ # next engine
+ shortcuts = self.__bus.config_get_value(
+ ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE,
+ ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE_DEFAULT)
+ button = self.__xml.get_widget("button_next_engine")
+ entry = self.__xml.get_widget("entry_next_engine")
+ entry.set_text("; ".join(shortcuts))
+ button.connect("clicked", self.__shortcut_button_clicked_cb,
+ N_("next engine"), ibus.CONFIG_GENERAL_SHORTCUT_NEXT_ENGINE, entry)
+ # prev engine
+ shortcuts = self.__bus.config_get_value(
+ ibus.CONFIG_GENERAL_SHORTCUT_PREV_ENGINE,
+ ibus.CONFIG_GENERAL_SHORTCUT_PREV_ENGINE_DEFAULT)
+ button = self.__xml.get_widget("button_prev_engine")
+ entry = self.__xml.get_widget("entry_prev_engine")
+ entry.set_text("; ".join(shortcuts))
+ button.connect("clicked", self.__shortcut_button_clicked_cb,
+ N_("prev engine"), ibus.CONFIG_GENERAL_SHORTCUT_PREV_ENGINE, entry)
+
+
# lookup table orientation
self.__combobox_lookup_table_orientation = self.__xml.get_widget("combobox_lookup_table_orientation")
@@ -217,13 +241,13 @@ class Setup(object):
column = gtk.TreeViewColumn("", renderer)
self.__tree.append_column(column)
- def __shortcut_button_clicked_cb(self, button, name, entry):
+ def __shortcut_button_clicked_cb(self, button, name, key, entry):
buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK)
title = _("Select keyboard shortcut for %s") % _(name)
dialog = keyboardshortcut.KeyboardShortcutSelectionDialog(buttons = buttons, title = title)
text = entry.get_text()
if text:
- shortcuts = text.split(';')
+ shortcuts = text.split("; ")
else:
shortcuts = None
dialog.set_shortcuts(shortcuts)
@@ -232,8 +256,8 @@ class Setup(object):
dialog.destroy()
if id != gtk.RESPONSE_OK:
return
- self.__bus.config_set_value(CONFIG_GENERAL_SHORTCUT % name, shortcuts)
- entry.set_text(";".join(shortcuts))
+ self.__bus.config_set_value(key, shortcuts)
+ entry.set_text("; ".join(shortcuts))
def __item_started_column_toggled_cb(self, cell, path_str, model):