From d1e33e1863193516a46b96fc9831a3ed03570f7b Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 2 May 2014 03:01:13 +0200 Subject: Make the FormWin handle resize properly (also, wrap one forgotten call to curses funcs) --- src/tabs/data_forms.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/tabs/data_forms.py') diff --git a/src/tabs/data_forms.py b/src/tabs/data_forms.py index 5f44a8f6..d5d4318a 100644 --- a/src/tabs/data_forms.py +++ b/src/tabs/data_forms.py @@ -66,9 +66,11 @@ class DataFormsTab(Tab): def resize(self): self.need_resize = False self.topic_win.resize(1, self.width, 0, 0) - self.form_win.resize(self.height-3 - Tab.tab_win_height(), self.width, 1, 0) - self.help_win.resize(1, self.width, self.height-1, 0) - self.help_win_dyn.resize(1, self.width, self.height-2 - Tab.tab_win_height(), 0) + self.form_win.resize(self.height - 3 - Tab.tab_win_height(), + self.width, 1, 0) + self.help_win.resize(1, self.width, self.height - 1, 0) + self.help_win_dyn.resize(1, self.width, + self.height - 2 - Tab.tab_win_height(), 0) self.lines = [] def refresh(self): @@ -412,7 +414,8 @@ class FormWin(object): } def __init__(self, form, height, width, y, x): self._form = form - self._win = windows.Win._tab_win.derwin(height, width, y, x) + with g_lock: + self._win = windows.Win._tab_win.derwin(height, width, y, x) self.scroll_pos = 0 self.current_input = 0 self.inputs = [] # dict list @@ -435,6 +438,8 @@ class FormWin(object): def resize(self, height, width, y, x): self.height = height self.width = width + with g_lock: + self._win = windows.Win._tab_win.derwin(height, width, y, x) # Adjust the scroll position, if resizing made the window too small # for the cursor to be visible while self.current_input - self.scroll_pos > self.height-1: -- cgit v1.2.3