aboutsummaryrefslogtreecommitdiffstats
path: root/vt100
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-20 23:01:19 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-20 23:01:19 -0400
commit524af9b4236ec347e9e783e57a166ed3eb1c600b (patch)
treede71489307fe3e2cd64b950efc76add08c01afec /vt100
parent75f19a202404ca6bd05021592ba608fe51797fad (diff)
downloadlibvt100-python-524af9b4236ec347e9e783e57a166ed3eb1c600b.tar.gz
libvt100-python-524af9b4236ec347e9e783e57a166ed3eb1c600b.zip
don't expose the vt100_color class
Diffstat (limited to 'vt100')
-rw-r--r--vt100/__init__.py28
1 files changed, 9 insertions, 19 deletions
diff --git a/vt100/__init__.py b/vt100/__init__.py
index d84a1e5..7b4fd6e 100644
--- a/vt100/__init__.py
+++ b/vt100/__init__.py
@@ -30,26 +30,16 @@ class vt100_color(Union):
("_id", c_uint32),
]
- def type(self):
- if self._type == 0:
- return "default"
- elif self._type == 1:
- return "indexed"
- elif self._type == 2:
- return "rgb"
- else:
- raise Exception("unknown color type: %d" % self._type)
-
def color(self):
- color_type = self.type()
- if color_type == "default":
+ color_type = self._type
+ if color_type == 0:
return None
- elif color_type == "indexed":
+ elif color_type == 1:
return self._idx
- elif color_type == "rgb":
+ elif color_type == 2:
return (self._r, self._g, self._b)
else:
- raise Exception("unknown color type: %s" % color_type)
+ raise Exception("unknown color type: %d" % color_type)
class vt100_named_attrs(Structure):
_fields_ = [
@@ -86,10 +76,10 @@ class vt100_cell(Structure):
return self._contents[:self._len].decode('utf-8')
def fgcolor(self):
- return self._attrs._fgcolor
+ return self._attrs._fgcolor.color()
def bgcolor(self):
- return self._attrs._bgcolor
+ return self._attrs._bgcolor.color()
def all_attrs(self):
return self._attrs._attrs
@@ -219,10 +209,10 @@ class vt100(object):
return icon_name_str[:self.screen._icon_name_len].decode('utf-8')
def default_fgcolor(self):
- return self.screen._attrs._fgcolor
+ return self.screen._attrs._fgcolor.color()
def default_bgcolor(self):
- return self.screen._attrs._bgcolor
+ return self.screen._attrs._bgcolor.color()
def all_default_attrs(self):
return self.screen._attrs._attrs