diff options
author | Louie S <louie@example.com> | 2023-09-16 09:36:14 -0400 |
---|---|---|
committer | Louie S <louie@example.com> | 2023-09-16 09:36:14 -0400 |
commit | 8dbf2bfa796f63ca9628ee3395aaa52af247b7ab (patch) | |
tree | 241a6c41863cd9363648c59ab4d09194a2252fd3 /entry.py | |
parent | 8e288c4b141df0805f63450079f6a0f5cf9e8f37 (diff) |
Done toggle for entries working
Diffstat (limited to 'entry.py')
-rw-r--r-- | entry.py | 33 |
1 files changed, 25 insertions, 8 deletions
@@ -1,7 +1,6 @@ -import time from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont -from PyQt5.QtWidgets import QLabel +from PyQt5.QtWidgets import QHBoxLayout, QLabel class Entry: def __init__(self, id, parent_id, desc, due = "", due_alt = "", link = "", done = False, hidden = False): @@ -15,13 +14,31 @@ class Entry: self.hidden = hidden def buildLayout(self): - output = QLabel() - output.setTextInteractionFlags(Qt.TextSelectableByMouse) - output.setFont(QFont("Arial", 11)) + output = QHBoxLayout() + bullet = QLabel() + body = QLabel() + + body.setTextInteractionFlags(Qt.TextSelectableByMouse) + + bullet.setFont(QFont("Arial", 11)) + body.setFont(QFont("Arial", 11)) + + if self.done: + bullet.setText("\u2713 ") + else: + bullet.setText("- ") + output.addWidget(bullet) - output.setText("- ") if(self.due): - output.setText(output.text() + "{0}/{1}/{2}: ".format(self.due.month(), self.due.day(), self.due.year())) - output.setText(output.text() + self.desc) + body.setText("{0}/{1}/{2}: ".format(self.due.month(), self.due.day(), self.due.year())) + body.setText(body.text() + self.desc) + output.addWidget(body) + + output.addStretch() + + if self.done: + font = body.font() + font.setStrikeOut(True) + body.setFont(font) return output |