summaryrefslogtreecommitdiff
path: root/src/progressBar
diff options
context:
space:
mode:
Diffstat (limited to 'src/progressBar')
-rw-r--r--src/progressBar/icons/dark_mode.pngbin0 -> 951 bytes
-rw-r--r--src/progressBar/icons/light_mode.pngbin0 -> 989 bytes
-rw-r--r--src/progressBar/progressBar.py145
-rw-r--r--src/progressBar/progressBar.ui150
-rw-r--r--src/progressBar/progressBarOld.py110
5 files changed, 405 insertions, 0 deletions
diff --git a/src/progressBar/icons/dark_mode.png b/src/progressBar/icons/dark_mode.png
new file mode 100644
index 00000000..a29b53f6
--- /dev/null
+++ b/src/progressBar/icons/dark_mode.png
Binary files differ
diff --git a/src/progressBar/icons/light_mode.png b/src/progressBar/icons/light_mode.png
new file mode 100644
index 00000000..b40872c4
--- /dev/null
+++ b/src/progressBar/icons/light_mode.png
Binary files differ
diff --git a/src/progressBar/progressBar.py b/src/progressBar/progressBar.py
new file mode 100644
index 00000000..f0aa964f
--- /dev/null
+++ b/src/progressBar/progressBar.py
@@ -0,0 +1,145 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'progressBar.ui'
+#
+# Created by: PyQt5 UI code generator 5.15.6
+#
+# WARNING: Any manual changes made to this file will be lost when pyuic5 is
+# run again. Do not edit this file unless you know what you are doing.
+
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+
+class Ui_Form(object):
+ def __init__(self, qProcess, simulationEssentials):
+ self.qProcess = qProcess
+ self.qTimer = simulationEssentials['timer']
+ self.enableButtons = simulationEssentials['enableButtons']
+ self.isSimulationSuccess = simulationEssentials['isSimulationSuccess']
+ # super().__init__()
+ def setupUi(self, Form):
+ Form.setObjectName("Form")
+ Form.resize(1244, 644)
+ self.verticalLayoutWidget = QtWidgets.QWidget(Form)
+ self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 1131, 471))
+ self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
+ self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
+ self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
+ self.verticalLayout.setContentsMargins(15, 15, 15, 15)
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.horizontalLayout = QtWidgets.QHBoxLayout()
+ self.horizontalLayout.setContentsMargins(-1, -1, -1, 0)
+ self.horizontalLayout.setSpacing(6)
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.progressBar = QtWidgets.QProgressBar(self.verticalLayoutWidget)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.progressBar.sizePolicy().hasHeightForWidth())
+ self.progressBar.setSizePolicy(sizePolicy)
+ self.progressBar.setMaximumSize(QtCore.QSize(16777215, 35))
+ self.progressBar.setStyleSheet("QProgressBar::chunk {\n"
+" background-color: rgb(54,158,225);\n"
+"}")
+ self.progressBar.setMaximum(0)
+ self.progressBar.setProperty("value", -1)
+ self.progressBar.setFormat("")
+ self.progressBar.setObjectName("progressBar")
+ self.horizontalLayout.addWidget(self.progressBar)
+ self.cancel_simulation_button = QtWidgets.QPushButton(self.verticalLayoutWidget)
+ self.cancel_simulation_button.setMaximumSize(QtCore.QSize(16777215, 35))
+ self.cancel_simulation_button.setObjectName("cancel_simulation_button")
+ self.horizontalLayout.addWidget(self.cancel_simulation_button)
+ self.light_dark_mode_button = QtWidgets.QPushButton(self.verticalLayoutWidget)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.light_dark_mode_button.sizePolicy().hasHeightForWidth())
+ self.light_dark_mode_button.setSizePolicy(sizePolicy)
+ self.light_dark_mode_button.setMaximumSize(QtCore.QSize(35, 35))
+ self.light_dark_mode_button.setText("")
+ self.light_dark_mode_button.setObjectName("light_dark_mode_button")
+ self.horizontalLayout.addWidget(self.light_dark_mode_button)
+ self.verticalLayout.addLayout(self.horizontalLayout)
+ self.simulationConsole = QtWidgets.QTextEdit(self.verticalLayoutWidget)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.simulationConsole.sizePolicy().hasHeightForWidth())
+ self.simulationConsole.setSizePolicy(sizePolicy)
+ self.simulationConsole.setMinimumSize(QtCore.QSize(0, 400))
+ self.simulationConsole.setStyleSheet("QTextEdit {\n"
+" background-color: rgb(36, 31, 49);\n"
+" color: white;\n"
+"}")
+ self.simulationConsole.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
+ self.simulationConsole.setObjectName("simulationConsole")
+ self.verticalLayout.addWidget(self.simulationConsole)
+
+ self.retranslateUi(Form)
+ QtCore.QMetaObject.connectSlotsByName(Form)
+
+ def retranslateUi(self, Form):
+ _translate = QtCore.QCoreApplication.translate
+ Form.setWindowTitle(_translate("Form", "Form"))
+ self.cancel_simulation_button.setText(_translate("Form", "Cancel Simulation"))
+ self.simulationConsole.setHtml(_translate("Form", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Ubuntu\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The quick brown fox jumped over the lazy dog</p></body></html>"))
+
+ self.simulationConsole.setText("")
+
+ self.dark_color = True
+ self.light_dark_mode_button.setIcon(QtGui.QIcon("icons/light_mode.png"))
+ self.light_dark_mode_button.clicked.connect(self.changeColor)
+
+ self.cancel_simulation_button.clicked.connect(self.cancelSimulation)
+
+ def writeIntoConsole(self, consoleLog):
+ self.simulationConsole.insertPlainText(consoleLog)
+
+ def writeSimulationStatusToConsole(self, isSuccess):
+ failedFormat = '<span style="color:red;">{}</span>'
+ successFormat = '<span style="color:green;">{}</span>'
+
+ if isSuccess:
+ self.simulationConsole.append(successFormat.format("Simulation Completed Successfully!"))
+ else:
+ self.simulationConsole.append(failedFormat.format("Simulation Failed!"))
+
+ def showProgressCompleted(self):
+ self.progressBar.setMaximum(100)
+ self.progressBar.setProperty("value", 100)
+
+ def cancelSimulation(self):
+ self.qTimer.stop()
+ self.qProcess.kill()
+ self.showProgressCompleted()
+
+ def changeColor(self):
+ if self.dark_color is True:
+ self.simulationConsole.setStyleSheet("QTextEdit {\n"
+ " background-color: white;\n"
+ " color: black;\n"
+ "}")
+ self.light_dark_mode_button.setIcon(QtGui.QIcon("icons/dark_mode.png"))
+ self.dark_color = False
+ else:
+ self.simulationConsole.setStyleSheet("QTextEdit {\n"
+ " background-color: rgb(36, 31, 49);\n"
+ " color: white;\n"
+ "}")
+ self.light_dark_mode_button.setIcon(QtGui.QIcon("icons/light_mode.png"))
+ self.dark_color = True
+
+if __name__ == "__main__":
+ import sys
+ app = QtWidgets.QApplication(sys.argv)
+ Form = QtWidgets.QWidget()
+ ui = Ui_Form()
+ ui.setupUi(Form)
+ Form.show()
+ sys.exit(app.exec_())
diff --git a/src/progressBar/progressBar.ui b/src/progressBar/progressBar.ui
new file mode 100644
index 00000000..c85c0788
--- /dev/null
+++ b/src/progressBar/progressBar.ui
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1244</width>
+ <height>644</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <widget class="QWidget" name="verticalLayoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>1131</width>
+ <height>471</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <property name="leftMargin">
+ <number>15</number>
+ </property>
+ <property name="topMargin">
+ <number>15</number>
+ </property>
+ <property name="rightMargin">
+ <number>15</number>
+ </property>
+ <property name="bottomMargin">
+ <number>15</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QProgressBar" name="progressBar">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>35</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QProgressBar::chunk {
+ background-color: rgb(54,158,225);
+}</string>
+ </property>
+ <property name="maximum">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>-1</number>
+ </property>
+ <property name="format">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancel_simulation_button">
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>35</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Cancel Simulation</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="light_dark_mode_button">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>35</width>
+ <height>35</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="simulationConsole">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>400</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QTextEdit {
+ background-color: rgb(36, 31, 49);
+ color: white;
+}</string>
+ </property>
+ <property name="html">
+ <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The quick brown fox jumped over the lazy dog&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::NoTextInteraction</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/progressBar/progressBarOld.py b/src/progressBar/progressBarOld.py
new file mode 100644
index 00000000..451e5e18
--- /dev/null
+++ b/src/progressBar/progressBarOld.py
@@ -0,0 +1,110 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'progressBarNew.ui'
+#
+# Created by: PyQt5 UI code generator 5.15.6
+#
+# WARNING: Any manual changes made to this file will be lost when pyuic5 is
+# run again. Do not edit this file unless you know what you are doing.
+
+
+from PyQt5 import QtCore, QtGui, QtWidgets
+
+
+class Ui_Simulation(object):
+ def setupUi(self, Simulation):
+ Simulation.setObjectName("Simulation")
+ Simulation.resize(1250, 645)
+ self.horizontalLayout_2 = QtWidgets.QHBoxLayout(Simulation)
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.verticalLayout = QtWidgets.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.progressBar = QtWidgets.QProgressBar(Simulation)
+ self.progressBar.setStyleSheet("")
+ self.progressBar.setMaximum(0)
+ self.progressBar.setProperty("value", -1)
+ self.progressBar.setFormat("")
+ self.progressBar.setObjectName("progressBar")
+ self.verticalLayout.addWidget(self.progressBar)
+ self.simulationConsole = QtWidgets.QTextEdit(Simulation)
+ self.simulationConsole.setStyleSheet("QTextEdit {\n"
+" background-color: rgb(36, 31, 49);\n"
+" color: white;\n"
+"}")
+ self.simulationConsole.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
+ self.simulationConsole.setObjectName("simulationConsole")
+ self.verticalLayout.addWidget(self.simulationConsole)
+ self.horizontalLayout_2.addLayout(self.verticalLayout)
+ self.verticalLayout_2 = QtWidgets.QVBoxLayout()
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ spacerItem = QtWidgets.QSpacerItem(150, 30, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
+ self.verticalLayout_2.addItem(spacerItem)
+ self.pushButton = QtWidgets.QPushButton(Simulation)
+ self.pushButton.setObjectName("pushButton")
+ self.verticalLayout_2.addWidget(self.pushButton)
+ self.pushButton_2 = QtWidgets.QPushButton(Simulation)
+ self.pushButton_2.setObjectName("pushButton_2")
+ self.verticalLayout_2.addWidget(self.pushButton_2)
+ self.pushButton_3 = QtWidgets.QPushButton(Simulation)
+ self.pushButton_3.setObjectName("pushButton_3")
+ self.verticalLayout_2.addWidget(self.pushButton_3)
+ self.pushButton_4 = QtWidgets.QPushButton(Simulation)
+ self.pushButton_4.setObjectName("pushButton_4")
+ self.verticalLayout_2.addWidget(self.pushButton_4)
+ self.pushButton_5 = QtWidgets.QPushButton(Simulation)
+ self.pushButton_5.setObjectName("pushButton_5")
+ self.verticalLayout_2.addWidget(self.pushButton_5)
+ spacerItem1 = QtWidgets.QSpacerItem(20, 400, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
+ self.verticalLayout_2.addItem(spacerItem1)
+ self.horizontalLayout_2.addLayout(self.verticalLayout_2)
+
+ self.retranslateUi(Simulation)
+ QtCore.QMetaObject.connectSlotsByName(Simulation)
+
+ self.dark_color = True
+
+ def retranslateUi(self, Simulation):
+ _translate = QtCore.QCoreApplication.translate
+ Simulation.setWindowTitle(_translate("Simulation", "Simulation"))
+ self.simulationConsole.setHtml(_translate("Simulation", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:\'Ubuntu\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The quick brown fox jumped over the lazy dog</p></body></html>"))
+ self.pushButton.setText(_translate("Simulation", "Cancel Simulation"))
+ self.pushButton_2.setText(_translate("Simulation", "Show Schematic"))
+ self.pushButton_3.setText(_translate("Simulation", "Plot_data_i.txt"))
+ self.pushButton_4.setText(_translate("Simulation", "Plot_data_v.txt"))
+ self.pushButton_5.setText(_translate("Simulation", "Switch Colour"))
+
+ self.pushButton_5.clicked.connect(self.changeColor)
+
+ def writeIntoConsole(self, consoleLog):
+ self.simulationConsole.insertPlainText(consoleLog)
+
+ def showProgressCompleted(self):
+ self.progressBar.setMaximum(100)
+ self.progressBar.setProperty("value", 100)
+
+ def changeColor(self):
+ if self.dark_color is True:
+ self.simulationConsole.setStyleSheet("QTextEdit {\n"
+ " background-color: white;\n"
+ " color: black;\n"
+ "}")
+ self.dark_color = False
+ else:
+ self.simulationConsole.setStyleSheet("QTextEdit {\n"
+ " background-color: rgb(36, 31, 49);\n"
+ " color: white;\n"
+ "}")
+ self.dark_color = True
+
+if __name__ == "__main__":
+ import sys
+ app = QtWidgets.QApplication(sys.argv)
+ Simulation = QtWidgets.QWidget()
+ ui = Ui_Simulation()
+ ui.setupUi(Simulation)
+ Simulation.show()
+ sys.exit(app.exec_())