# -*- 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", "\n" "\n" "

The quick brown fox jumped over the lazy dog

")) 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 = '{}' successFormat = '{}' 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_())