Commit 3c4b2e96 authored by mathieui's avatar mathieui

Fix various issues with the /configure tab

Vertical tab list, text not erased from previous tab
parent 4c5c3101
...@@ -75,7 +75,7 @@ class DataFormsTab(Tab): ...@@ -75,7 +75,7 @@ class DataFormsTab(Tab):
def refresh(self): def refresh(self):
self.topic_win.refresh(self._form['title']) self.topic_win.refresh(self._form['title'])
self.tab_win.refresh() self.refresh_tab_win()
self.help_win.refresh() self.help_win.refresh()
self.help_win_dyn.refresh(self.form_win.get_help_message()) self.help_win_dyn.refresh(self.form_win.get_help_message())
self.form_win.refresh() self.form_win.refresh()
...@@ -88,7 +88,7 @@ class FieldInput(object): ...@@ -88,7 +88,7 @@ class FieldInput(object):
""" """
def __init__(self, field): def __init__(self, field):
self._field = field self._field = field
self.color = (14, -1) self.color = get_theme().COLOR_NORMAL_TEXT
def set_color(self, color): def set_color(self, color):
self.color = color self.color = color
...@@ -131,6 +131,7 @@ class ColoredLabel(windows.Win): ...@@ -131,6 +131,7 @@ class ColoredLabel(windows.Win):
def refresh(self): def refresh(self):
with g_lock: with g_lock:
self._win.erase()
self._win.attron(to_curses_attr(self.color)) self._win.attron(to_curses_attr(self.color))
self.addstr(0, 0, self.text) self.addstr(0, 0, self.text)
self._win.attroff(to_curses_attr(self.color)) self._win.attroff(to_curses_attr(self.color))
...@@ -157,7 +158,7 @@ class DummyInput(FieldInput, windows.Win): ...@@ -157,7 +158,7 @@ class DummyInput(FieldInput, windows.Win):
class ColoredLabel(windows.Win): class ColoredLabel(windows.Win):
def __init__(self, text): def __init__(self, text):
self.text = text self.text = text
self.color = (14, -1) self.color = get_theme().COLOR_NORMAL_TEXT
windows.Win.__init__(self) windows.Win.__init__(self)
def resize(self, height, width, y, x): def resize(self, height, width, y, x):
...@@ -169,6 +170,7 @@ class ColoredLabel(windows.Win): ...@@ -169,6 +170,7 @@ class ColoredLabel(windows.Win):
def refresh(self): def refresh(self):
with g_lock: with g_lock:
self._win.erase()
self._win.attron(to_curses_attr(self.color)) self._win.attron(to_curses_attr(self.color))
self.addstr(0, 0, self.text) self.addstr(0, 0, self.text)
self._win.attroff(to_curses_attr(self.color)) self._win.attroff(to_curses_attr(self.color))
...@@ -189,6 +191,7 @@ class BooleanWin(FieldInput, windows.Win): ...@@ -189,6 +191,7 @@ class BooleanWin(FieldInput, windows.Win):
def refresh(self): def refresh(self):
with g_lock: with g_lock:
self._win.erase()
self._win.attron(to_curses_attr(self.color)) self._win.attron(to_curses_attr(self.color))
self.addnstr(0, 0, ' '*(8), self.width) self.addnstr(0, 0, ' '*(8), self.width)
self.addstr(0, 2, "%s"%self.value) self.addstr(0, 2, "%s"%self.value)
...@@ -253,6 +256,7 @@ class TextMultiWin(FieldInput, windows.Win): ...@@ -253,6 +256,7 @@ class TextMultiWin(FieldInput, windows.Win):
def refresh(self): def refresh(self):
if not self.edition_input: if not self.edition_input:
with g_lock: with g_lock:
self._win.erase()
self._win.attron(to_curses_attr(self.color)) self._win.attron(to_curses_attr(self.color))
self.addnstr(0, 0, ' '*self.width, self.width) self.addnstr(0, 0, ' '*self.width, self.width)
option = self.options[self.val_pos] option = self.options[self.val_pos]
...@@ -305,6 +309,7 @@ class ListMultiWin(FieldInput, windows.Win): ...@@ -305,6 +309,7 @@ class ListMultiWin(FieldInput, windows.Win):
def refresh(self): def refresh(self):
with g_lock: with g_lock:
self._win.erase()
self._win.attron(to_curses_attr(self.color)) self._win.attron(to_curses_attr(self.color))
self.addnstr(0, 0, ' '*self.width, self.width) self.addnstr(0, 0, ' '*self.width, self.width)
if self.val_pos > 0: if self.val_pos > 0:
...@@ -351,6 +356,7 @@ class ListSingleWin(FieldInput, windows.Win): ...@@ -351,6 +356,7 @@ class ListSingleWin(FieldInput, windows.Win):
def refresh(self): def refresh(self):
with g_lock: with g_lock:
self._win.erase()
self._win.attron(to_curses_attr(self.color)) self._win.attron(to_curses_attr(self.color))
self.addnstr(0, 0, ' '*self.width, self.width) self.addnstr(0, 0, ' '*self.width, self.width)
if self.val_pos > 0: if self.val_pos > 0:
...@@ -377,7 +383,7 @@ class TextSingleWin(FieldInput, windows.Input): ...@@ -377,7 +383,7 @@ class TextSingleWin(FieldInput, windows.Input):
self.text = field.getValue() if isinstance(field.getValue(), str)\ self.text = field.getValue() if isinstance(field.getValue(), str)\
else "" else ""
self.pos = len(self.text) self.pos = len(self.text)
self.color = (14, -1) self.color = get_theme().COLOR_NORMAL_TEXT
def reply(self): def reply(self):
self._field['label'] = '' self._field['label'] = ''
...@@ -427,7 +433,7 @@ class FormWin(object): ...@@ -427,7 +433,7 @@ class FormWin(object):
} }
def __init__(self, form, height, width, y, x): def __init__(self, form, height, width, y, x):
self._form = form self._form = form
self._win = curses.newwin(height, width, y, x) self._win = windows.Win._tab_win.derwin(height, width, y, x)
self.current_input = 0 self.current_input = 0
self.inputs = [] # dict list self.inputs = [] # dict list
for (name, field) in self._form.getFields().items(): for (name, field) in self._form.getFields().items():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment