search.py 文件源码

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

项目:papis 作者: alejandrogallo 项目源码 文件源码
def __init__(self, doc):
        self.doc = doc
        self.docid = self.doc["ref"]

        data = self.doc.to_dict()
        # fill the default attributes for the fields
        show_fields = papis.config.get(
            "show-fields", section="urwid-gui"
        ).replace(" ", "").split(",")
        self.fields = {}
        for field in show_fields:
            self.fields[field] = urwid.Text('')
            if field in data:
                self.fields[field].set_text(str(self.doc[field]))


        self.c1width = 10

        self.rowHeader = urwid.AttrMap(
            urwid.Text('ref:%s ' % (self.docid)),
            'head',
            'head_focus'
        )
        docfields = [self.docfield(field) for field in show_fields]

        # FIXME: how do we hightlight everything in pile during focus?
        w = urwid.Pile(
            [
                urwid.Divider('-'),
                self.rowHeader,
            ] + docfields,
            focus_item=1
        )
        self.__super.__init__(w)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号