diff options
author | Louie Shprung <lshprung@scu.edu> | 2023-12-21 13:17:39 -0800 |
---|---|---|
committer | Louie Shprung <lshprung@scu.edu> | 2023-12-21 13:17:39 -0800 |
commit | 65d8cbafe34b946d450ce46703e6449eb9962741 (patch) | |
tree | 9cb2bfa4857507207e8740478e5d23d4421ad784 /src/add_entry_form.py | |
parent | 11373742d701166f2580cfe67015eac012cda1a9 (diff) |
Rename src directory to unique name to avoid install issues
Diffstat (limited to 'src/add_entry_form.py')
-rw-r--r-- | src/add_entry_form.py | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/add_entry_form.py b/src/add_entry_form.py deleted file mode 100644 index 9a2d260..0000000 --- a/src/add_entry_form.py +++ /dev/null @@ -1,51 +0,0 @@ -import os -import sys -from PyQt5 import uic -from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox -from PyQt5.QtCore import QDate -from src.entry import Entry -import src.globals as Globals -import src.db_sqlite as DB - -class addEntryForm(QDialog): - def __init__(self, parent): - super().__init__() - uic.loadUi(os.path.join(os.path.dirname(os.path.abspath(__file__)), - "add_entry_form.ui"), self) - self.initializeUI(parent) - - def initializeUI(self, parent): - self.displayWidgets(parent) - self.exec() - - def displayWidgets(self, parent): - self.new_entry_due.setDate(QDate.currentDate()) - self.buttonBox.rejected.connect(self.close) - self.buttonBox.accepted.connect(lambda: self.handleSubmit(parent)) - - def handleSubmit(self, parent): - # Check that the new entry is not blank - desc_text = self.new_entry_desc.text() - due_text = "" - if self.new_entry_due_checkbox.isChecked(): - due_text = self.new_entry_due.date() # due_text is a QDate - due_alt_text = self.new_entry_due_alt.text() - link_text = self.new_entry_link.text() - color_text = self.new_entry_color.text() - highlight_text = self.new_entry_highlight.text() - - if not desc_text: - QMessageBox.warning(self, "Error Message", - "Description cannot be blank", - QMessageBox.Close, - QMessageBox.Close) - return - - new_id = DB.insertEntry(Entry(0, parent, desc_text, due_text, due_alt_text, link_text, color_text, highlight_text)) - Globals.entries.append(Entry(new_id, parent, desc_text, due_text, due_alt_text, link_text, color_text, highlight_text)) - self.close() - -if __name__ == "__main__": - app = QApplication(sys.argv) - window = addEntryForm() - sys.exit(app.exec_()) |