From 65d8cbafe34b946d450ce46703e6449eb9962741 Mon Sep 17 00:00:00 2001 From: Louie Shprung Date: Thu, 21 Dec 2023 13:17:39 -0800 Subject: Rename src directory to unique name to avoid install issues --- src/edit_group_form.py | 63 -------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 src/edit_group_form.py (limited to 'src/edit_group_form.py') diff --git a/src/edit_group_form.py b/src/edit_group_form.py deleted file mode 100644 index cd01162..0000000 --- a/src/edit_group_form.py +++ /dev/null @@ -1,63 +0,0 @@ -import os -import sys -from PyQt5 import uic -from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox - -import src.globals as Globals -from src.group import Group -import src.db_sqlite as DB - -class editGroupForm(QDialog): - """ - Form to edit/update a group - """ - def __init__(self, id): - self.id = id - super().__init__() - uic.loadUi(os.path.join(os.path.dirname(os.path.abspath(__file__)), - "add_group_form.ui"), self) - self.initializeUI() - - def initializeUI(self): - self.setWindowTitle("Edit Group") - self.displayWidgets() - self.exec() - - def displayWidgets(self): - group = list(filter(lambda g: g.id == self.id, Globals.groups))[0] - - self.title.setText("Edit Group") - self.new_group_name.setText(group.name) - self.new_group_column.setCurrentIndex(0 if group.column.lower() == "left" else 1) - self.new_group_link.setText(group.link) - self.buttonBox.rejected.connect(self.close) - self.buttonBox.accepted.connect(self.handleSubmit) - - def handleSubmit(self): - name_text = self.new_group_name.text() - column_text = self.new_group_column.currentText() - link_text = self.new_group_link.text() - - if not name_text: - QMessageBox.warning(self, "Error Message", - "Name cannot be blank", - QMessageBox.Close, - QMessageBox.Close) - return - - # Update DB - group = list(filter(lambda g: g.id == self.id, Globals.groups))[0] - group.name = name_text - group.column = column_text - group.link = link_text - DB.updateGroup(group) - - # Update global variables - Globals.groups = list(filter(lambda g: g.id != self.id, Globals.groups)) - Globals.groups.append(Group(self.id, name_text, column_text, link_text, group.hidden)) - self.close() - -if __name__ == "__main__": - app = QApplication(sys.argv) - window = editGroupForm() - sys.exit(app.exec_()) -- cgit