From d67ec3278ae5a56373597c6f2a259d9dba9cc809 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 16 Nov 2011 02:01:38 +0100 Subject: Add an optional vertical tab list. --- src/core.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index ce675f04..120438ed 100644 --- a/src/core.py +++ b/src/core.py @@ -193,12 +193,7 @@ class Core(object): """ self.stdscr = curses.initscr() self.init_curses(self.stdscr) - # Init the tab's size. - tabs.Tab.resize(self.stdscr) - # resize the information_win to its initial size - self.resize_global_information_win() - # resize the global_info_bar to its initial size - self.resize_global_info_bar() + self.call_for_resize() default_tab = tabs.RosterInfoTab() default_tab.on_gain_focus() self.tabs.append(default_tab) @@ -226,6 +221,12 @@ class Core(object): """ with g_lock: self.tab_win.resize(1, tabs.Tab.width, tabs.Tab.height - 2, 0) + if config.get('enable_left_tab_list', 'false') == 'true': + height, width = self.stdscr.getmaxyx() + truncated_win = self.stdscr.subwin(height, config.get('vertical_tab_list_size', 20), 0, 0) + self.left_tab_win = windows.VerticalGlobalInfoBar(truncated_win) + else: + self.left_tab_win = None def on_exception(self, typ, value, trace): """ @@ -749,16 +750,25 @@ class Core(object): """ Called when we want to resize the screen """ - tabs.Tab.resize(self.stdscr) - self.resize_global_information_win() + # If we have the tabs list on the left, we just give a truncated + # window to each Tab class, so the draw themself in the portion + # of the screen that the can occupy, and we draw the tab list + # on the left remaining space + if config.get('enable_left_tab_list', 'false') == 'true': + scr = self.stdscr.subwin(0, config.get('vertical_tab_list_size', 20)) + else: + scr = self.stdscr + tabs.Tab.resize(scr) self.resize_global_info_bar() + self.resize_global_information_win() with g_lock: for tab in self.tabs: if config.get('lazy_resize', 'true') == 'true': tab.need_resize = True else: tab.resize() - self.full_screen_redraw() + if self.tabs: + self.full_screen_redraw() def read_keyboard(self): """ @@ -878,7 +888,7 @@ class Core(object): self.doupdate() def refresh_tab_win(self): - self.current_tab().tab_win.refresh() + self.current_tab().refresh_tab_win() if self.current_tab().input: self.current_tab().input.refresh() self.doupdate() -- cgit v1.2.3 From 1777d7414d4db60beb209c33d678b25a47ba73c0 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 16 Nov 2011 02:05:37 +0100 Subject: Document the two new options. --- src/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core.py') diff --git a/src/core.py b/src/core.py index 120438ed..8e2cccea 100644 --- a/src/core.py +++ b/src/core.py @@ -221,7 +221,7 @@ class Core(object): """ with g_lock: self.tab_win.resize(1, tabs.Tab.width, tabs.Tab.height - 2, 0) - if config.get('enable_left_tab_list', 'false') == 'true': + if config.get('enable_vertical_tab_list', 'false') == 'true': height, width = self.stdscr.getmaxyx() truncated_win = self.stdscr.subwin(height, config.get('vertical_tab_list_size', 20), 0, 0) self.left_tab_win = windows.VerticalGlobalInfoBar(truncated_win) @@ -754,7 +754,7 @@ class Core(object): # window to each Tab class, so the draw themself in the portion # of the screen that the can occupy, and we draw the tab list # on the left remaining space - if config.get('enable_left_tab_list', 'false') == 'true': + if config.get('enable_vertical_tab_list', 'false') == 'true': scr = self.stdscr.subwin(0, config.get('vertical_tab_list_size', 20)) else: scr = self.stdscr -- cgit v1.2.3