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
评论列表
文章目录