diff options
author | Pranav P | 2023-06-01 12:42:10 +0530 |
---|---|---|
committer | Pranav P | 2023-06-01 12:45:38 +0530 |
commit | 9a01a2606665c521c1ee10fa94394127d5decbf3 (patch) | |
tree | bb77caa6f1b748470c088e348125d4f80a02157e /src/frontEnd/TerminalUi.py | |
parent | fd3852efb732b6434a5327a056135f3444b93ba3 (diff) | |
download | eSim-9a01a2606665c521c1ee10fa94394127d5decbf3.tar.gz eSim-9a01a2606665c521c1ee10fa94394127d5decbf3.tar.bz2 eSim-9a01a2606665c521c1ee10fa94394127d5decbf3.zip |
Changed style in accordance with flake8
Diffstat (limited to 'src/frontEnd/TerminalUi.py')
-rw-r--r-- | src/frontEnd/TerminalUi.py | 115 |
1 files changed, 80 insertions, 35 deletions
diff --git a/src/frontEnd/TerminalUi.py b/src/frontEnd/TerminalUi.py index ddae32f3..21b5b557 100644 --- a/src/frontEnd/TerminalUi.py +++ b/src/frontEnd/TerminalUi.py @@ -1,52 +1,81 @@ from PyQt5 import QtCore, QtGui, QtWidgets, uic import os + class TerminalUi(QtWidgets.QMainWindow): def __init__(self, qProcess, args): super(TerminalUi, self).__init__() - #Other variables +# Other variables self.darkColor = True self.qProcess = qProcess self.args = args self.iconDir = "../../images" - # def setupUi(self, Form): - #Load the ui file +# Load the ui file uic.loadUi("TerminalUi.ui", self) - #Define Our Widgets - self.progressBar = self.findChild(QtWidgets.QProgressBar, "progressBar") - self.simulationConsole = self.findChild(QtWidgets.QTextEdit, "simulationConsole") +# Define Our Widgets + self.progressBar = self.findChild( + QtWidgets.QProgressBar, + "progressBar" + ) + self.simulationConsole = self.findChild( + QtWidgets.QTextEdit, + "simulationConsole" + ) - self.lightDarkModeButton = self.findChild(QtWidgets.QPushButton, "lightDarkModeButton") - self.cancelSimulationButton = self.findChild(QtWidgets.QPushButton, "cancelSimulationButton") - self.redoSimulationButton = self.findChild(QtWidgets.QPushButton, "redoSimulationButton") + self.lightDarkModeButton = self.findChild( + QtWidgets.QPushButton, + "lightDarkModeButton" + ) + self.cancelSimulationButton = self.findChild( + QtWidgets.QPushButton, + "cancelSimulationButton" + ) + self.redoSimulationButton = self.findChild( + QtWidgets.QPushButton, + "redoSimulationButton" + ) - #Add functionalities to Widgets - self.lightDarkModeButton.setIcon(QtGui.QIcon(os.path.join(self.iconDir, 'light_mode.png'))) +# Add functionalities to Widgets + self.lightDarkModeButton.setIcon( + QtGui.QIcon( + os.path.join( + self.iconDir, + 'light_mode.png' + ) + ) + ) self.lightDarkModeButton.clicked.connect(self.changeColor) self.cancelSimulationButton.clicked.connect(self.cancelSimulation) self.redoSimulationButton.clicked.connect(self.redoSimulation) - #show app +# show app self.show() def writeSimulationStatusToConsole(self, isSuccess): """Writes simulation status to the console with appropriate style to the :class:`Form_Ui` console. - - :param isSuccess: A boolean flag used to indicate whether the simulation was a success or not + + :param isSuccess: A boolean flag used to indicate whether the + simulation was a success or not :type isSuccess: bool """ - failedFormat = '<span style="color:#ff3333; font-size:18px;">{}</span>' - successFormat = '<span style="color:#00ff00; font-size:18px;">{}</span>' + failedFormat = '<span style="color:#ff3333; font-size:18px;"> \ + {} \ + </span>' + successFormat = '<span style="color:#00ff00; font-size:18px;"> \ + {} \ + </span>' if self.qProcess.exitStatus() == QtCore.QProcess.NormalExit: if isSuccess: - self.simulationConsole.append(successFormat.format("Simulation Completed Successfully!")) + self.simulationConsole.append( + successFormat.format("Simulation Completed Successfully!")) else: - self.simulationConsole.append(failedFormat.format("Simulation Failed!")) + self.simulationConsole.append( + failedFormat.format("Simulation Failed!")) def cancelSimulation(self): """This function cancels the ongoing ngspice simulation. @@ -55,12 +84,13 @@ class TerminalUi(QtWidgets.QMainWindow): return cancelFormat = '<span style="color:#3385ff; font-size:18px;">{}</span>' self.qProcess.kill() - - #To show progressBar completed + +# To show progressBar completed self.progressBar.setMaximum(100) self.progressBar.setProperty("value", 100) - self.simulationConsole.append(cancelFormat.format("Simulation Cancelled!")) + self.simulationConsole.append( + cancelFormat.format("Simulation Cancelled!")) self.simulationConsole.verticalScrollBar().setValue( self.simulationConsole.verticalScrollBar().maximum() ) @@ -70,8 +100,8 @@ class TerminalUi(QtWidgets.QMainWindow): """ if (self.qProcess.state() == QtCore.QProcess.Running): return - - #To make the progressbar running + +# To make the progressbar running self.progressBar.setMaximum(0) self.progressBar.setProperty("value", -1) @@ -79,19 +109,34 @@ class TerminalUi(QtWidgets.QMainWindow): self.qProcess.start('ngspice', self.args) def changeColor(self): - """Toggles the :class:`Ui_Form` console between dark mode and light mode + """Toggles the :class:`Ui_Form` console between dark mode + and light mode """ if self.darkColor is True: - self.simulationConsole.setStyleSheet("QTextEdit {\n" - " background-color: white;\n" - " color: black;\n" - "}") - self.lightDarkModeButton.setIcon(QtGui.QIcon(os.path.join(self.iconDir, "dark_mode.png"))) + self.simulationConsole.setStyleSheet("QTextEdit {\n \ + background-color: white;\n \ + color: black;\n \ + }") + self.lightDarkModeButton.setIcon( + QtGui.QIcon( + os.path.join( + self.iconDir, + "dark_mode.png" + ) + ) + ) self.darkColor = False else: - self.simulationConsole.setStyleSheet("QTextEdit {\n" - " background-color: rgb(36, 31, 49);\n" - " color: white;\n" - "}") - self.lightDarkModeButton.setIcon(QtGui.QIcon(os.path.join(self.iconDir, "light_mode.png"))) - self.darkColor = True
\ No newline at end of file + self.simulationConsole.setStyleSheet("QTextEdit {\n \ + background-color: rgb(36, 31, 49);\n \ + color: white;\n \ + }") + self.lightDarkModeButton.setIcon( + QtGui.QIcon( + os.path.join( + self.iconDir, + "light_mode.png" + ) + ) + ) + self.darkColor = True |