From abc410aac656e840940b2227f4d94f0780a614be Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Wed, 7 Jun 2023 16:20:33 +0530 Subject: sync cancel and redo simulation features --- src/frontEnd/TerminalUi.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src/frontEnd/TerminalUi.py') diff --git a/src/frontEnd/TerminalUi.py b/src/frontEnd/TerminalUi.py index 902b6f59..2c5a7c02 100644 --- a/src/frontEnd/TerminalUi.py +++ b/src/frontEnd/TerminalUi.py @@ -17,39 +17,42 @@ class TerminalUi(QtWidgets.QMainWindow): """ super(TerminalUi, self).__init__() -# Other variables + # Other variables self.darkColor = True self.qProcess = qProcess self.args = args self.iconDir = "../../images" -# Load the ui file + # Load the ui file uic.loadUi("TerminalUi.ui", self) -# Define Our Widgets + # 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.cancelSimulationButton.setEnabled(True) + self.redoSimulationButton = self.findChild( QtWidgets.QPushButton, "redoSimulationButton" - ) + ) + self.redoSimulationButton.setEnabled(False) -# Add functionalities to Widgets + # Add functionalities to Widgets self.lightDarkModeButton.setIcon( QtGui.QIcon( os.path.join( @@ -62,7 +65,6 @@ class TerminalUi(QtWidgets.QMainWindow): self.cancelSimulationButton.clicked.connect(self.cancelSimulation) self.redoSimulationButton.clicked.connect(self.redoSimulation) -# show app self.show() def cancelSimulation(self): @@ -70,10 +72,11 @@ class TerminalUi(QtWidgets.QMainWindow): """ if (self.qProcess.state() == QtCore.QProcess.NotRunning): return + cancelFormat = '{}' self.qProcess.kill() -# To show progressBar completed + # To show progressBar completed self.progressBar.setMaximum(100) self.progressBar.setProperty("value", 100) @@ -83,19 +86,25 @@ class TerminalUi(QtWidgets.QMainWindow): self.simulationConsole.verticalScrollBar().maximum() ) + self.cancelSimulationButton.setEnabled(False) + self.redoSimulationButton.setEnabled(True) + def redoSimulation(self): """This function reruns the ngspice simulation """ 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) self.simulationConsole.setText("") self.qProcess.start('ngspice', self.args) + self.cancelSimulationButton.setEnabled(True) + self.redoSimulationButton.setEnabled(False) + def changeColor(self): """Toggles the :class:`Ui_Form` console between dark mode and light mode -- cgit