summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouie Shprung <lshprung@scu.edu>2023-12-20 11:55:47 -0800
committerLouie Shprung <lshprung@scu.edu>2023-12-20 11:55:47 -0800
commit9a8d1839f23f0cccf4eb7ff91ce575d863d020f6 (patch)
treeddd9cc1d44deba84e3ac5ea72aa3fad3db6e1922 /src
parentb0e7885074a6a97794fedafb56976bfb67a21a74 (diff)
Created UI file for main window
Diffstat (limited to 'src')
-rw-r--r--src/main.py118
-rw-r--r--src/main.ui207
2 files changed, 266 insertions, 59 deletions
diff --git a/src/main.py b/src/main.py
index fed6830..9e6f4c0 100644
--- a/src/main.py
+++ b/src/main.py
@@ -1,7 +1,9 @@
#!/usr/bin/python3
+import os
import sys
import time
-from PyQt5.QtWidgets import QAction, QApplication, QGridLayout, QHBoxLayout, QLabel, QMainWindow, QMenu, QMessageBox, QScrollArea, QToolBar, QVBoxLayout, QWidget
+from PyQt5 import uic
+from PyQt5.QtWidgets import QAction, QApplication, QGridLayout, QHBoxLayout, QLabel, QMainWindow, QMenu, QMessageBox, QScrollArea, QVBoxLayout, QWidget
from PyQt5.QtGui import QCursor, QFont
from PyQt5.QtCore import QDate, Qt
from src.config import Config
@@ -17,12 +19,13 @@ from src.rules_dialog import RulesDialog
class AssignmentList(QMainWindow):
def __init__(self):
super().__init__()
+ uic.loadUi(os.path.join("src", "main.ui"), self)
self.initializeUI()
def initializeUI(self):
- self.resize(640, 480)
- self.setWindowTitle("Assignment List")
+ #self.resize(640, 480)
+ #self.setWindowTitle("Assignment List")
self.createMenu()
self.createToolbar()
Config()
@@ -31,72 +34,69 @@ class AssignmentList(QMainWindow):
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")
-
- self.preferences_act = QAction("Preferences", self)
- self.preferences_act.setShortcut("Alt+Return")
- self.preferences_act.triggered.connect(self.preferences)
- file_menu.addAction(self.preferences_act)
- self.reload_act = QAction("Reload", self)
- self.reload_act.setShortcut("F5")
- self.reload_act.triggered.connect(self.reload)
- file_menu.addAction(self.reload_act)
- file_menu.addSeparator()
- 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)
- edit_menu.addSeparator()
- self.clean_hidden_act = QAction("Permanently Delete Removed Groups and Entries", self)
- self.clean_hidden_act.triggered.connect(self.cleanHidden)
- edit_menu.addAction(self.clean_hidden_act)
-
- about_act = QAction("About", self)
- about_act.triggered.connect(self.aboutDialog)
- help_menu.addAction(about_act)
+ #menu_bar = self.menuBar()
+ #file_menu = menu_bar.addMenu("File")
+ #edit_menu = menu_bar.addMenu("Edit")
+ #help_menu = menu_bar.addMenu("Help")
+
+ #self.preferences_act = QAction("Preferences", self)
+ #self.preferences_act.setShortcut("Alt+Return")
+ self.actionPreferences.triggered.connect(self.preferences)
+ #file_menu.addAction(self.preferences_act)
+ #self.reload_act = QAction("Reload", self)
+ #self.reload_act.setShortcut("F5")
+ self.actionReload.triggered.connect(self.reload)
+ #file_menu.addAction(self.reload_act)
+ #file_menu.addSeparator()
+ #exit_act = QAction("Exit", self)
+ #exit_act.setShortcut("Ctrl+Q")
+ self.actionExit.triggered.connect(self.close)
+ #file_menu.addAction(exit_act)
+
+ #self.add_group_act = QAction("Add Group", self)
+ self.actionAdd_Group.triggered.connect(self.addGroup)
+ #self.actionAdd_Group.addAction(self.add_group_act)
+ #edit_menu.addSeparator()
+ #self.clean_hidden_act = QAction("Permanently Delete Removed Groups and Entries", self)
+ self.actionClean_Hidden.triggered.connect(self.cleanHidden)
+ #edit_menu.addAction(self.clean_hidden_act)
+
+ #about_act = QAction("About", self)
+ self.actionAbout.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)
+ self.toolBar.addAction(self.actionAdd_Group)
def setupDB(self):
DB.initDB()
def displayWidgets(self):
- main_widget_scroll_area = QScrollArea(self)
- main_widget_scroll_area.setWidgetResizable(True)
- main_widget = QWidget()
- self.setCentralWidget(main_widget_scroll_area)
-
- title = QLabel(time.strftime("%A, %b %d %Y"))
- title.setFont(QFont("Arial", 17))
- title.setTextInteractionFlags(Qt.TextSelectableByMouse)
-
- title_h_box = QHBoxLayout()
- title_h_box.addStretch()
- title_h_box.addWidget(title)
- title_h_box.addStretch()
-
- self.groups_layout = QGridLayout()
- self.groups_layout.setContentsMargins(20, 5, 20, 5)
+ #main_widget_scroll_area = QScrollArea(self)
+ #main_widget_scroll_area.setWidgetResizable(True)
+ #main_widget = QWidget()
+ #self.setCentralWidget(main_widget_scroll_area)
+
+ self.title.setText(time.strftime("%A, %b %d %Y"))
+ #self.title.setFont(QFont("Arial", 17))
+ #self.title.setTextInteractionFlags(Qt.TextSelectableByMouse)
+
+ #title_h_box = QHBoxLayout()
+ #title_h_box.addStretch()
+ #title_h_box.addWidget(title)
+ #title_h_box.addStretch()
+
+ #self.groups_layout = QGridLayout()
+ #self.groups_layout.setContentsMargins(20, 5, 20, 5)
self.drawGroups()
- v_box = QVBoxLayout()
- v_box.addLayout(title_h_box)
- v_box.addLayout(self.groups_layout)
- v_box.addStretch()
+ #v_box = QVBoxLayout()
+ #v_box.addLayout(title_h_box)
+ #v_box.addLayout(self.groups_layout)
+ #v_box.addStretch()
- main_widget.setLayout(v_box)
- main_widget_scroll_area.setWidget(main_widget)
+ #main_widget.setLayout(v_box)
+ #main_widget_scroll_area.setWidget(main_widget)
def addGroup(self):
"""
diff --git a/src/main.ui b/src/main.ui
new file mode 100644
index 0000000..bc3c0fb
--- /dev/null
+++ b/src/main.ui
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>640</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Assignment List</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents_3">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>620</width>
+ <height>421</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="v_box">
+ <item>
+ <layout class="QHBoxLayout" name="title_h_box">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="title">
+ <property name="font">
+ <font>
+ <family>Arial</family>
+ <pointsize>17</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>[DATE]</string>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="groups_layout">
+ <property name="leftMargin">
+ <number>20</number>
+ </property>
+ <property name="topMargin">
+ <number>5</number>
+ </property>
+ <property name="rightMargin">
+ <number>20</number>
+ </property>
+ <property name="bottomMargin">
+ <number>5</number>
+ </property>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>640</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>File</string>
+ </property>
+ <addaction name="actionPreferences"/>
+ <addaction name="actionReload"/>
+ <addaction name="separator"/>
+ <addaction name="actionExit"/>
+ </widget>
+ <widget class="QMenu" name="menuEdit">
+ <property name="title">
+ <string>Edit</string>
+ </property>
+ <addaction name="actionAdd_Group"/>
+ <addaction name="separator"/>
+ <addaction name="actionClean_Hidden"/>
+ </widget>
+ <widget class="QMenu" name="menuHelp">
+ <property name="title">
+ <string>Help</string>
+ </property>
+ <addaction name="actionAbout"/>
+ </widget>
+ <addaction name="menuFile"/>
+ <addaction name="menuEdit"/>
+ <addaction name="menuHelp"/>
+ </widget>
+ <widget class="QToolBar" name="toolBar">
+ <property name="windowTitle">
+ <string>toolBar</string>
+ </property>
+ <attribute name="toolBarArea">
+ <enum>TopToolBarArea</enum>
+ </attribute>
+ <attribute name="toolBarBreak">
+ <bool>false</bool>
+ </attribute>
+ </widget>
+ <action name="actionPreferences">
+ <property name="text">
+ <string>Preferences</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+Return</string>
+ </property>
+ </action>
+ <action name="actionReload">
+ <property name="text">
+ <string>Reload</string>
+ </property>
+ <property name="shortcut">
+ <string>F5</string>
+ </property>
+ </action>
+ <action name="actionExit">
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Q</string>
+ </property>
+ </action>
+ <action name="actionAdd_Group">
+ <property name="text">
+ <string>Add Group</string>
+ </property>
+ </action>
+ <action name="actionClean_Hidden">
+ <property name="text">
+ <string>Permanently Delete Removed Groups and Entries</string>
+ </property>
+ </action>
+ <action name="actionAbout">
+ <property name="text">
+ <string>About</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>