From a1af8a49f15ff9d11a7c1e0ce6809e632ac25d28 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 22 Jan 2019 20:27:34 +0100 Subject: Store get_theme() in a variable in each function, to avoid redundant calls. --- poezio/windows/list.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'poezio/windows/list.py') diff --git a/poezio/windows/list.py b/poezio/windows/list.py index f03dcf6a..350255c6 100644 --- a/poezio/windows/list.py +++ b/poezio/windows/list.py @@ -94,6 +94,7 @@ class ListWin(Win): log.debug('Refresh: %s', self.__class__.__name__) self._win.erase() lines = self.lines[self._starting_pos:self._starting_pos + self.height] + color = to_curses_attr(get_theme().COLOR_INFORMATION_BAR) for y, line in enumerate(lines): x = 0 for col in self._columns.items(): @@ -106,9 +107,7 @@ class ListWin(Win): if not txt: continue if line is self.lines[self._selected_row]: - self.addstr( - y, x, txt[:size], - to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) + self.addstr(y, x, txt[:size], color) else: self.addstr(y, x, txt[:size]) x += size @@ -189,23 +188,24 @@ class ColumnHeaderWin(Win): log.debug('Refresh: %s', self.__class__.__name__) self._win.erase() x = 0 + theme = get_theme() for col in self._columns: txt = col if col in self._column_order: if self._column_order_asc: - txt += get_theme().CHAR_COLUMN_ASC + txt += theme.CHAR_COLUMN_ASC else: - txt += get_theme().CHAR_COLUMN_DESC + txt += theme.CHAR_COLUMN_DESC #⇓⇑↑↓⇧⇩▲▼ size = self._columns_sizes[col] txt += ' ' * (size - len(txt)) if col in self._column_sel: self.addstr( 0, x, txt, - to_curses_attr(get_theme().COLOR_COLUMN_HEADER_SEL)) + to_curses_attr(theme.COLOR_COLUMN_HEADER_SEL)) else: self.addstr(0, x, txt, - to_curses_attr(get_theme().COLOR_COLUMN_HEADER)) + to_curses_attr(theme.COLOR_COLUMN_HEADER)) x += size self._refresh() -- cgit v1.2.3