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
commit5648157daee278795ccdd766f0b27f59a7331286 (patch)
tree6ecd85df7a5c0befac4d7fc1f369ba31fd2e6582
First commit
-rw-r--r--.gitignore1
-rw-r--r--add_entry_form.py62
-rw-r--r--add_group_form.py54
-rwxr-xr-xassignment-list.py121
-rw-r--r--entry.py8
-rw-r--r--group.py15
6 files changed, 261 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bee8a64
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+__pycache__
diff --git a/add_entry_form.py b/add_entry_form.py
new file mode 100644
index 0000000..6449076
--- /dev/null
+++ b/add_entry_form.py
@@ -0,0 +1,62 @@
+#!/usr/bin/python3
+import sys
+from PyQt5.QtWidgets import QApplication, QDateTimeEdit, QFormLayout, QHBoxLayout, QLabel, QLineEdit, QPushButton, QWidget
+from PyQt5.QtGui import QFont
+from PyQt5.QtCore import QDate, Qt
+
+class addEntryForm(QWidget):
+ def __init__(self):
+ super().__init__()
+ self.initializeUI()
+
+ def initializeUI(self):
+ self.resize(400, 1)
+ self.setWindowTitle("Add Entry")
+ self.displayWidgets()
+ self.show()
+
+ def displayWidgets(self):
+ entry_form_layout = QFormLayout()
+
+ title = QLabel("Add Entry")
+ title.setFont(QFont("Arial", 18))
+ title.setAlignment(Qt.AlignCenter)
+ entry_form_layout.addRow(title)
+
+ new_entry_desc = QLineEdit()
+ entry_form_layout.addRow("Description:", new_entry_desc)
+
+ new_entry_due = QDateTimeEdit(QDate.currentDate())
+ new_entry_due.setDisplayFormat("MM/dd/yyyy")
+ entry_form_layout.addRow("Due Date:", new_entry_due)
+
+ new_entry_due_alt = QLineEdit()
+ entry_form_layout.addRow("Due Date (Alt):", new_entry_due_alt)
+
+ new_entry_link = QLineEdit() # TODO see if there is a widget specifically for URLs
+ entry_form_layout.addRow("Link:", new_entry_link)
+
+ # TODO:
+ # color
+ # highlight
+ # depends
+
+ # Submit and cancel buttons
+ buttons_h_box = QHBoxLayout()
+ buttons_h_box.addStretch()
+ close_button = QPushButton("Cancel")
+ close_button.clicked.connect(self.close)
+ buttons_h_box.addWidget(close_button)
+ submit_button = QPushButton("Submit")
+ submit_button.clicked.connect(self.close) # TODO connect this to a real method
+ buttons_h_box.addWidget(submit_button)
+ buttons_h_box.addStretch()
+
+ entry_form_layout.addRow(buttons_h_box)
+
+ self.setLayout(entry_form_layout)
+
+if __name__ == "__main__":
+ app = QApplication(sys.argv)
+ window = addEntryForm()
+ sys.exit(app.exec_())
diff --git a/add_group_form.py b/add_group_form.py
new file mode 100644
index 0000000..f4c4d6a
--- /dev/null
+++ b/add_group_form.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python3
+import sys
+from PyQt5.QtWidgets import QApplication, QComboBox, QFormLayout, QHBoxLayout, QLabel, QLineEdit, QPushButton, QWidget
+from PyQt5.QtGui import QFont
+from PyQt5.QtCore import Qt
+
+class addGroupForm(QWidget):
+ def __init__(self):
+ super().__init__()
+ self.initializeUI()
+
+ def initializeUI(self):
+ self.resize(400, 1)
+ self.setWindowTitle("Add Group")
+ self.displayWidgets()
+ self.show()
+
+ def displayWidgets(self):
+ group_form_layout = QFormLayout()
+
+ title = QLabel("Add Group")
+ title.setFont(QFont("Arial", 18))
+ title.setAlignment(Qt.AlignCenter)
+ group_form_layout.addRow(title)
+
+ new_group_name = QLineEdit()
+ group_form_layout.addRow("Name:", new_group_name)
+
+ new_group_column = QComboBox()
+ new_group_column.addItems(["Left", "Right"])
+ group_form_layout.addRow("Column:", new_group_column)
+
+ new_group_link = QLineEdit() # TODO see if there is a widget specifically for URLs
+ group_form_layout.addRow("Link:", new_group_link)
+
+ # Submit and cancel buttons
+ buttons_h_box = QHBoxLayout()
+ buttons_h_box.addStretch()
+ close_button = QPushButton("Cancel")
+ close_button.clicked.connect(self.close)
+ buttons_h_box.addWidget(close_button)
+ submit_button = QPushButton("Submit")
+ submit_button.clicked.connect(self.close) # TODO connect this to a real method
+ buttons_h_box.addWidget(submit_button)
+ buttons_h_box.addStretch()
+
+ group_form_layout.addRow(buttons_h_box)
+
+ self.setLayout(group_form_layout)
+
+if __name__ == "__main__":
+ app = QApplication(sys.argv)
+ window = addGroupForm()
+ sys.exit(app.exec_())
diff --git a/assignment-list.py b/assignment-list.py
new file mode 100755
index 0000000..bcb6bd1
--- /dev/null
+++ b/assignment-list.py
@@ -0,0 +1,121 @@
+#!/usr/bin/python3
+import sys
+import time
+from PyQt5.QtWidgets import QAction, QApplication, QHBoxLayout, QLabel, QMainWindow, QMessageBox, QToolBar, QVBoxLayout, QWidget
+from PyQt5.QtGui import QFont
+from add_group_form import addGroupForm
+from group import Group
+
+class AssignmentList(QMainWindow):
+ def __init__(self):
+ super().__init__()
+ self.initializeUI()
+
+ def initializeUI(self):
+ self.resize(640, 480)
+ self.setWindowTitle("Assignment List")
+ self.createMenu()
+ self.createToolbar()
+ self.displayWidgets()
+ self.show()
+
+ def createMenu(self):
+ menu_bar = self.menuBar()
+ file_menu = menu_bar.addMenu("File")
+ edit_menu = menu_bar.addMenu("Edit")
+ help_menu = menu_bar.addMenu("Help")
+
+ exit_act = QAction("Exit", self)
+ exit_act.setShortcut("Ctrl+Q")
+ exit_act.triggered.connect(self.close)
+ file_menu.addAction(exit_act)
+
+ self.add_group_act = QAction("Add Group", self)
+ self.add_group_act.triggered.connect(self.addGroup)
+ edit_menu.addAction(self.add_group_act)
+
+ about_act = QAction("About", self)
+ about_act.triggered.connect(self.aboutDialog)
+ help_menu.addAction(about_act)
+
+ def createToolbar(self):
+ tool_bar = QToolBar("Toolbar")
+ self.addToolBar(tool_bar)
+
+ tool_bar.addAction(self.add_group_act)
+
+ def displayWidgets(self):
+ main_widget = QWidget(self)
+ self.setCentralWidget(main_widget)
+
+ title = QLabel(time.strftime("%A, %b %d %Y"))
+ title.setFont(QFont("Arial", 17))
+
+ title_h_box = QHBoxLayout()
+ title_h_box.addStretch()
+ title_h_box.addWidget(title)
+ title_h_box.addStretch()
+
+ self.load_groups()
+ self.drawGroups()
+
+ v_box = QVBoxLayout()
+ v_box.addLayout(title_h_box)
+ v_box.addLayout(self.groups_hbox)
+ v_box.addStretch()
+
+ main_widget.setLayout(v_box)
+
+ def addGroup(self):
+ """
+ Open the 'addGroup' form
+ """
+ self.create_new_group_dialog = addGroupForm()
+ self.create_new_group_dialog.show()
+
+ def drawGroups(self):
+ """
+ Redraw the groups_hbox
+ """
+ # Reset layout
+ self.groups_hbox = QHBoxLayout()
+ self.groups_hbox.setContentsMargins(20, 5, 20, 5)
+
+ # Create columns as vertical boxes
+ column_left = QVBoxLayout()
+ column_right = QVBoxLayout()
+
+ for g in self.groups:
+ if g.column == "left":
+ column_left.addLayout(g.buildLayout())
+ else:
+ column_right.addLayout(g.buildLayout())
+
+ column_left.addStretch()
+ column_right.addStretch()
+
+ self.groups_hbox.addLayout(column_left)
+ self.groups_hbox.addStretch()
+ self.groups_hbox.addLayout(column_right)
+ self.groups_hbox.addStretch()
+
+ def aboutDialog(self):
+ QMessageBox.about(self, "About Assignment List",
+ "Created by Louie S. - 2023")
+
+ def load_groups(self):
+ """
+ Load groups data
+ """
+ # TODO this is debug for now, with fixed values
+ self.groups = []
+ self.groups.append(Group("test1", "left"))
+ self.groups.append(Group("test2", "left"))
+ self.groups.append(Group("test3", "right"))
+ self.groups.append(Group("test4", "right"))
+
+if __name__ == "__main__":
+ app = QApplication(sys.argv)
+ window = AssignmentList()
+ sys.exit(app.exec_())
+
diff --git a/entry.py b/entry.py
new file mode 100644
index 0000000..3dadb5e
--- /dev/null
+++ b/entry.py
@@ -0,0 +1,8 @@
+
+class Entry:
+ def __init__(self, desc, due = "", due_alt = "", link = ""):
+ self.desc = desc
+ self.due = due
+ self.due_alt = due_alt
+ self.link = link
+ self.done = False
diff --git a/group.py b/group.py
new file mode 100644
index 0000000..1ca8244
--- /dev/null
+++ b/group.py
@@ -0,0 +1,15 @@
+from PyQt5.QtWidgets import QLabel, QVBoxLayout
+
+class Group:
+ def __init__(self, name, column = "left", link = ""):
+ self.name = name
+ self.column = column
+ self.link = link
+
+ def buildLayout(self):
+ output = QVBoxLayout()
+ output.setContentsMargins(0, 10, 0, 10)
+
+ name = QLabel(self.name)
+ output.addWidget(name)
+ return output