Fix original modules and demos.
authorRadek Brich <radek.brich@devl.cz>
Fri, 14 Mar 2014 18:23:23 +0100
changeset 82 2bead23b1262
parent 81 5cd40c30c4f2
child 83 ebe732b9ef19
Fix original modules and demos.
tuikit/driver.py
tuikit/driver_base.py
tuikit/driver_curses.py
tuikit/driver_dummy.py
tuikit/driver_sdl.py
--- a/tuikit/driver.py	Fri Mar 14 10:30:43 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-# -*- coding: utf-8 -*-
-'''Tuikit driver base.'''
-
-from tuikit.common import Size, ClipStack, UnicodeGraphics
-
-
-class Driver:
-
-    '''Abstract driver interface. Use as base for drivers.'''
-
-    def __init__(self):
-        '''Initialize instance attributes.'''
-        #: Screen size.
-        self.size = Size()
-        #: Clipping region stack.
-        self.clipstack = ClipStack()
-        #: Unicode graphics characters.
-        self.unigraph = UnicodeGraphics()
-        #: Stack of color prefixes.
-        self.colorprefix = []
-
-
-    ## drawing ##
-
-    def puts(self, x, y, s):
-        '''Output string of characters.'''
-        for c in s:
-            self.putch(x, y, c)
-            x += 1
-
-    def hline(self, x, y, w, c=' '):
-        '''Draw horizontal line.'''
-        if isinstance(c, str):
-            s = c*w
-        else:
-            s = [c]*w
-        self.puts(x, y, s)
-
-    def vline(self, x, y, h, c=' '):
-        '''Draw vertical line.'''
-        for i in range(h):
-            self.putch(x, y+i, c)
-
-    def fill_clip(self, c=' '):
-        """Fill current clip region."""
-        rect = self.clipstack.top()
-        self.fill(rect.x, rect.y, rect.w, rect.h, c)
-
-    def fill(self, x, y, w, h, c=' '):
-        '''Fill rectangular area.'''
-        for i in range(h):
-            self.hline(x, y + i, w, c)
-
-    def frame(self, x, y, w, h):
-        '''Draw rectangular frame using line-drawing characters.'''
-        self.putch(x, y, self.unigraph.ULCORNER)
-        self.putch(x+w-1, y, self.unigraph.URCORNER)
-        self.putch(x, y+h-1, self.unigraph.LLCORNER)
-        self.putch(x+w-1, y+h-1, self.unigraph.LRCORNER)
-        self.hline(x+1, y, w-2, self.unigraph.HLINE)
-        self.hline(x+1, y+h-1, w-2, self.unigraph.HLINE)
-        self.vline(x, y+1, h-2, self.unigraph.VLINE)
-        self.vline(x+w-1, y+1, h-2, self.unigraph.VLINE)
-
-
-    ## colors ##
-
-    def pushcolorprefix(self, name):
-        self.colorprefix.append(name)
-
-    def popcolorprefix(self):
-        self.colorprefix.pop()
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tuikit/driver_base.py	Fri Mar 14 18:23:23 2014 +0100
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+'''Tuikit driver base.'''
+
+from tuikit.common import Size, ClipStack, UnicodeGraphics
+
+
+class Driver:
+
+    '''Abstract driver interface. Use as base for drivers.'''
+
+    def __init__(self):
+        '''Initialize instance attributes.'''
+        #: Screen size.
+        self.size = Size()
+        #: Clipping region stack.
+        self.clipstack = ClipStack()
+        #: Unicode graphics characters.
+        self.unigraph = UnicodeGraphics()
+        #: Stack of color prefixes.
+        self.colorprefix = []
+
+
+    ## drawing ##
+
+    def puts(self, x, y, s):
+        '''Output string of characters.'''
+        for c in s:
+            self.putch(x, y, c)
+            x += 1
+
+    def hline(self, x, y, w, c=' '):
+        '''Draw horizontal line.'''
+        if isinstance(c, str):
+            s = c*w
+        else:
+            s = [c]*w
+        self.puts(x, y, s)
+
+    def vline(self, x, y, h, c=' '):
+        '''Draw vertical line.'''
+        for i in range(h):
+            self.putch(x, y+i, c)
+
+    def fill_clip(self, c=' '):
+        """Fill current clip region."""
+        rect = self.clipstack.top()
+        self.fill(rect.x, rect.y, rect.w, rect.h, c)
+
+    def fill(self, x, y, w, h, c=' '):
+        '''Fill rectangular area.'''
+        for i in range(h):
+            self.hline(x, y + i, w, c)
+
+    def frame(self, x, y, w, h):
+        '''Draw rectangular frame using line-drawing characters.'''
+        self.putch(x, y, self.unigraph.ULCORNER)
+        self.putch(x+w-1, y, self.unigraph.URCORNER)
+        self.putch(x, y+h-1, self.unigraph.LLCORNER)
+        self.putch(x+w-1, y+h-1, self.unigraph.LRCORNER)
+        self.hline(x+1, y, w-2, self.unigraph.HLINE)
+        self.hline(x+1, y+h-1, w-2, self.unigraph.HLINE)
+        self.vline(x, y+1, h-2, self.unigraph.VLINE)
+        self.vline(x+w-1, y+1, h-2, self.unigraph.VLINE)
+
+
+    ## colors ##
+
+    def pushcolorprefix(self, name):
+        self.colorprefix.append(name)
+
+    def popcolorprefix(self):
+        self.colorprefix.pop()
+
--- a/tuikit/driver_curses.py	Fri Mar 14 10:30:43 2014 +0100
+++ b/tuikit/driver_curses.py	Fri Mar 14 18:23:23 2014 +0100
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 
-import curses.wrapper
+import curses
 import curses.ascii
 import math
 import logging
 
-from tuikit.driver import Driver
+from tuikit.driver_base import Driver
 
 
 class DriverCurses(Driver):
--- a/tuikit/driver_dummy.py	Fri Mar 14 10:30:43 2014 +0100
+++ b/tuikit/driver_dummy.py	Fri Mar 14 18:23:23 2014 +0100
@@ -8,7 +8,7 @@
 
 import logging
 
-from tuikit.driver import Driver
+from tuikit.driver_base import Driver
 
 
 class DriverDummy(Driver):
--- a/tuikit/driver_sdl.py	Fri Mar 14 10:30:43 2014 +0100
+++ b/tuikit/driver_sdl.py	Fri Mar 14 18:23:23 2014 +0100
@@ -6,7 +6,7 @@
 
 '''
 
-from tuikit.driver import Driver
+from tuikit.driver_base import Driver
 
 import logging
 import subprocess