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="", hotkeys="", rank=0, symbol="", setup=""): | 34 def __init__(self, name="", longname="", description="", language="", |
| 35 license="", author="", icon="", layout="", hotkeys="", |
| 36 rank=0, symbol="", setup="", |
| 37 layout_variant="", layout_option=""): |
35 super(EngineDesc, self).__init__() | 38 super(EngineDesc, self).__init__() |
36 self.__name = name | 39 self.__name = name |
37 self.__longname = longname | 40 self.__longname = longname |
38 self.__description = description | 41 self.__description = description |
39 self.__language = language | 42 self.__language = language |
40 self.__license = license | 43 self.__license = license |
41 self.__author = author | 44 self.__author = author |
42 self.__icon = icon | 45 self.__icon = icon |
43 self.__layout = layout | 46 self.__layout = layout |
| 47 self.__layout_variant = layout_variant |
| 48 self.__layout_option = layout_option |
44 self.__rank = rank | 49 self.__rank = rank |
45 self.__hotkeys = hotkeys | 50 self.__hotkeys = hotkeys |
46 self.__symbol = symbol | 51 self.__symbol = symbol |
47 self.__setup = setup | 52 self.__setup = setup |
48 | 53 |
49 def get_name(self): | 54 def get_name(self): |
50 return self.__name | 55 return self.__name |
51 | 56 |
52 def get_longname(self): | 57 def get_longname(self): |
53 return self.__longname | 58 return self.__longname |
54 | 59 |
55 def get_description(self): | 60 def get_description(self): |
56 return self.__description | 61 return self.__description |
57 | 62 |
58 def get_language(self): | 63 def get_language(self): |
59 return self.__language | 64 return self.__language |
60 | 65 |
61 def get_license(self): | 66 def get_license(self): |
62 return self.__license | 67 return self.__license |
63 | 68 |
64 def get_author(self): | 69 def get_author(self): |
65 return self.__author | 70 return self.__author |
66 | 71 |
67 def get_icon(self): | 72 def get_icon(self): |
68 return self.__icon | 73 return self.__icon |
69 | 74 |
70 def get_layout(self): | 75 def get_layout(self): |
71 return self.__layout | 76 return self.__layout |
72 | 77 |
| 78 def get_layout_variant(self): |
| 79 return self.__layout_variant |
| 80 |
| 81 def get_layout_option(self): |
| 82 return self.__layout_option |
| 83 |
73 def get_rank(self): | 84 def get_rank(self): |
74 return self.__rank | 85 return self.__rank |
75 | 86 |
76 def get_hotkeys(self): | 87 def get_hotkeys(self): |
77 return self.__hotkeys | 88 return self.__hotkeys |
78 | 89 |
79 def get_symbol(self): | 90 def get_symbol(self): |
80 return self.__symbol | 91 return self.__symbol |
81 | 92 |
82 def get_setup(self): | 93 def get_setup(self): |
83 return self.__setup | 94 return self.__setup |
84 | 95 |
85 name = property(get_name) | 96 name = property(get_name) |
86 longname = property(get_longname) | 97 longname = property(get_longname) |
87 description = property(get_description) | 98 description = property(get_description) |
88 language = property(get_language) | 99 language = property(get_language) |
89 license = property(get_license) | 100 license = property(get_license) |
90 author = property(get_author) | 101 author = property(get_author) |
91 icon = property(get_icon) | 102 icon = property(get_icon) |
92 layout = property(get_layout) | 103 layout = property(get_layout) |
| 104 layout_variant = property(get_layout_variant) |
| 105 layout_option = property(get_layout_option) |
93 rank = property(get_rank) | 106 rank = property(get_rank) |
94 hotkeys = property(get_hotkeys) | 107 hotkeys = property(get_hotkeys) |
95 symbol = property(get_symbol) | 108 symbol = property(get_symbol) |
96 setup = property(get_setup) | 109 setup = property(get_setup) |
97 | 110 |
98 def serialize(self, struct): | 111 def serialize(self, struct): |
99 super(EngineDesc, self).serialize(struct) | 112 super(EngineDesc, self).serialize(struct) |
100 struct.append(dbus.String(self.__name)) | 113 struct.append(dbus.String(self.__name)) |
101 struct.append(dbus.String(self.__longname)) | 114 struct.append(dbus.String(self.__longname)) |
102 struct.append(dbus.String(self.__description)) | 115 struct.append(dbus.String(self.__description)) |
103 struct.append(dbus.String(self.__language)) | 116 struct.append(dbus.String(self.__language)) |
104 struct.append(dbus.String(self.__license)) | 117 struct.append(dbus.String(self.__license)) |
105 struct.append(dbus.String(self.__author)) | 118 struct.append(dbus.String(self.__author)) |
106 struct.append(dbus.String(self.__icon)) | 119 struct.append(dbus.String(self.__icon)) |
107 struct.append(dbus.String(self.__layout)) | 120 struct.append(dbus.String(self.__layout)) |
108 struct.append(dbus.UInt32(self.__rank)) | 121 struct.append(dbus.UInt32(self.__rank)) |
| 122 # Keep the serialize order. |
109 struct.append(dbus.String(self.__hotkeys)) | 123 struct.append(dbus.String(self.__hotkeys)) |
110 struct.append(dbus.String(self.__symbol)) | 124 struct.append(dbus.String(self.__symbol)) |
111 struct.append(dbus.String(self.__setup)) | 125 struct.append(dbus.String(self.__setup)) |
| 126 struct.append(dbus.String(self.__layout_variant)) |
| 127 struct.append(dbus.String(self.__layout_option)) |
112 | 128 |
113 def deserialize(self, struct): | 129 def deserialize(self, struct): |
114 super(EngineDesc, self).deserialize(struct) | 130 super(EngineDesc, self).deserialize(struct) |
115 self.__name = struct.pop(0) | 131 self.__name = struct.pop(0) |
116 self.__longname = struct.pop(0) | 132 self.__longname = struct.pop(0) |
117 self.__description = struct.pop(0) | 133 self.__description = struct.pop(0) |
118 self.__language = struct.pop(0) | 134 self.__language = struct.pop(0) |
119 self.__license = struct.pop(0) | 135 self.__license = struct.pop(0) |
120 self.__author = struct.pop(0) | 136 self.__author = struct.pop(0) |
121 self.__icon = struct.pop(0) | 137 self.__icon = struct.pop(0) |
122 self.__layout = struct.pop(0) | 138 self.__layout = struct.pop(0) |
123 self.__rank = struct.pop(0) | 139 self.__rank = struct.pop(0) |
| 140 # Keep the serialize order. |
124 self.__hotkeys = struct.pop(0) | 141 self.__hotkeys = struct.pop(0) |
125 self.__symbol = struct.pop(0) | 142 self.__symbol = struct.pop(0) |
126 self.__setup = struct.pop(0) | 143 self.__setup = struct.pop(0) |
| 144 self.__layout_variant = struct.pop(0) |
| 145 self.__layout_option = struct.pop(0) |
127 | 146 |
128 def test(): | 147 def test(): |
129 engine = EngineDesc("Hello", "", "", "", "", "", "", "", "", 0, "", "") | 148 engine = EngineDesc("Hello", "", "", "", "", "", "", "", "", 0, "", "") |
130 value = serialize_object(engine) | 149 value = serialize_object(engine) |
131 engine = deserialize_object(value) | 150 engine = deserialize_object(value) |
132 | 151 |
133 if __name__ == "__main__": | 152 if __name__ == "__main__": |
134 test() | 153 test() |
OLD | NEW |