diff --git a/GUI/win_main.py b/GUI/win_main.py index 1f2b5d4..fb63c77 100644 --- a/GUI/win_main.py +++ b/GUI/win_main.py @@ -128,11 +128,6 @@ def setupUi(self, win_main): self.horizontalLayout_2.addItem(self.horizontalSpacer_2) - self.PlotSettings = QPushButton(self.view_plotview) - self.PlotSettings.setObjectName(u"PlotSettings") - - self.horizontalLayout_2.addWidget(self.PlotSettings) - self.verticalLayout_6.addLayout(self.horizontalLayout_2) @@ -148,7 +143,7 @@ def setupUi(self, win_main): win_main.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(win_main) self.menubar.setObjectName(u"menubar") - self.menubar.setGeometry(QRect(0, 0, 1200, 20)) + self.menubar.setGeometry(QRect(0, 0, 1200, 19)) self.menuDatei = QMenu(self.menubar) self.menuDatei.setObjectName(u"menuDatei") self.menuFenster = QMenu(self.menubar) @@ -206,7 +201,6 @@ def retranslateUi(self, win_main): self.label_2.setText("") self.lab_tableview.setText(QCoreApplication.translate("win_main", u"Table View", None)) self.lab_plotview.setText(QCoreApplication.translate("win_main", u"Plot View", None)) - self.PlotSettings.setText(QCoreApplication.translate("win_main", u"Plot Settings", None)) self.menuDatei.setTitle(QCoreApplication.translate("win_main", u"File", None)) self.menuFenster.setTitle(QCoreApplication.translate("win_main", u"Window", None)) # retranslateUi diff --git a/GUI/win_main.ui b/GUI/win_main.ui index 7e87a33..5b8d899 100644 --- a/GUI/win_main.ui +++ b/GUI/win_main.ui @@ -147,13 +147,6 @@ - - - - Plot Settings - - - @@ -171,7 +164,7 @@ 0 0 1200 - 20 + 19 diff --git a/GUI/win_plotsettings.py b/GUI/win_plotsettings.py deleted file mode 100644 index 1a78a31..0000000 --- a/GUI/win_plotsettings.py +++ /dev/null @@ -1,107 +0,0 @@ -# -*- coding: utf-8 -*- - -################################################################################ -## Form generated from reading UI file 'win_plotsettings.ui' -## -## Created by: Qt User Interface Compiler version 6.2.2 -## -## WARNING! All changes made in this file will be lost when recompiling UI file! -################################################################################ - -from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, - QMetaObject, QObject, QPoint, QRect, - QSize, QTime, QUrl, Qt) -from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, - QFont, QFontDatabase, QGradient, QIcon, - QImage, QKeySequence, QLinearGradient, QPainter, - QPalette, QPixmap, QRadialGradient, QTransform) -from PySide6.QtWidgets import (QAbstractButton, QApplication, QCheckBox, QComboBox, - QDialogButtonBox, QHBoxLayout, QPushButton, QSizePolicy, - QSpacerItem, QVBoxLayout, QWidget) - -class Ui_win_plotsettings(object): - def setupUi(self, win_plotsettings): - if not win_plotsettings.objectName(): - win_plotsettings.setObjectName(u"win_plotsettings") - win_plotsettings.resize(293, 143) - sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(win_plotsettings.sizePolicy().hasHeightForWidth()) - win_plotsettings.setSizePolicy(sizePolicy) - win_plotsettings.setMinimumSize(QSize(293, 143)) - win_plotsettings.setMaximumSize(QSize(293, 143)) - self.verticalLayout = QVBoxLayout(win_plotsettings) - self.verticalLayout.setObjectName(u"verticalLayout") - self.dropdown_trace = QComboBox(win_plotsettings) - self.dropdown_trace.setObjectName(u"dropdown_trace") - - self.verticalLayout.addWidget(self.dropdown_trace) - - self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) - - self.verticalLayout.addItem(self.verticalSpacer) - - self.horizontalLayout = QHBoxLayout() - self.horizontalLayout.setObjectName(u"horizontalLayout") - self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) - - self.horizontalLayout.addItem(self.horizontalSpacer) - - self.visible_switch = QCheckBox(win_plotsettings) - self.visible_switch.setObjectName(u"visible_switch") - font = QFont() - font.setBold(False) - self.visible_switch.setFont(font) - self.visible_switch.setLayoutDirection(Qt.LeftToRight) - - self.horizontalLayout.addWidget(self.visible_switch) - - self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) - - self.horizontalLayout.addItem(self.horizontalSpacer_2) - - - self.verticalLayout.addLayout(self.horizontalLayout) - - self.horizontalLayout_2 = QHBoxLayout() - self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") - self.horizontalSpacer_3 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) - - self.horizontalLayout_2.addItem(self.horizontalSpacer_3) - - self.color_picker = QPushButton(win_plotsettings) - self.color_picker.setObjectName(u"color_picker") - - self.horizontalLayout_2.addWidget(self.color_picker) - - self.horizontalSpacer_4 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) - - self.horizontalLayout_2.addItem(self.horizontalSpacer_4) - - - self.verticalLayout.addLayout(self.horizontalLayout_2) - - self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) - - self.verticalLayout.addItem(self.verticalSpacer_2) - - self.plotsettings_buttons = QDialogButtonBox(win_plotsettings) - self.plotsettings_buttons.setObjectName(u"plotsettings_buttons") - self.plotsettings_buttons.setStandardButtons(QDialogButtonBox.Apply|QDialogButtonBox.Cancel|QDialogButtonBox.Ok) - self.plotsettings_buttons.setCenterButtons(False) - - self.verticalLayout.addWidget(self.plotsettings_buttons) - - - self.retranslateUi(win_plotsettings) - - QMetaObject.connectSlotsByName(win_plotsettings) - # setupUi - - def retranslateUi(self, win_plotsettings): - win_plotsettings.setWindowTitle(QCoreApplication.translate("win_plotsettings", u"Form", None)) - self.visible_switch.setText(QCoreApplication.translate("win_plotsettings", u"Visible", None)) - self.color_picker.setText(QCoreApplication.translate("win_plotsettings", u"Color", None)) - # retranslateUi - diff --git a/GUI/win_plotsettings.ui b/GUI/win_plotsettings.ui deleted file mode 100644 index 84c455a..0000000 --- a/GUI/win_plotsettings.ui +++ /dev/null @@ -1,160 +0,0 @@ - - - win_plotsettings - - - - 0 - 0 - 293 - 143 - - - - - 0 - 0 - - - - - 293 - 143 - - - - - 293 - 143 - - - - Form - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - false - - - - Qt::LeftToRight - - - Visible - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Color - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - false - - - - - - - - diff --git a/main.py b/main.py index 6447c40..37cf777 100644 --- a/main.py +++ b/main.py @@ -2,17 +2,15 @@ from datetime import datetime from random import randint -from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QTableWidgetItem, QColorDialog, QWidget, \ - QMessageBox +from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QTableWidgetItem, QMessageBox from GUI.win_main import Ui_win_main -from GUI.win_plotsettings import Ui_win_plotsettings import pyqtgraph import numpy as np windowtitle = "RC-Car Viewer" data = [] plotcolor = np.array(["red", "blue", "yellow", "green", "magenta", "cyan", "white", "purple", "aqua", "lime", "pink", "grey"]) -datatypes = np.array([[1, 3, "Orientation", "roll", "pitch", "yaw", "", 0, 1, 2, ""], [1, 3, "Acceleration", "ax", "ay", "az", "", 3, 4, 5, ""], [1, 1, "Temperature", "Temp", "", "", "", 6, "", "", ""], [0, 2, "Coordinates", "lat", "lng", "", "", 7, 8, "", ""], [0, 4, "Rotational Velocity", "rpm_rear_l", "rpm_rear_r", "rpm_front_l", "rpm_front_r", 9, 10, 11, 12], [0, 1, "Velocity", "vel_ms", "", "", "", 13, "", "", ""]]) +datatypes = np.array([[1, 3, "Orientation", "roll", "pitch", "yaw", "", 0, 1, 2, ""], [1, 3, "Acceleration", "ax", "ay", "az", "", 3, 4, 5, ""], [1, 1, "Temperature", "Temp", "", "", "", 6, "", "", ""], [0, 4, "Rotational Velocity", "rpm_rear_l", "rpm_rear_r", "rpm_front_l", "rpm_front_r", 7, 8, 9, 10], [0, 1, "Velocity", "vel_ms", "", "", "", 11, "", "", ""], [0, 2, "Coordinates", "lat", "lng", "", "", 12, 13, "", ""]]) def randcolor(): @@ -36,7 +34,6 @@ def __init__(self): self.actionTable_View.triggered.connect(lambda: self.pageswitcher.setCurrentIndex(1)) self.overview_to_plot.clicked.connect(lambda: self.pageswitcher.setCurrentIndex(2)) self.actionPlot_View.triggered.connect(lambda: self.pageswitcher.setCurrentIndex(2)) - self.PlotSettings.clicked.connect(lambda: win_plotsettings.show()) def plot(self, plotdata): timedata = [] @@ -124,61 +121,7 @@ def openfile(self): fileopen = True return fileopen - def show_win_plotsettings(self): - win_plotsettings.show() - - -class WinPlotsettings(QWidget, Ui_win_plotsettings): - # TODO fix plotsettings - global plotcolor - - def __init__(self): - super().__init__() - self.setupUi(self) - self.setWindowTitle("Plot Settings") - for elements in range(len(datatypes)): - if not int(datatypes[elements, 0]) == 2: - self.dropdown_trace.addItem(datatypes[elements, 2]) - self.visible_switch.clicked.connect(self.change_visibility) - self.color_picker.clicked.connect(self.pick_color) - self.color_picker.setEnabled(0) - self.plotsettings_buttons.button(self.plotsettings_buttons.Ok).clicked.connect(self.save_settings) - self.plotsettings_buttons.button(self.plotsettings_buttons.Apply).clicked.connect(self.apply_settings) - self.plotsettings_buttons.button(self.plotsettings_buttons.Cancel).clicked.connect(self.discard_settings) - self.dropdown_trace.currentIndexChanged.connect(self.refresh_visibibity_button) - - def refresh_visibibity_button(self): - self.visible_switch.setChecked(datatypes[self.dropdown_trace.currentIndex(), 0]) - if self.visible_switch.isChecked(): - self.color_picker.setEnabled(1) - else: - self.color_picker.setEnabled(0) - - def change_visibility(self): - if self.visible_switch.isChecked(): - self.color_picker.setEnabled(1) - datatypes[self.dropdown_trace.currentIndex(), 0] = 1 - else: - self.color_picker.setEnabled(0) - datatypes[self.dropdown_trace.currentIndex(), 0] = 0 - - def pick_color(self): - color = QColorDialog.getColor() - plotcolor[self.dropdown_trace.currentIndex()] = color - - def apply_settings(self): - win_main.plot(data) - - def save_settings(self): - win_main.plot(data) - self.close() - - def discard_settings(self): - self.close() - - desktop_app = QApplication() win_main = WinMain() -win_plotsettings = WinPlotsettings() win_main.show() desktop_app.exec()