equal
deleted
inserted
replaced
3 |
3 |
4 from tuikit.common import Size, ClipStack, UnicodeGraphics |
4 from tuikit.common import Size, ClipStack, UnicodeGraphics |
5 |
5 |
6 |
6 |
7 class Driver: |
7 class Driver: |
8 |
8 |
9 '''Abstract driver interface. Use as base for drivers.''' |
9 '''Abstract driver interface. Use as base for drivers.''' |
10 |
10 |
11 def __init__(self): |
11 def __init__(self): |
12 '''Initialize instance attributes.''' |
12 '''Initialize instance attributes.''' |
|
13 #: Screen size. |
13 self.size = Size() |
14 self.size = Size() |
14 '''Screen size.''' |
15 #: Clipping region stack. |
15 self.clipstack = ClipStack() |
16 self.clipstack = ClipStack() |
16 '''Clipping region stack.''' |
17 #: Unicode graphics characters. |
17 self.unigraph = UnicodeGraphics() |
18 self.unigraph = UnicodeGraphics() |
18 '''Unicode graphics characters.''' |
19 #: Stack of color prefixes. |
19 self.colorprefix = [] |
20 self.colorprefix = [] |
20 '''Stack of color prefixes.''' |
|
21 |
21 |
22 |
22 |
23 ## drawing ## |
23 ## drawing ## |
24 |
24 |
25 def puts(self, x, y, s): |
25 def puts(self, x, y, s): |
26 '''Output string of characters.''' |
26 '''Output string of characters.''' |
27 for c in s: |
27 for c in s: |
28 self.putch(x, y, c) |
28 self.putch(x, y, c) |
29 x += 1 |
29 x += 1 |
57 self.vline(x, y+1, h-2, self.unigraph.VLINE) |
57 self.vline(x, y+1, h-2, self.unigraph.VLINE) |
58 self.vline(x+w-1, y+1, h-2, self.unigraph.VLINE) |
58 self.vline(x+w-1, y+1, h-2, self.unigraph.VLINE) |
59 |
59 |
60 |
60 |
61 ## colors ## |
61 ## colors ## |
62 |
62 |
63 def pushcolorprefix(self, name): |
63 def pushcolorprefix(self, name): |
64 self.colorprefix.append(name) |
64 self.colorprefix.append(name) |
65 |
65 |
66 def popcolorprefix(self): |
66 def popcolorprefix(self): |
67 self.colorprefix.pop() |
67 self.colorprefix.pop() |