How to use the socli.tui.QuestionStats function in socli

To help you get started, we’ve selected a few socli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gautamkrishnar / socli / socli / tui.py View on Github external
"""
        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([
                display_header,
                QuestionTitle(question_title),
                self.question_text,
                QuestionStats(question_stats),
                urwid.Divider('-')
            ]),
            body=self.answer_text,
            footer=urwid.Pile([
                QuestionURL(question_url),
                UnicodeText(
                    u'\u2191: previous answer, \u2193: next answer, o: open in browser, \u2190: back, q: quit')
            ])
        )
        return answer_frame