summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2023-09-16 09:36:14 -0400
committerLouie S <louie@example.com>2023-09-16 09:36:14 -0400
commite89fd9cb4e88aa8f27f40c5c5073feb1a3aa1ce3 (patch)
tree3c9b0bb7b1c13224784ff7829bc42dac222495d3
parent5648157daee278795ccdd766f0b27f59a7331286 (diff)
Basic dummy body layout
-rwxr-xr-xassignment-list.py2
-rw-r--r--entry.py16
-rw-r--r--group.py49
3 files changed, 66 insertions, 1 deletions
diff --git a/assignment-list.py b/assignment-list.py
index bcb6bd1..535370d 100755
--- a/assignment-list.py
+++ b/assignment-list.py
@@ -3,6 +3,7 @@ import sys
import time
from PyQt5.QtWidgets import QAction, QApplication, QHBoxLayout, QLabel, QMainWindow, QMessageBox, QToolBar, QVBoxLayout, QWidget
from PyQt5.QtGui import QFont
+from PyQt5.QtCore import Qt
from add_group_form import addGroupForm
from group import Group
@@ -50,6 +51,7 @@ class AssignmentList(QMainWindow):
title = QLabel(time.strftime("%A, %b %d %Y"))
title.setFont(QFont("Arial", 17))
+ title.setTextInteractionFlags(Qt.TextSelectableByMouse)
title_h_box = QHBoxLayout()
title_h_box.addStretch()
diff --git a/entry.py b/entry.py
index 3dadb5e..b2877cc 100644
--- a/entry.py
+++ b/entry.py
@@ -1,3 +1,7 @@
+import time
+from PyQt5.QtCore import Qt
+from PyQt5.QtGui import QFont
+from PyQt5.QtWidgets import QLabel
class Entry:
def __init__(self, desc, due = "", due_alt = "", link = ""):
@@ -6,3 +10,15 @@ class Entry:
self.due_alt = due_alt
self.link = link
self.done = False
+
+ def buildLayout(self):
+ output = QLabel()
+ output.setTextInteractionFlags(Qt.TextSelectableByMouse)
+ output.setFont(QFont("Arial", 11))
+
+ output.setText("- ")
+ if(self.due):
+ output.setText(output.text() + time.strftime("%m/%d/%y: "))
+ output.setText(output.text() + self.desc)
+
+ return output
diff --git a/group.py b/group.py
index 1ca8244..aedb300 100644
--- a/group.py
+++ b/group.py
@@ -1,4 +1,9 @@
-from PyQt5.QtWidgets import QLabel, QVBoxLayout
+import datetime
+from PyQt5.QtCore import Qt
+from PyQt5.QtGui import QFont
+from PyQt5.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout
+from add_entry_form import addEntryForm
+from entry import Entry
class Group:
def __init__(self, name, column = "left", link = ""):
@@ -11,5 +16,47 @@ class Group:
output.setContentsMargins(0, 10, 0, 10)
name = QLabel(self.name)
+ name.setTextInteractionFlags(Qt.TextSelectableByMouse)
+ name_font = QFont("Arial", 13)
+ name_font.setUnderline(True)
+ name.setFont(name_font)
output.addWidget(name)
+
+ entries = self.getEntriesFromGroup()
+ entries_vbox = QVBoxLayout()
+ entries_vbox.setContentsMargins(5, 0, 0, 0)
+
+ for e in entries:
+ entries_vbox.addWidget(e.buildLayout())
+ output.addLayout(entries_vbox)
+
+ # Include buttons at the bottom to edit the group
+ buttons_hbox = QHBoxLayout()
+
+ add_entry_button = QPushButton()
+ add_entry_button.setText("Add Entry")
+ add_entry_button.clicked.connect(self.addEntry)
+ buttons_hbox.addWidget(add_entry_button)
+ buttons_hbox.addStretch()
+
+ output.addLayout(buttons_hbox)
+
+ return output
+
+ def addEntry(self):
+ """
+ Open the 'addEntry' form
+ """
+ self.create_new_entry_dialog = addEntryForm()
+ self.create_new_entry_dialog.show()
+
+ def getEntriesFromGroup(self):
+ """
+ Retrieve this group's entries
+ """
+ # TODO this should be pulling from a database
+ output = []
+ output.append(Entry("yeet"))
+ output.append(Entry("bruh", datetime.date(2023, 12, 25)))
+
return output