dirtywords

portable text interface framework  https://pypi.python.org/pypi/dirtywords
git clone https://git.ce9e.org/dirtywords.git

commit
15af5afc601790f37c2b53ddfe44ac34c5f3f517
parent
012ae5ee5da86992195a2b7591fe795d26e3c402
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2014-10-07 18:08
rename bold/italic strong/emph

Diffstat

M dirtywords/base.py 8 ++++----
M dirtywords/curses_core.py 2 +-
M dirtywords/example.py 2 +-
M dirtywords/pygame_core.py 4 ++--

4 files changed, 8 insertions, 8 deletions


diff --git a/dirtywords/base.py b/dirtywords/base.py

@@ -11,8 +11,8 @@ class AttrString(unicode):
   11    11 
   12    12     def set_attrs(self, reference='', **kwargs):
   13    13         defaults = {
   14    -1             'bold': False,
   15    -1             'italic': False,
   -1    14             'strong': False,
   -1    15             'emph': False,
   16    16             'underline': False,
   17    17             'fg_color': (255, 255, 255),
   18    18             'bg_color': (0, 0, 0),
@@ -30,8 +30,8 @@ class AttrString(unicode):
   30    30 
   31    31     def get_attrs(self):
   32    32         return {
   33    -1             'bold': self.bold,
   34    -1             'italic': self.italic,
   -1    33             'strong': self.strong,
   -1    34             'emph': self.emph,
   35    35             'underline': self.underline,
   36    36             'fg_color': self.fg_color,
   37    37             'bg_color': self.bg_color,

diff --git a/dirtywords/curses_core.py b/dirtywords/curses_core.py

@@ -57,7 +57,7 @@ class Screen(base.Screen):
   57    57     def putstr(self, y, x, s):
   58    58         for i, ch in enumerate(s):
   59    59             ch = base.AttrString(ch)
   60    -1             if ch.bold:
   -1    60             if ch.strong:
   61    61                 self.curses_window.attron(curses.A_BOLD)
   62    62             if ch.underline:
   63    63                 self.curses_window.attron(curses.A_UNDERLINE)

diff --git a/dirtywords/example.py b/dirtywords/example.py

@@ -31,7 +31,7 @@ class Player(object):
   31    31         elif self.direction == 'left':
   32    32             self.x -= 1
   33    33 
   34    -1         s = AttrString('X', bold=True, fg_color=(0, 0, 255))
   -1    34         s = AttrString('X', strong=True, fg_color=(0, 0, 255))
   35    35         self.win.putstr(self.y, self.x, s)
   36    36         self.win.refresh()
   37    37         sleep(0.05)

diff --git a/dirtywords/pygame_core.py b/dirtywords/pygame_core.py

@@ -40,8 +40,8 @@ class Screen(base.Screen):
   40    40 
   41    41     def _render_ch(self, ch):
   42    42         ch = base.AttrString(ch)
   43    -1         self.font.set_bold(ch.bold)
   44    -1         self.font.set_italic(ch.italic)
   -1    43         self.font.set_bold(ch.strong)
   -1    44         self.font.set_italic(ch.emph)
   45    45         self.font.set_underline(ch.underline)
   46    46         return self.font.render(ch, False, ch.fg_color, ch.bg_color)
   47    47