summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/add_group_form.py42
-rw-r--r--src/add_group_form.ui131
2 files changed, 137 insertions, 36 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>172</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Add Entry</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="title">
+ <property name="font">
+ <font>
+ <family>Arial</family>
+ <pointsize>18</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Add Group</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="descriptionLabel">
+ <property name="text">
+ <string>Name:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="new_group_name"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="dueDateLabel">
+ <property name="text">
+ <string>Column:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="new_group_column">
+ <item>
+ <property name="text">
+ <string>Left</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Right</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="linkLabel">
+ <property name="text">
+ <string>Link:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QLineEdit" name="new_group_link"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="layoutDirection">
+ <enum>Qt::RightToLeft</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ <property name="centerButtons">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>Dialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>Dialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>