jp (xmlui manager): basic handling of multi-lines text in TextBoxWidget

This commit is contained in:
Goffi 2019-05-03 20:49:27 +02:00
commit 4f9f003075
2 changed files with 24 additions and 1 deletions

View file

@ -756,7 +756,7 @@ class ShareInvite(base.CommandBase):
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()

View file

@ -236,6 +236,29 @@ class JidInputWidget(xmlui_base.JidInputWidget, StringWidget):
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):