notes_list_widget.py 文件源码

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

项目:Enibar 作者: ENIB 项目源码 文件源码
def build(self, notes_list):
        """ Fill the list with notes from notes_list, coloring negatives one
            in red """
        self.nb_shown = 0
        current_time = time.time()
        for note in notes_list:
            widget = QtWidgets.QListWidgetItem(note["nickname"], self)
            if current_time - note["birthdate"] < 18 * 365 * 24 * 3600:
                if note['note'] < 0:
                    widget.setBackground(self.minors_overdraft)
                else:
                    widget.setBackground(self.minors_color)
            elif note['note'] < 0:
                widget.setBackground(self.overdraft_color)

            if not note['nickname'].lower().startswith(self.search_text):
                widget.setHidden(True)
                return
            self.nb_shown += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号