diff options
author | mathieui <mathieui@mathieui.net> | 2012-04-18 15:55:24 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-04-18 15:55:24 +0200 |
commit | b3c4dd93eb8cb573c4c8980bc01d578aae2bd7e4 (patch) | |
tree | f65f82510e765fc69e33866565fe77d3ab718e4f /src/windows.py | |
parent | 384f6939cb09268ebbb3072490b3b0c87bff82ba (diff) | |
download | poezio-b3c4dd93eb8cb573c4c8980bc01d578aae2bd7e4.tar.gz poezio-b3c4dd93eb8cb573c4c8980bc01d578aae2bd7e4.tar.bz2 poezio-b3c4dd93eb8cb573c4c8980bc01d578aae2bd7e4.tar.xz poezio-b3c4dd93eb8cb573c4c8980bc01d578aae2bd7e4.zip |
Add new options use_tab_nicks, show_tab_numbers, and show_tab_names
(thanks gio)
Diffstat (limited to 'src/windows.py')
-rw-r--r-- | src/windows.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/windows.py b/src/windows.py index 77523e8f..56b72884 100644 --- a/src/windows.py +++ b/src/windows.py @@ -319,15 +319,24 @@ class GlobalInfoBar(Win): self._win.erase() self.addstr(0, 0, "[", to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) sorted_tabs = sorted(self.core.tabs, key=comp) + show_names = config.getl('show_tab_names', 'false') == 'true' + show_nums = config.getl('show_tab_numbers', 'true') != 'false' + use_nicks = config.getl('use_tab_nicks', 'true') != 'false' for tab in sorted_tabs: color = tab.color if config.get('show_inactive_tabs', 'true') == 'false' and\ color is get_theme().COLOR_TAB_NORMAL: continue try: - self.addstr("%s" % str(tab.nb), to_curses_attr(color)) - if config.get('show_tab_names', 'false') == 'true': - self.addstr(" %s" % str(tab.get_name()), to_curses_attr(color)) + if show_nums or not show_names: + self.addstr("%s" % str(tab.nb), to_curses_attr(color)) + if show_names: + self.addstr(' ', to_curses_attr(color)) + if show_names: + if use_nicks: + self.addstr("%s" % str(tab.get_nick()), to_curses_attr(color)) + else: + self.addstr("%s" % str(tab.get_name()), to_curses_attr(color)) self.addstr("|", to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) except: # end of line break @@ -356,6 +365,7 @@ class VerticalGlobalInfoBar(Win): sorted_tabs = [tab for tab in sorted_tabs if\ tab.vertical_color is not get_theme().COLOR_VERTICAL_TAB_NORMAL] nb_tabs = len(sorted_tabs) + use_nicks = config.getl('use_tab_nicks', 'true') != 'false' if nb_tabs >= height: for y, tab in enumerate(sorted_tabs): if tab.vertical_color == get_theme().COLOR_VERTICAL_TAB_CURRENT: @@ -372,7 +382,10 @@ class VerticalGlobalInfoBar(Win): color = tab.vertical_color self.addstr(y if config.get('vertical_tab_list_sort', 'desc') != 'asc' else height - y - 1, 0, "%2d" % tab.nb, to_curses_attr(get_theme().COLOR_VERTICAL_TAB_NUMBER)) self.addstr('.') - self.addnstr("%s" % tab.get_name(), width - 4, to_curses_attr(color)) + if use_nicks: + self.addnstr("%s" % tab.get_nick(), width - 4, to_curses_attr(color)) + else: + self.addnstr("%s" % tab.get_name(), width - 4, to_curses_attr(color)) self._win.attron(to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR)) self._win.vline(0, width-1, curses.ACS_VLINE, height) self._win.attroff(to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR)) |