summaryrefslogtreecommitdiff
path: root/poezio/windows/list.py
diff options
context:
space:
mode:
Diffstat (limited to 'poezio/windows/list.py')
-rw-r--r--poezio/windows/list.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/poezio/windows/list.py b/poezio/windows/list.py
index b24b8aea..350255c6 100644
--- a/poezio/windows/list.py
+++ b/poezio/windows/list.py
@@ -19,6 +19,9 @@ class ListWin(Win):
scrolled up and down, with one selected line at a time
"""
+ __slots__ = ('_columns', '_columns_sizes', 'sorted_by', 'lines',
+ '_selected_row', '_starting_pos')
+
def __init__(self, columns: Dict[str, int], with_headers: bool = True) -> None:
Win.__init__(self)
self._columns = columns # type: Dict[str, int]
@@ -91,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():
@@ -103,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
@@ -165,6 +167,9 @@ class ColumnHeaderWin(Win):
A class displaying the column's names
"""
+ __slots__ = ('_columns', '_columns_sizes', '_column_sel', '_column_order',
+ '_column_order_asc')
+
def __init__(self, columns: List[str]) -> None:
Win.__init__(self)
self._columns = columns
@@ -183,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()