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.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/poezio/windows/list.py b/poezio/windows/list.py
index f03dcf6a..1c5d834f 100644
--- a/poezio/windows/list.py
+++ b/poezio/windows/list.py
@@ -24,10 +24,10 @@ class ListWin(Win):
def __init__(self, columns: Dict[str, int], with_headers: bool = True) -> None:
Win.__init__(self)
- self._columns = columns # type: Dict[str, int]
- self._columns_sizes = {} # type: Dict[str, int]
+ self._columns: Dict[str, int] = columns
+ self._columns_sizes: Dict[str, int] = {}
self.sorted_by = (None, None) # for example: ('name', '↑')
- self.lines = [] # type: List[str]
+ self.lines: List[str] = []
self._selected_row = 0
self._starting_pos = 0 # The column number from which we start the refresh
@@ -40,7 +40,7 @@ class ListWin(Win):
def empty(self) -> None:
"""
- emtpy the list and reset some important values as well
+ empty the list and reset some important values as well
"""
self.lines = []
self._selected_row = 0
@@ -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
@@ -174,7 +173,7 @@ class ColumnHeaderWin(Win):
def __init__(self, columns: List[str]) -> None:
Win.__init__(self)
self._columns = columns
- self._columns_sizes = {} # type: Dict[str, int]
+ self._columns_sizes: Dict[str, int] = {}
self._column_sel = ''
self._column_order = ''
self._column_order_asc = False
@@ -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()