# HG changeset patch # User Goffi # Date 1556909367 -7200 # Node ID 18a98a541f7a36566ac2e588814f5ee9b2c47f9f # Parent 48985ef7682f7c9a76f7dda6b4fe9348b73fc51d jp (xmlui manager): basic handling of multi-lines text in TextBoxWidget diff -r 48985ef7682f -r 18a98a541f7a sat_frontends/jp/cmd_file.py --- a/sat_frontends/jp/cmd_file.py Fri May 03 20:48:19 2019 +0200 +++ b/sat_frontends/jp/cmd_file.py Fri May 03 20:49:27 2019 +0200 @@ -756,7 +756,7 @@ def _FISInviteCb(self): self.disp( - _(u'invitation sent do {entity}').format(entity=self.args.jid) + _(u'invitation sent to {entity}').format(entity=self.args.jid) ) self.host.quit() diff -r 48985ef7682f -r 18a98a541f7a sat_frontends/jp/xmlui_manager.py --- 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):