diff options
author | mathieui <mathieui@mathieui.net> | 2017-11-12 15:03:09 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2017-11-12 15:03:09 +0100 |
commit | d55cc5872503567775f0d7a7731d6f489bf2299b (patch) | |
tree | 725f9e7b8144d36054447b3c82edfb45bda8df1d /poezio/windows/info_bar.py | |
parent | 92496db823db34f7f7fb1ab31eaef093a707c3e8 (diff) | |
download | poezio-d55cc5872503567775f0d7a7731d6f489bf2299b.tar.gz poezio-d55cc5872503567775f0d7a7731d6f489bf2299b.tar.bz2 poezio-d55cc5872503567775f0d7a7731d6f489bf2299b.tar.xz poezio-d55cc5872503567775f0d7a7731d6f489bf2299b.zip |
yapf -ir
Diffstat (limited to 'poezio/windows/info_bar.py')
-rw-r--r-- | poezio/windows/info_bar.py | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/poezio/windows/info_bar.py b/poezio/windows/info_bar.py index cac56db9..950813f1 100644 --- a/poezio/windows/info_bar.py +++ b/poezio/windows/info_bar.py @@ -10,11 +10,11 @@ log = logging.getLogger(__name__) import curses - from poezio.config import config from poezio.windows.base_wins import Win from poezio.theming import get_theme, to_curses_attr + class GlobalInfoBar(Win): def __init__(self, core): Win.__init__(self) @@ -23,7 +23,8 @@ class GlobalInfoBar(Win): def refresh(self): log.debug('Refresh: %s', self.__class__.__name__) self._win.erase() - self.addstr(0, 0, "[", to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) + self.addstr(0, 0, "[", + to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) create_gaps = config.get('create_gaps') show_names = config.get('show_tab_names') @@ -48,20 +49,24 @@ class GlobalInfoBar(Win): self.addstr(' ', to_curses_attr(color)) if show_names: if use_nicks: - self.addstr("%s" % str(tab.get_nick()), to_curses_attr(color)) + self.addstr("%s" % str(tab.get_nick()), + to_curses_attr(color)) else: self.addstr("%s" % tab.name, to_curses_attr(color)) - self.addstr("|", to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) - except: # end of line + self.addstr("|", + to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) + except: # end of line break (y, x) = self._win.getyx() - self.addstr(y, x-1, '] ', to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) + self.addstr(y, x - 1, '] ', + to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) (y, x) = self._win.getyx() remaining_size = self.width - x - self.addnstr(' '*remaining_size, remaining_size, + self.addnstr(' ' * remaining_size, remaining_size, to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) self._refresh() + class VerticalGlobalInfoBar(Win): def __init__(self, core, scr): Win.__init__(self) @@ -79,30 +84,32 @@ class VerticalGlobalInfoBar(Win): use_nicks = config.get('use_tab_nicks') if nb_tabs >= height: for y, tab in enumerate(sorted_tabs): - if tab.vertical_color == get_theme().COLOR_VERTICAL_TAB_CURRENT: + if tab.vertical_color == get_theme( + ).COLOR_VERTICAL_TAB_CURRENT: pos = y break # center the current tab as much as possible - if pos < height//2: + if pos < height // 2: sorted_tabs = sorted_tabs[:height] - elif nb_tabs - pos <= height//2: + elif nb_tabs - pos <= height // 2: sorted_tabs = sorted_tabs[-height:] else: - sorted_tabs = sorted_tabs[pos-height//2 : pos+height//2] + sorted_tabs = sorted_tabs[pos - height // 2:pos + height // 2] asc_sort = (config.get('vertical_tab_list_sort') == 'asc') for y, tab in enumerate(sorted_tabs): color = tab.vertical_color if asc_sort: y = height - y - 1 self.addstr(y, 0, "%2d" % tab.nb, - to_curses_attr(get_theme().COLOR_VERTICAL_TAB_NUMBER)) + to_curses_attr(get_theme().COLOR_VERTICAL_TAB_NUMBER)) self.addstr('.') if use_nicks: - self.addnstr("%s" % tab.get_nick(), width - 4, to_curses_attr(color)) + self.addnstr("%s" % tab.get_nick(), width - 4, + to_curses_attr(color)) else: self.addnstr("%s" % tab.name, width - 4, to_curses_attr(color)) separator = to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR) self._win.attron(separator) - self._win.vline(0, width-1, curses.ACS_VLINE, height) + self._win.vline(0, width - 1, curses.ACS_VLINE, height) self._win.attroff(separator) self._refresh() |