diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-03-31 18:54:41 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-06-11 20:49:43 +0100 |
commit | 332a5c2553db41de777473a1e1be9cd1522c9496 (patch) | |
tree | 3ee06a59f147ccc4009b35cccfbe2461bcd18310 /src/windows/misc.py | |
parent | cf44cf7cdec9fdb35caa372563d57e7045dc29dd (diff) | |
download | poezio-332a5c2553db41de777473a1e1be9cd1522c9496.tar.gz poezio-332a5c2553db41de777473a1e1be9cd1522c9496.tar.bz2 poezio-332a5c2553db41de777473a1e1be9cd1522c9496.tar.xz poezio-332a5c2553db41de777473a1e1be9cd1522c9496.zip |
Move the src directory to poezio, for better cython compatibility.
Diffstat (limited to 'src/windows/misc.py')
-rw-r--r-- | src/windows/misc.py | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/windows/misc.py b/src/windows/misc.py deleted file mode 100644 index 07c91bbd..00000000 --- a/src/windows/misc.py +++ /dev/null @@ -1,60 +0,0 @@ -""" -Wins that don’t fit any category -""" - -import logging -log = logging.getLogger(__name__) - -import curses - -from . import Win -from theming import get_theme, to_curses_attr - -class VerticalSeparator(Win): - """ - Just a one-column window, with just a line in it, that is - refreshed only on resize, but never on refresh, for efficiency - """ - def __init__(self): - Win.__init__(self) - - def rewrite_line(self): - self._win.vline(0, 0, curses.ACS_VLINE, self.height, - to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR)) - self._refresh() - - def refresh(self): - log.debug('Refresh: %s', self.__class__.__name__) - self.rewrite_line() - - -class SimpleTextWin(Win): - def __init__(self, text): - Win.__init__(self) - self._text = text - self.built_lines = [] - - def rebuild_text(self): - """ - Transform the text in lines than can then be - displayed without any calculation or anything - at refresh() time - It is basically called on each resize - """ - self.built_lines = [] - for line in self._text.split('\n'): - while len(line) >= self.width: - limit = line[:self.width].rfind(' ') - if limit <= 0: - limit = self.width - self.built_lines.append(line[:limit]) - line = line[limit:] - self.built_lines.append(line) - - def refresh(self): - log.debug('Refresh: %s', self.__class__.__name__) - self._win.erase() - for y, line in enumerate(self.built_lines): - self.addstr_colored(line, y, 0) - self._refresh() - |