Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, questions):
self.questions = questions
self.cachedQuestions = [None for _ in range(10)]
widgets = [self.display_text(i, q) for i, q in enumerate(questions)]
self.questions_box = ScrollableTextBox(widgets)
self.header = UnicodeText(('less-important', 'Select a question below:\n'))
self.footerText = '0-' + str(len(self.questions) - 1) + ': select a question, any other key: exit.'
self.errorText = UnicodeText.to_unicode('Question numbers range from 0-' +
str(len(self.questions) - 1) +
". Please select a valid question number.")
self.footer = UnicodeText(self.footerText)
self.footerText = UnicodeText.to_unicode(self.footerText)
frame = urwid.Frame(header=self.header,
body=urwid.Filler(self.questions_box, height=('relative', 100), valign='top'),
footer=self.footer)
urwid.WidgetWrap.__init__(self, frame)
def __init__(self, questions):
self.questions = questions
self.cachedQuestions = [None for _ in range(10)]
widgets = [self.display_text(i, q) for i, q in enumerate(questions)]
self.questions_box = ScrollableTextBox(widgets)
self.header = UnicodeText(('less-important', 'Select a question below:\n'))
self.footerText = '0-' + str(len(self.questions) - 1) + ': select a question, any other key: exit.'
self.errorText = UnicodeText.to_unicode('Question numbers range from 0-' +
str(len(self.questions) - 1) +
". Please select a valid question number.")
self.footer = UnicodeText(self.footerText)
self.footerText = UnicodeText.to_unicode(self.footerText)
frame = urwid.Frame(header=self.header,
body=urwid.Filler(self.questions_box, height=('relative', 100), valign='top'),
footer=self.footer)
urwid.WidgetWrap.__init__(self, frame)
def __init__(self, text):
# As we were encoding all text to utf-8 in output before with dispstr, do it automatically for all input
text = UnicodeText.to_unicode(text)
urwid.Text.__init__(self, text)