Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Returns a new frame that is formatted correctly with respect to the window's dimensions.
:param data: tuple of (answers, question_title, question_desc, question_stats, question_url)
:return: a new urwid.Frame object
"""
answers, question_title, question_desc, question_stats, question_url = data
self.data = data
self.question_desc = question_desc
self.url = question_url
self.answer_text = AnswerText(answers)
self.screenHeight, screenWidth = subprocess.check_output(['stty', 'size']).split()
self.question_text = urwid.BoxAdapter(QuestionDescription(question_desc), int(max(1, (int(self.screenHeight) - 9) / 2)))
answer_frame = urwid.Frame(
header= urwid.Pile( [
header_for_display,
QuestionTitle(question_title),
self.question_text,
QuestionStats(question_stats),
urwid.Divider('-')
]),
body=self.answer_text,
footer= urwid.Pile([
QuestionURL(question_url),
UnicodeText(u'p: previous answer, n: next answer, o: open in browser, b: back')
])
)
return answer_frame