summaryrefslogtreecommitdiffstats
path: root/ibus/attribute.py
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2008-08-19 12:58:06 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2008-08-19 12:58:06 +0800
commit8c6fae5ec47bb0684c88e891e66ea070b1d0af58 (patch)
tree7c1a53a19aa3fb52e1270fc32f08fd9da99be1a9 /ibus/attribute.py
parent7ce436b2e33f078c3a0628aa5c06e824b81ce302 (diff)
downloadibus-8c6fae5ec47bb0684c88e891e66ea070b1d0af58.tar.gz
ibus-8c6fae5ec47bb0684c88e891e66ea070b1d0af58.tar.xz
ibus-8c6fae5ec47bb0684c88e891e66ea070b1d0af58.zip
Refine code of attribue.py
Diffstat (limited to 'ibus/attribute.py')
-rw-r--r--ibus/attribute.py41
1 files changed, 29 insertions, 12 deletions
diff --git a/ibus/attribute.py b/ibus/attribute.py
index 5aac6b2..31f3240 100644
--- a/ibus/attribute.py
+++ b/ibus/attribute.py
@@ -50,16 +50,33 @@ ATTR_UNDERLINE_LOW = 3
class Attribute:
def __init__ (self, type, value, start_index, end_index):
- self._type = type
- self._value = value
- self._start_index = start_index
- self._end_index = end_index
+ self.__type = type
+ self.__value = value
+ self.__start_index = start_index
+ self.__end_index = end_index
+
+ def get_type(self):
+ return self.__type
+
+ def get_value(self):
+ return self.__value
+
+ def get_start_index(self):
+ return self.__start_index
+
+ def get_end_index(self):
+ return self.__end_index
+
+ type = property(get_type)
+ value = property(get_value)
+ start_index = property(get_start_index)
+ end_index = property(get_end_index)
def to_dbus_value (self):
- values = [dbus.UInt32 (self._type),
- dbus.UInt32 (self._value),
- dbus.UInt32 (self._start_index),
- dbus.UInt32 (self._end_index)]
+ values = [dbus.UInt32 (self.__type),
+ dbus.UInt32 (self.__value),
+ dbus.UInt32 (self.__start_index),
+ dbus.UInt32 (self.__end_index)]
return dbus.Array (values, signature="u")
def from_dbus_value (self, value):
@@ -69,10 +86,10 @@ class Attribute:
if len (value) != 4 or not all (map (lambda x: isinstance (x, dbus.UInt32), value)):
raise dbus.Exception ("Attribute must be dbus.Array (uuuu)")
- self._type = value[0]
- self._value = value[1]
- self._start_index = value[2]
- self._end_index = value[3]
+ self.__type = value[0]
+ self.__value = value[1]
+ self.__start_index = value[2]
+ self.__end_index = value[3]
def attribute_from_dbus_value (value):
attribute = Attribute (0, 0, 0, 0)