diff options
Diffstat (limited to 'poezio/windows/muc.py')
-rw-r--r-- | poezio/windows/muc.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/poezio/windows/muc.py b/poezio/windows/muc.py index 72dc602c..0e95ac1b 100644 --- a/poezio/windows/muc.py +++ b/poezio/windows/muc.py @@ -33,7 +33,7 @@ class UserList(Win): def __init__(self) -> None: Win.__init__(self) self.pos = 0 - self.cache = [] # type: List[CachedUser] + self.cache: List[CachedUser] = [] def scroll_up(self) -> bool: self.pos += self.height - 1 @@ -65,14 +65,14 @@ class UserList(Win): def refresh(self, users: List[User]) -> None: log.debug('Refresh: %s', self.__class__.__name__) - if config.get('hide_user_list'): + if config.getbool('hide_user_list'): return # do not refresh if this win is hidden. if len(users) < self.height: self.pos = 0 elif self.pos >= len(users) - self.height and self.pos != 0: self.pos = len(users) - self.height self._win.erase() - asc_sort = (config.get('user_list_sort').lower() == 'asc') + asc_sort = (config.getstr('user_list_sort').lower() == 'asc') if asc_sort: y, _ = self._win.getmaxyx() y -= 1 @@ -110,15 +110,16 @@ class UserList(Win): self.addstr(y, 1, symbol, to_curses_attr(color)) def draw_status_chatstate(self, y: int, user: User) -> None: - show_col = get_theme().color_show(user.show) + theme = get_theme() + show_col = theme.color_show(user.show) if user.chatstate == 'composing': - char = get_theme().CHAR_CHATSTATE_COMPOSING + char = theme.CHAR_CHATSTATE_COMPOSING elif user.chatstate == 'active': - char = get_theme().CHAR_CHATSTATE_ACTIVE + char = theme.CHAR_CHATSTATE_ACTIVE elif user.chatstate == 'paused': - char = get_theme().CHAR_CHATSTATE_PAUSED + char = theme.CHAR_CHATSTATE_PAUSED else: - char = get_theme().CHAR_STATUS + char = theme.CHAR_STATUS self.addstr(y, 0, char, to_curses_attr(show_col)) def resize(self, height: int, width: int, y: int, x: int) -> None: @@ -138,17 +139,18 @@ class Topic(Win): def refresh(self, topic: Optional[str] = None) -> None: log.debug('Refresh: %s', self.__class__.__name__) + theme = get_theme() self._win.erase() if topic is not None: msg = topic[:self.width - 1] else: msg = self._message[:self.width - 1] - self.addstr(0, 0, msg, to_curses_attr(get_theme().COLOR_TOPIC_BAR)) + self.addstr(0, 0, msg, to_curses_attr(theme.COLOR_TOPIC_BAR)) _, x = self._win.getyx() remaining_size = self.width - x if remaining_size: self.addnstr(' ' * remaining_size, remaining_size, - to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) + to_curses_attr(theme.COLOR_INFORMATION_BAR)) self._refresh() def set_message(self, message) -> None: |