Move UnicodeGraphics to core. Update it.
authorRadek Brich <radek.brich@devl.cz>
Fri, 14 Mar 2014 10:03:36 +0100
changeset 80 573a9e76719d
parent 79 dbdc38f9981a
child 81 5cd40c30c4f2
Move UnicodeGraphics to core. Update it.
tuikit/core/unigraph.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tuikit/core/unigraph.py	Fri Mar 14 10:03:36 2014 +0100
@@ -0,0 +1,71 @@
+class UnicodeGraphics:
+
+    """Unicode graphics bank.
+
+    This class can be inherited to support special driver
+    or to change graphics style.
+
+    """
+
+    # http://en.wikipedia.org/wiki/List_of_Unicode_characters#Geometric_shapes
+    UP_ARROW = '▲'  # curses.ACS_UARROW
+    DOWN_ARROW = '▼'  # curses.ACS_DARROW
+    LEFT_ARROW = '◀'
+    RIGHT_ARROW = '▶'
+    CIRCLE = '●'
+    DIAMOND = '◆'
+    MIDDLE_DOT = '·'
+
+    # http://en.wikipedia.org/wiki/Box-drawing_characters
+    LIGHT_SHADE = '░'  # curses.ACS_BOARD
+    MEDIUM_SHADE = '▒'
+    DARK_SHADE = '▓'
+    BLOCK = '█'
+    COLUMN = '▁▂▃▄▅▆▇█'  # [0-7]
+
+    HLINE = '─'  # curses.ACS_HLINE
+    VLINE = '│'  # curses.ACS_VLINE
+    ULCORNER = '┌'  # curses.ACS_ULCORNER
+    URCORNER = '┐'  # curses.ACS_URCORNER
+    LLCORNER = '└'  # curses.ACS_LLCORNER
+    LRCORNER = '┘'  # curses.ACS_LRCORNER
+    LTEE = '├'
+    RTEE = '┤'
+
+    DASHED_HLINE = '┄'
+    DASHED_VLINE = '┆'
+    DOTTED_HLINE = '┈'
+    DOTTED_VLINE = '┊'
+    BOLD_HLINE = '━'
+    BOLD_VLINE = '┃'
+    BOLD_DASHED_HLINE = '┅'
+    BOLD_DASHED_VLINE = '┇'
+    BOLD_DOTTED_HLINE = '┉'
+    BOLD_DOTTED_VLINE = '┋'
+    ROUND_ULCORNER = '╭'
+    ROUND_URCORNER = '╮'
+    ROUND_LLCORNER = '╰'
+    ROUND_LRCORNER = '╯'
+
+    ### Default style
+    # frame
+    frame_hline = HLINE
+    frame_vline = VLINE
+    frame_ulcorner = ULCORNER
+    frame_urcorner = URCORNER
+    frame_llcorner = LLCORNER
+    frame_lrcorner = LRCORNER
+    frame_ltee = LTEE
+    frame_rtee = RTEE
+    # scrollbar
+    sb_thumb = CIRCLE
+    sb_htrack = DOTTED_HLINE
+    sb_vtrack = DOTTED_VLINE
+    sb_left = LEFT_ARROW
+    sb_right = RIGHT_ARROW
+    sb_up = UP_ARROW
+    sb_down = DOWN_ARROW
+
+    def __getitem__(self, name):
+        return getattr(self, name)
+