summaryrefslogtreecommitdiff
path: root/ibus
diff options
context:
space:
mode:
authorJames Su <james.su@gmail.com>2010-05-11 13:41:59 -0700
committerPeng Huang <shawn.p.huang@gmail.com>2010-07-31 14:03:37 +0800
commite2793f52bf3da7a22321f053f3ba8154026fd6fa (patch)
tree5e212bc2eac3dad3772f6e72e2dd4a4d71270bcb /ibus
parent1350806a4d1a23036ea7e4dac9e0169b77127cb1 (diff)
downloadibus-e2793f52bf3da7a22321f053f3ba8154026fd6fa.tar.gz
Support engine specific hotkey.
BUG=http://crosbug.com/2543 TEST=none With this CL, each engine can specify one or more special activation hotkeys. This CL doesn't support customizing global hotkeys per engine. I'd still prefer to customize the global hotkeys based on current locale rather than input method engine. Add hotkeys property to IBusEngineDesc, so that each engine can specify their own special hotkeys. This is useful for input methods that have dedicated hotkeys, such as Japanese input methods, which has a dedicated hotkey key: Kana. Review URL: http://codereview.chromium.org/1702015
Diffstat (limited to 'ibus')
-rw-r--r--ibus/component.py4
-rw-r--r--ibus/enginedesc.py13
2 files changed, 12 insertions, 5 deletions
diff --git a/ibus/component.py b/ibus/component.py
index 47db7305..a662b706 100644
--- a/ibus/component.py
+++ b/ibus/component.py
@@ -90,8 +90,8 @@ class Component(Serializable):
def add_observed_path(self, path):
self.__observed_paths.append(ObservedPath(path))
- def add_engine(self, name="", longname="", description="", language="", license="", author="", icon="", layout=""):
- engine = EngineDesc(name, longname, description, language, license, author, icon, layout)
+ def add_engine(self, name="", longname="", description="", language="", license="", author="", icon="", layout="", hotkeys=""):
+ engine = EngineDesc(name, longname, description, language, license, author, icon, layout, hotkeys)
self.__engines.append(engine)
def serialize(self, struct):
diff --git a/ibus/enginedesc.py b/ibus/enginedesc.py
index 3193932a..d8ba28b5 100644
--- a/ibus/enginedesc.py
+++ b/ibus/enginedesc.py
@@ -31,7 +31,7 @@ from serializable import *
class EngineDesc(Serializable):
__gtype_name__ = "PYIBusEngineDesc"
__NAME__ = "IBusEngineDesc"
- def __init__(self, name="", longname="", description="", language="", license="", author="", icon="", layout="", rank=0):
+ def __init__(self, name="", longname="", description="", language="", license="", author="", icon="", layout="", hotkeys="", rank=0):
super(EngineDesc, self).__init__()
self.__name = name
self.__longname = longname
@@ -41,7 +41,8 @@ class EngineDesc(Serializable):
self.__author = author
self.__icon = icon
self.__layout = layout
- self.__rank = rank;
+ self.__hotkeys = hotkeys
+ self.__rank = rank
def get_name(self):
return self.__name
@@ -67,6 +68,9 @@ class EngineDesc(Serializable):
def get_layout(self):
return self.__layout
+ def get_hotkeys(self):
+ return self.__hotkeys
+
def get_rank(self):
return self.__rank
@@ -78,6 +82,7 @@ class EngineDesc(Serializable):
author = property(get_author)
icon = property(get_icon)
layout = property(get_layout)
+ hotkeys = property(get_hotkeys)
rank = property(get_rank)
def serialize(self, struct):
@@ -90,6 +95,7 @@ class EngineDesc(Serializable):
struct.append(dbus.String(self.__author))
struct.append(dbus.String(self.__icon))
struct.append(dbus.String(self.__layout))
+ struct.append(dbus.String(self.__hotkeys))
struct.append(dbus.UInt32(self.__rank))
def deserialize(self, struct):
@@ -102,10 +108,11 @@ class EngineDesc(Serializable):
self.__author = struct.pop(0)
self.__icon = struct.pop(0)
self.__layout = struct.pop(0)
+ self.__hotkeys = struct.pop(0)
self.__rank = struct.pop(0)
def test():
- engine = EngineDesc("Hello", "", "", "", "", "", "", "")
+ engine = EngineDesc("Hello", "", "", "", "", "", "", "", "")
value = serialize_object(engine)
engine = deserialize_object(value)