1 # vim:set et sts=4 sw=4:
5 # Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
6 # Copyright (c) 2007-2010 Red Hat, Inc.
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2 of the License, or (at your option) any later version.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this program; if not, write to the
20 # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
21 # Boston, MA 02111-1307 USA
28 from exception import IBusException
29 from serializable import *
31 class EngineDesc(Serializable):
32 __gtype_name__ = "PYIBusEngineDesc"
33 __NAME__ = "IBusEngineDesc"
34 def __init__(self, name="", longname="", description="", language="", license="", author="", icon="", layout="", rank=0):
35 super(EngineDesc, self).__init__()
37 self.__longname = longname
38 self.__description = description
39 self.__language = language
40 self.__license = license
41 self.__author = author
43 self.__layout = layout
49 def get_longname(self):
50 return self.__longname
52 def get_description(self):
53 return self.__description
55 def get_language(self):
56 return self.__language
58 def get_license(self):
73 name = property(get_name)
74 longname = property(get_longname)
75 description = property(get_description)
76 language = property(get_language)
77 license = property(get_license)
78 author = property(get_author)
79 icon = property(get_icon)
80 layout = property(get_layout)
81 rank = property(get_rank)
83 def serialize(self, struct):
84 super(EngineDesc, self).serialize(struct)
85 struct.append(dbus.String(self.__name))
86 struct.append(dbus.String(self.__longname))
87 struct.append(dbus.String(self.__description))
88 struct.append(dbus.String(self.__language))
89 struct.append(dbus.String(self.__license))
90 struct.append(dbus.String(self.__author))
91 struct.append(dbus.String(self.__icon))
92 struct.append(dbus.String(self.__layout))
93 struct.append(dbus.UInt32(self.__rank))
95 def deserialize(self, struct):
96 super(EngineDesc, self).deserialize(struct)
97 self.__name = struct.pop(0)
98 self.__longname = struct.pop(0)
99 self.__description = struct.pop(0)
100 self.__language = struct.pop(0)
101 self.__license = struct.pop(0)
102 self.__author = struct.pop(0)
103 self.__icon = struct.pop(0)
104 self.__layout = struct.pop(0)
105 self.__rank = struct.pop(0)
108 engine = EngineDesc("Hello", "", "", "", "", "", "", "")
109 value = serialize_object(engine)
110 engine = deserialize_object(value)
112 if __name__ == "__main__":