Mercurial > libervia-backend
diff sat_frontends/jp/xmlui_manager.py @ 2939:18a98a541f7a
jp (xmlui manager): basic handling of multi-lines text in TextBoxWidget
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 03 May 2019 20:49:27 +0200 |
parents | 442ab697f831 |
children | 5d13d357896c |
line wrap: on
line diff
--- a/sat_frontends/jp/xmlui_manager.py Fri May 03 20:48:19 2019 +0200 +++ b/sat_frontends/jp/xmlui_manager.py Fri May 03 20:49:27 2019 +0200 @@ -236,6 +236,29 @@ class TextBoxWidget(xmlui_base.TextWidget, StringWidget): type = u"textbox" + # TODO: use a more advanced input method + + def show(self): + self.verboseName() + if self.read_only: + self.disp(self.value) + else: + if self.value: + self.disp(A.color(C.A_HEADER, u"↓ current value ↓\n", A.FG_CYAN, self.value, + "")) + + values = [] + while True: + try: + if not values: + line = raw_input(A.color(C.A_HEADER, u"[Ctrl-D to finish]> ")) + else: + line = raw_input() + values.append(line) + except EOFError: + break + + self.value = u'\n'.join(values).rstrip() class XHTMLBoxWidget(xmlui_base.XHTMLBoxWidget, StringWidget):