From d55cc5872503567775f0d7a7731d6f489bf2299b Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 12 Nov 2017 15:03:09 +0100 Subject: yapf -ir --- poezio/windows/image.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'poezio/windows/image.py') diff --git a/poezio/windows/image.py b/poezio/windows/image.py index 57bbec71..09a11d6f 100644 --- a/poezio/windows/image.py +++ b/poezio/windows/image.py @@ -15,10 +15,12 @@ from poezio.windows.base_wins import Win from poezio.theming import to_curses_attr from poezio.xhtml import _parse_css_color + class ImageWin(Win): """ A window which contains either an image or a border. """ + def __init__(self): self._image = None Win.__init__(self) @@ -41,10 +43,10 @@ class ImageWin(Win): self._refresh() def _display_border(self): - self._win.border(curses.ACS_VLINE, curses.ACS_VLINE, - curses.ACS_HLINE, curses.ACS_HLINE, - curses.ACS_ULCORNER, curses.ACS_URCORNER, - curses.ACS_LLCORNER, curses.ACS_LRCORNER) + self._win.border(curses.ACS_VLINE, curses.ACS_VLINE, curses.ACS_HLINE, + curses.ACS_HLINE, curses.ACS_ULCORNER, + curses.ACS_URCORNER, curses.ACS_LLCORNER, + curses.ACS_LRCORNER) @staticmethod def _compute_size(image_size, width: int, height: int): @@ -69,13 +71,13 @@ class ImageWin(Win): start_y = (original_height - height // 2) // 2 start_x = (original_width - width) // 2 for y in range(height // 2): - two_lines = data[(2 * y) * width * 3: (2 * y + 2) * width * 3] + two_lines = data[(2 * y) * width * 3:(2 * y + 2) * width * 3] line1 = two_lines[:width * 3] line2 = two_lines[width * 3:] self.move(start_y + y, start_x) for x in range(width): - r, g, b = line1[x * 3: (x + 1) * 3] + r, g, b = line1[x * 3:(x + 1) * 3] top_color = _parse_css_color('#%02x%02x%02x' % (r, g, b)) - r, g, b = line2[x * 3: (x + 1) * 3] + r, g, b = line2[x * 3:(x + 1) * 3] bot_color = _parse_css_color('#%02x%02x%02x' % (r, g, b)) self.addstr('▄', to_curses_attr((bot_color, top_color))) -- cgit v1.2.3