socli.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:socli 作者: gautamkrishnar 项目源码 文件源码
def makeFrame(self, data):
        """
        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'\u2191: previous answer, \u2193: next answer, o: open in browser, \u2190: back')
            ])
        )
        return answer_frame
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号