Skip to content
Snippets Groups Projects
Commit d8655b22 authored by Michael Mutote's avatar Michael Mutote
Browse files

Merge remote-tracking branch 'origin/main'

# Conflicts:
DisplayWindow.py
parent 47131af3
No related branches found
No related tags found
No related merge requests found
import sys
from PyQt6.QtCore import Qt
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, QDateEdit, QTabWidget)
QLineEdit, QComboBox, QDateEdit, QTabWidget, QCheckBox)
from PyQt6.QtGui import QPalette, QColor, QIcon
......@@ -76,7 +79,7 @@ class MainWindow(QMainWindow):
def update_values(self):
menu_items = {0: 'cut', 1: 'color', 2: 'clarity', 3: 'carat', 4: 'depth', 5: 'table',
6: 'x', 7: 'y', 8: 'z'}
for key,value in menu_items.items():
for key, value in menu_items.items():
print(key)
if key < 3:
RegressionModel.GUI_selections[value] = self.input_fields[key].currentText()
......@@ -91,55 +94,26 @@ class Advanced(QMainWindow):
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', 'Airline', 'Destination', 'Model Start Year']
# self.input_fields = [QDateEdit(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].dateChanged.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]])
central_widget = QWidget(self)
self.setCentralWidget(central_widget)
# Create a grid layout and set it to the central widget
grid_layout = QGridLayout(central_widget)
self.check_labels = ['Cut', 'Colour', 'Clarity', 'Carat', 'Depth', 'Table', 'X', 'Y', 'Z']
self.checkboxes = []
grid_layout.addWidget(QLabel("select features to include in Modelling"), 0, 0)
for i, label in enumerate(self.check_labels):
checkbox = QCheckBox(label, self)
checkbox.setChecked(True)
checkbox.stateChanged.connect(self.handle_checkbox_state) # Connect signal
grid_layout.addWidget(checkbox, i, 1)
self.checkboxes.append(checkbox) # Store checkboxes in the list
def handle_checkbox_state(self):
for i, checkbox in enumerate(self.checkboxes):
state = checkbox.checkState()
RegressionModel.Advanced_selections[checkbox.text()] = (state == Qt.CheckState.Checked)
app = QApplication(sys.argv)
......
......@@ -9,7 +9,10 @@ diamonds = pd.read_csv('diamonds.csv')
cut = list(diamonds["cut"].unique())
colors = list(diamonds["color"].unique())
clarity = list(diamonds["clarity"].unique())
GUI_selections = {}
GUI_selections = {} # user inputs
Advanced_selections = {}
price_caret = []
price = 0
price = 98
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment