| OLD | NEW |
| 1 # vim:set et sts=4 sw=4: | 1 # vim:set et sts=4 sw=4: |
| 2 # | 2 # |
| 3 # ibus - The Input Bus | 3 # ibus - The Input Bus |
| 4 # | 4 # |
| 5 # Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com> | 5 # Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com> |
| 6 # Copyright (c) 2007-2010 Red Hat, Inc. | 6 # Copyright (c) 2007-2010 Red Hat, Inc. |
| 7 # | 7 # |
| 8 # This library is free software; you can redistribute it and/or | 8 # This library is free software; you can redistribute it and/or |
| 9 # modify it under the terms of the GNU Lesser General Public | 9 # modify it under the terms of the GNU Lesser General Public |
| 10 # License as published by the Free Software Foundation; either | 10 # License as published by the Free Software Foundation; either |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 "EngineDesc", | 24 "EngineDesc", |
| 25 ) | 25 ) |
| 26 | 26 |
| 27 import dbus | 27 import dbus |
| 28 from exception import IBusException | 28 from exception import IBusException |
| 29 from serializable import * | 29 from serializable import * |
| 30 | 30 |
| 31 class EngineDesc(Serializable): | 31 class EngineDesc(Serializable): |
| 32 __gtype_name__ = "PYIBusEngineDesc" | 32 __gtype_name__ = "PYIBusEngineDesc" |
| 33 __NAME__ = "IBusEngineDesc" | 33 __NAME__ = "IBusEngineDesc" |
| 34 def __init__(self, name="", longname="", description="", language="", licens
e="", author="", icon="", layout="", rank=0): | 34 def __init__(self, name="", longname="", description="", language="", licens
e="", author="", icon="", layout="", hotkeys="", rank=0): |
| 35 super(EngineDesc, self).__init__() | 35 super(EngineDesc, self).__init__() |
| 36 self.__name = name | 36 self.__name = name |
| 37 self.__longname = longname | 37 self.__longname = longname |
| 38 self.__description = description | 38 self.__description = description |
| 39 self.__language = language | 39 self.__language = language |
| 40 self.__license = license | 40 self.__license = license |
| 41 self.__author = author | 41 self.__author = author |
| 42 self.__icon = icon | 42 self.__icon = icon |
| 43 self.__layout = layout | 43 self.__layout = layout |
| 44 self.__rank = rank; | 44 self.__hotkeys = hotkeys |
| 45 self.__rank = rank |
| 45 | 46 |
| 46 def get_name(self): | 47 def get_name(self): |
| 47 return self.__name | 48 return self.__name |
| 48 | 49 |
| 49 def get_longname(self): | 50 def get_longname(self): |
| 50 return self.__longname | 51 return self.__longname |
| 51 | 52 |
| 52 def get_description(self): | 53 def get_description(self): |
| 53 return self.__description | 54 return self.__description |
| 54 | 55 |
| 55 def get_language(self): | 56 def get_language(self): |
| 56 return self.__language | 57 return self.__language |
| 57 | 58 |
| 58 def get_license(self): | 59 def get_license(self): |
| 59 return self.__license | 60 return self.__license |
| 60 | 61 |
| 61 def get_author(self): | 62 def get_author(self): |
| 62 return self.__author | 63 return self.__author |
| 63 | 64 |
| 64 def get_icon(self): | 65 def get_icon(self): |
| 65 return self.__icon | 66 return self.__icon |
| 66 | 67 |
| 67 def get_layout(self): | 68 def get_layout(self): |
| 68 return self.__layout | 69 return self.__layout |
| 69 | 70 |
| 71 def get_hotkeys(self): |
| 72 return self.__hotkeys |
| 73 |
| 70 def get_rank(self): | 74 def get_rank(self): |
| 71 return self.__rank | 75 return self.__rank |
| 72 | 76 |
| 73 name = property(get_name) | 77 name = property(get_name) |
| 74 longname = property(get_longname) | 78 longname = property(get_longname) |
| 75 description = property(get_description) | 79 description = property(get_description) |
| 76 language = property(get_language) | 80 language = property(get_language) |
| 77 license = property(get_license) | 81 license = property(get_license) |
| 78 author = property(get_author) | 82 author = property(get_author) |
| 79 icon = property(get_icon) | 83 icon = property(get_icon) |
| 80 layout = property(get_layout) | 84 layout = property(get_layout) |
| 85 hotkeys = property(get_hotkeys) |
| 81 rank = property(get_rank) | 86 rank = property(get_rank) |
| 82 | 87 |
| 83 def serialize(self, struct): | 88 def serialize(self, struct): |
| 84 super(EngineDesc, self).serialize(struct) | 89 super(EngineDesc, self).serialize(struct) |
| 85 struct.append(dbus.String(self.__name)) | 90 struct.append(dbus.String(self.__name)) |
| 86 struct.append(dbus.String(self.__longname)) | 91 struct.append(dbus.String(self.__longname)) |
| 87 struct.append(dbus.String(self.__description)) | 92 struct.append(dbus.String(self.__description)) |
| 88 struct.append(dbus.String(self.__language)) | 93 struct.append(dbus.String(self.__language)) |
| 89 struct.append(dbus.String(self.__license)) | 94 struct.append(dbus.String(self.__license)) |
| 90 struct.append(dbus.String(self.__author)) | 95 struct.append(dbus.String(self.__author)) |
| 91 struct.append(dbus.String(self.__icon)) | 96 struct.append(dbus.String(self.__icon)) |
| 92 struct.append(dbus.String(self.__layout)) | 97 struct.append(dbus.String(self.__layout)) |
| 98 struct.append(dbus.String(self.__hotkeys)) |
| 93 struct.append(dbus.UInt32(self.__rank)) | 99 struct.append(dbus.UInt32(self.__rank)) |
| 94 | 100 |
| 95 def deserialize(self, struct): | 101 def deserialize(self, struct): |
| 96 super(EngineDesc, self).deserialize(struct) | 102 super(EngineDesc, self).deserialize(struct) |
| 97 self.__name = struct.pop(0) | 103 self.__name = struct.pop(0) |
| 98 self.__longname = struct.pop(0) | 104 self.__longname = struct.pop(0) |
| 99 self.__description = struct.pop(0) | 105 self.__description = struct.pop(0) |
| 100 self.__language = struct.pop(0) | 106 self.__language = struct.pop(0) |
| 101 self.__license = struct.pop(0) | 107 self.__license = struct.pop(0) |
| 102 self.__author = struct.pop(0) | 108 self.__author = struct.pop(0) |
| 103 self.__icon = struct.pop(0) | 109 self.__icon = struct.pop(0) |
| 104 self.__layout = struct.pop(0) | 110 self.__layout = struct.pop(0) |
| 111 self.__hotkeys = struct.pop(0) |
| 105 self.__rank = struct.pop(0) | 112 self.__rank = struct.pop(0) |
| 106 | 113 |
| 107 def test(): | 114 def test(): |
| 108 engine = EngineDesc("Hello", "", "", "", "", "", "", "") | 115 engine = EngineDesc("Hello", "", "", "", "", "", "", "", "") |
| 109 value = serialize_object(engine) | 116 value = serialize_object(engine) |
| 110 engine = deserialize_object(value) | 117 engine = deserialize_object(value) |
| 111 | 118 |
| 112 if __name__ == "__main__": | 119 if __name__ == "__main__": |
| 113 test() | 120 test() |
| OLD | NEW |