equal
deleted
inserted
replaced
25 |
25 |
26 def close(self): |
26 def close(self): |
27 """Clean up the screen etc.""" |
27 """Clean up the screen etc.""" |
28 pass |
28 pass |
29 |
29 |
30 def __enter__(self): |
|
31 self.init() |
|
32 |
|
33 def __exit__(self, exc_type, exc_val, exc_tb): |
|
34 self.close() |
|
35 |
|
36 ## drawing ## |
30 ## drawing ## |
37 |
31 |
38 def erase(self): |
32 def erase(self): |
39 pass |
33 pass |
40 |
34 |
54 |
48 |
55 def setattr(self, attr_desc): |
49 def setattr(self, attr_desc): |
56 """Set attribute to be used for subsequent draw operations.""" |
50 """Set attribute to be used for subsequent draw operations.""" |
57 pass |
51 pass |
58 |
52 |
59 def _parse_attr_desc(self, attr_desc): |
|
60 parts = attr_desc.split(',') |
|
61 fgbg = parts[0].split(' on ', 1) |
|
62 fg = fgbg[0].strip().lower() |
|
63 bg = fgbg[1:] and fgbg[1].strip().lower() or 'default' |
|
64 attrs = (part.strip().lower() for part in parts[1:]) |
|
65 return fg, bg, attrs |
|
66 |
|
67 ## cursor ## |
53 ## cursor ## |
68 |
54 |
69 def showcursor(self, x, y): |
55 def showcursor(self, x, y): |
70 pass |
56 pass |
71 |
57 |
82 Returns: |
68 Returns: |
83 [('event', param1, ...), ...] |
69 [('event', param1, ...), ...] |
84 |
70 |
85 """ |
71 """ |
86 return [] |
72 return [] |
|
73 |
|
74 ## convenience implementations ## |
|
75 |
|
76 def _parse_attr_desc(self, attr_desc): |
|
77 """Convenience implementation of attribute parsing. Not part of API.""" |
|
78 parts = attr_desc.split(',') |
|
79 fgbg = parts[0].split(' on ', 1) |
|
80 fg = fgbg[0].strip().lower() |
|
81 bg = fgbg[1:] and fgbg[1].strip().lower() or 'default' |
|
82 attrs = (part.strip().lower() for part in parts[1:]) |
|
83 return fg, bg, attrs |
|
84 |
|
85 ## with statement support ## |
|
86 |
|
87 def __enter__(self): |
|
88 self.init() |
|
89 |
|
90 def __exit__(self, exc_type, exc_val, exc_tb): |
|
91 self.close() |