diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000000000000000000000000000000000..abf67665fbb4b984ee063e339c8d8fb5ff5fe2fa --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,22 @@ +<component name="InspectionProjectProfileManager"> + <profile version="1.0"> + <option name="myName" value="Project Default" /> + <inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true"> + <option name="ignoredErrors"> + <list> + <option value="N806" /> + <option value="N802" /> + <option value="N803" /> + <option value="N814" /> + </list> + </option> + </inspection_tool> + <inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true"> + <option name="ignoredIdentifiers"> + <list> + <option value="list.pop" /> + </list> + </option> + </inspection_tool> + </profile> +</component> \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ +<component name="InspectionProjectProfileManager"> + <settings> + <option name="USE_PROJECT_PROFILE" value="false" /> + <version value="1.0" /> + </settings> +</component> \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..67388a2ac340ca6c17e649492b707758f6f04016 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Black"> + <option name="sdkName" value="Python 3.11 (pythonProject1)" /> + </component> + <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (pythonProject1)" project-jdk-type="Python SDK" /> +</project> \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..fdd8fdfd13437ad5929c98cfa256df55ff0f5e08 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/pythonProject1.iml" filepath="$PROJECT_DIR$/.idea/pythonProject1.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/.idea/pythonProject1.iml b/.idea/pythonProject1.iml new file mode 100644 index 0000000000000000000000000000000000000000..74d515a027de98657e9d3d5f0f1831882fd81374 --- /dev/null +++ b/.idea/pythonProject1.iml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="PYTHON_MODULE" version="4"> + <component name="NewModuleRootManager"> + <content url="file://$MODULE_DIR$"> + <excludeFolder url="file://$MODULE_DIR$/venv" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..94a25f7f4cb416c083d265558da75d457237d671 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/DisplayWindow.py b/DisplayWindow.py new file mode 100644 index 0000000000000000000000000000000000000000..f9282c7115234b067f03b55e9a70c2b96f745fc0 --- /dev/null +++ b/DisplayWindow.py @@ -0,0 +1,74 @@ +import sys +import RegressionModel +from pyqtgraph import PlotWidget, plot +import pyqtgraph as pg +from PyQt6.QtWidgets import (QApplication, QMainWindow, QWidget, + QVBoxLayout, QHBoxLayout, QGridLayout, + QLabel, QPushButton, QSlider, QDateTimeEdit, + QLineEdit, QComboBox) +from PyQt6.QtGui import QPalette, QColor, QIcon + + +class MainWindow(QMainWindow): + + def __init__(self): + super().__init__() + self.setWindowIcon(QIcon("icon.ico")) + self.setMinimumSize(720, 640) + + # Create a central widget + central_widget = QWidget(self) + self.setCentralWidget(central_widget) + + # Create a grid layout and set it to the central widget + grid_layout = QGridLayout(central_widget) + + # Create labels and input fields + self.labels_text = ['Date and Time', 'Airline', 'Destination', 'Model Start Year'] + self.input_fields = [QDateTimeEdit(self), QComboBox(self), QComboBox(self), QComboBox(self)] + self.input_fields[1].addItems(RegressionModel.airlines) + self.input_fields[2].addItems(RegressionModel.destinations) + self.input_fields[3].addItems(list(map(str, RegressionModel.model_years))) + + # Add labels and input fields to the grid layout + for i in range(4): + label = QLabel(self.labels_text[i], self) + grid_layout.addWidget(label, 0, i) + grid_layout.addWidget(self.input_fields[i], 1, i) + + # Connect signals + for i in range(len(self.input_fields)): + if i == 0: + self.input_fields[i].dateTimeChanged.connect(self.update_values) + else: + self.input_fields[i].currentTextChanged.connect(self.update_values) + + # Create a plot widget + graphWidget = pg.PlotWidget(self) + graphWidget.setBackground('w') + graphWidget.plot(RegressionModel.selected_day, RegressionModel.delay) + + # Add the plot widget to the grid layout + grid_layout.addWidget(graphWidget, 2, 0, 1, 4) + grid_layout.addWidget(QLabel("EXPECTED DELAY: ", self), 3, 0, 1, 1) + # Remember to add the delay value here + + self.setWindowTitle('Assistance Systems') + self.show() + + def update_values(self): + menu_items = {0: "date", 1: "airline", 2: "destination", 3: "years to model"} + sender = self.sender() + for i in range(4): + if sender == self.input_fields[i]: + RegressionModel.GUI_selections[menu_items[i]] = sender.currentText() if i != 0 \ + else sender.dateTime() + print(RegressionModel.GUI_selections[menu_items[i]]) + + +app = QApplication(sys.argv) + +window = MainWindow() +window.show() + +app.exec() diff --git a/RegressionModel.py b/RegressionModel.py new file mode 100644 index 0000000000000000000000000000000000000000..a04bac3eb3d0676eeb079797695f27d95c344f16 --- /dev/null +++ b/RegressionModel.py @@ -0,0 +1,11 @@ +# Shared data to GUI +import random + +destinations = ["Tunis", "Paris", "Moscow"] +airlines = ["Air Tunisia", "Air France", "Lufthansa", "Air Zimbabwe"] +model_years = list(i for i in range(2015, 2023)) +selected_day = list(range(366)) +delay = list(random.random() for _ in range(366)) +# Shared Data from GUI +GUI_selections = {"date": "", "airline": "", "destination": "", "years to model": ""} + diff --git a/__pycache__/RegressionModel.cpython-311.pyc b/__pycache__/RegressionModel.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d390e59c4b05a8dc2763de3380de87f60da5751c Binary files /dev/null and b/__pycache__/RegressionModel.cpython-311.pyc differ diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..77fc551287af69e8102f3d85b3c4e4c81e374186 Binary files /dev/null and b/icon.ico differ