|     51         (0x5b,0x44,         1,      'f4'            ),  # linux |     51         (0x5b,0x44,         1,      'f4'            ),  # linux | 
|     52         (0x5b,0x45,         1,      'f5'            ),  # linux |     52         (0x5b,0x45,         1,      'f5'            ),  # linux | 
|     53     ) |     53     ) | 
|     54  |     54  | 
|     55     color_map = { |     55     color_map = { | 
|     56         'black'   : curses.COLOR_BLACK, |     56         'black'     : (curses.COLOR_BLACK,  0), | 
|     57         'blue'    : curses.COLOR_BLUE, |     57         'blue'      : (curses.COLOR_BLUE,   0), | 
|     58         'cyan'    : curses.COLOR_CYAN, |     58         'green'     : (curses.COLOR_GREEN,  0), | 
|     59         'green'   : curses.COLOR_GREEN, |     59         'cyan'      : (curses.COLOR_CYAN,   0), | 
|     60         'magenta' : curses.COLOR_MAGENTA, |     60         'red'       : (curses.COLOR_RED,    0), | 
|     61         'red'     : curses.COLOR_RED, |     61         'magenta'   : (curses.COLOR_MAGENTA,0), | 
|     62         'white'   : curses.COLOR_WHITE, |     62         'brown'     : (curses.COLOR_YELLOW, 0), | 
|     63         'yellow'  : curses.COLOR_YELLOW, |     63         'lightgray' : (curses.COLOR_WHITE,  0), | 
|         |     64         'gray'          : (curses.COLOR_BLACK,  curses.A_BOLD), | 
|         |     65         'lightblue'     : (curses.COLOR_BLUE,   curses.A_BOLD), | 
|         |     66         'lightgreen'    : (curses.COLOR_GREEN,  curses.A_BOLD), | 
|         |     67         'lightcyan'     : (curses.COLOR_CYAN,   curses.A_BOLD), | 
|         |     68         'lightred'      : (curses.COLOR_RED,    curses.A_BOLD), | 
|         |     69         'lightmagenta'  : (curses.COLOR_MAGENTA,curses.A_BOLD), | 
|         |     70         'yellow'        : (curses.COLOR_YELLOW, curses.A_BOLD), | 
|         |     71         'white'         : (curses.COLOR_WHITE,  curses.A_BOLD), | 
|     64     } |     72     } | 
|     65  |     73  | 
|     66     attr_map = { |     74     attr_map = { | 
|         |     75         'bold'      : curses.A_BOLD, | 
|         |     76         'underline' : curses.A_UNDERLINE, | 
|         |     77         'standout'  : curses.A_STANDOUT,  # inverse bg/fg | 
|     67         'blink'     : curses.A_BLINK, |     78         'blink'     : curses.A_BLINK, | 
|     68         'bold'      : curses.A_BOLD, |         | 
|     69         'dim'       : curses.A_DIM, |         | 
|     70         'standout'  : curses.A_STANDOUT,  # inverse bg/fg |         | 
|     71         'underline' : curses.A_UNDERLINE, |         | 
|     72     } |     79     } | 
|     73  |     80  | 
|     74     def __init__(self): |     81     def __init__(self): | 
|     75         '''Set driver attributes to default values.''' |     82         '''Set driver attributes to default values.''' | 
|     76         Driver.__init__(self) |     83         Driver.__init__(self) | 
|    124             res = res | self.attr_map[a] |    131             res = res | self.attr_map[a] | 
|    125         return res |    132         return res | 
|    126  |    133  | 
|    127     def setcolor(self, name, desc): |    134     def setcolor(self, name, desc): | 
|    128         parts = desc.split(',') |    135         parts = desc.split(',') | 
|    129         fg, bg = parts[0].split(' on ') |    136         fgbg = parts[0].split(' on ', 1) | 
|         |    137         fg = fgbg[0] | 
|         |    138         bg = fgbg[1:] and fgbg[1] or 'black' | 
|    130         attrs = parts[1:] |    139         attrs = parts[1:] | 
|    131         fg = self._parsecolor(fg) |    140         fg, fgattr = self._parsecolor(fg) | 
|    132         bg = self._parsecolor(bg) |    141         bg, _bgattr = self._parsecolor(bg) | 
|    133         col = self._getcolorpair(fg, bg) |    142         col = self._getcolorpair(fg, bg) | 
|    134         attr = self._parseattrs(attrs) |    143         attr = self._parseattrs(attrs) | 
|    135         self.colors[name] = curses.color_pair(col) | attr |    144         self.colors[name] = curses.color_pair(col) | fgattr | attr | 
|    136  |    145  | 
|    137     def pushcolor(self, name): |    146     def pushcolor(self, name): | 
|    138         # add prefix if such color is available |    147         # add prefix if such color is available | 
|    139         if len(self.colorprefix): |    148         if len(self.colorprefix): | 
|    140             prefixname = self.colorprefix[-1] + name |    149             prefixname = self.colorprefix[-1] + name |