From 296957cd555e638aa826cdabd42e36964862c27d Mon Sep 17 00:00:00 2001 From: Louie Shprung Date: Thu, 21 Dec 2023 10:09:03 -0800 Subject: Created UI file for add_group_form --- src/add_group_form.py | 42 +++------------- src/add_group_form.ui | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 36 deletions(-) create mode 100644 src/add_group_form.ui (limited to 'src') diff --git a/src/add_group_form.py b/src/add_group_form.py index b7144d0..0d35777 100644 --- a/src/add_group_form.py +++ b/src/add_group_form.py @@ -1,7 +1,7 @@ +import os import sys -from PyQt5.QtWidgets import QApplication, QComboBox, QDialog, QFormLayout, QHBoxLayout, QLabel, QLineEdit, QMessageBox, QPushButton -from PyQt5.QtGui import QFont -from PyQt5.QtCore import Qt +from PyQt5 import uic +from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox import src.globals as Globals from src.group import Group @@ -13,46 +13,16 @@ class addGroupForm(QDialog): """ def __init__(self): super().__init__() + uic.loadUi(os.path.join("src", "add_group_form.ui"), self) self.initializeUI() def initializeUI(self): - self.resize(400, 1) - self.setWindowTitle("Add Group") self.displayWidgets() self.exec() 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) - - self.new_group_name = QLineEdit() - group_form_layout.addRow("Name:", self.new_group_name) - - self.new_group_column = QComboBox() - self.new_group_column.addItems(["Left", "Right"]) - group_form_layout.addRow("Column:", self.new_group_column) - - self.new_group_link = QLineEdit() # TODO see if there is a widget specifically for URLs - group_form_layout.addRow("Link:", self.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.handleSubmit) - buttons_h_box.addWidget(submit_button) - buttons_h_box.addStretch() - - group_form_layout.addRow(buttons_h_box) - - self.setLayout(group_form_layout) + self.buttonBox.rejected.connect(self.close) + self.buttonBox.accepted.connect(self.handleSubmit) def handleSubmit(self): name_text = self.new_group_name.text() diff --git a/src/add_group_form.ui b/src/add_group_form.ui new file mode 100644 index 0000000..c3c5c80 --- /dev/null +++ b/src/add_group_form.ui @@ -0,0 +1,131 @@ + + + Dialog + + + + 0 + 0 + 400 + 172 + + + + Add Entry + + + + + + + + + Arial + 18 + + + + Add Group + + + Qt::AlignCenter + + + + + + + Name: + + + + + + + + + + Column: + + + + + + + + Left + + + + + Right + + + + + + + + Link: + + + + + + + + + + + + Qt::RightToLeft + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + true + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + -- cgit