/usr/share/pyshared/ibus/component.py is in python-ibus 1.4.1-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | # vim:set et sts=4 sw=4:
#
# ibus - The Input Bus
#
# Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
# Copyright (c) 2007-2010 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
__all__ = (
"Component",
)
import dbus
from exception import IBusException
from serializable import *
from enginedesc import *
from observedpath import *
class Component(Serializable):
__gtype_name__ = "PYIBusComponent"
__NAME__ = "IBusComponent"
def __init__ (self, name="", description="", version="", license="", author="", homepage="", _exec="", textdomain=""):
super(Component, self).__init__()
self.__name = name
self.__description = description
self.__version = version
self.__license = license
self.__author = author
self.__homepage = homepage
self.__exec = _exec
self.__textdomain = textdomain
self.__observed_paths = []
self.__engines = []
def get_name(self):
return self.__name
def get_description(self):
return self.__description
def get_version(self):
return self.__version
def get_license(self):
return self.__license
def get_author(self):
return self.__author
def get_homepage(self):
return self.__homepage
def get_exec(self):
return self.__exec
def get_textdomain(self):
return self.__textdomain
def get_observed_paths(self):
return self.__observed_paths[:]
def get_engines(self):
return self.__engines[:]
name = property(get_name)
description = property(get_description)
version = property(get_version)
license = property(get_license)
author = property(get_author)
homepage = property(get_homepage)
_exec = property(get_exec)
textdomain = property(get_textdomain)
observed_paths = property(get_observed_paths)
engines = property(get_engines)
def add_observed_path(self, path):
self.__observed_paths.append(ObservedPath(path))
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 add_engines(self, engines):
if not isinstance(engines, list):
raise TypeError("engines must be an instance of list")
self.__engines.extend(engines)
def serialize(self, struct):
super(Component, self).serialize(struct)
struct.append (dbus.String(self.__name))
struct.append (dbus.String(self.__description))
struct.append (dbus.String(self.__version))
struct.append (dbus.String(self.__license))
struct.append (dbus.String(self.__author))
struct.append (dbus.String(self.__homepage))
struct.append (dbus.String(self.__exec))
struct.append (dbus.String(self.__textdomain))
struct.append (dbus.Array(map(serialize_object,self.__observed_paths), signature="v"))
struct.append (dbus.Array(map(serialize_object,self.__engines), signature="v"))
def deserialize(self, struct):
super(Component, self).deserialize(struct)
self.__name = struct.pop(0)
self.__description = struct.pop(0)
self.__version = struct.pop(0)
self.__license = struct.pop(0)
self.__author = struct.pop(0)
self.__homepage = struct.pop(0)
self.__exec = struct.pop(0)
self.__textdomain = struct.pop(0)
self.__observed_paths = map(deserialize_object, struct.pop(0))
self.__engines = map(deserialize_object, struct.pop(0))
def test():
text = Component("Hello", "", "", "", "", "", "", "")
value = serialize_object(text)
text= deserialize_object(value)
if __name__ == "__main__":
test()
|