From 4eea06f6fcd654c7f0919f395ff42fabbafa0171 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Sun, 11 Jun 2023 16:22:29 +0530 Subject: fixed multiple signal issue with cancel sim. --- src/frontEnd/TerminalUi.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/frontEnd/TerminalUi.py') diff --git a/src/frontEnd/TerminalUi.py b/src/frontEnd/TerminalUi.py index 2c5a7c02..4c53548f 100644 --- a/src/frontEnd/TerminalUi.py +++ b/src/frontEnd/TerminalUi.py @@ -65,34 +65,39 @@ class TerminalUi(QtWidgets.QMainWindow): self.cancelSimulationButton.clicked.connect(self.cancelSimulation) self.redoSimulationButton.clicked.connect(self.redoSimulation) + self.simulationCancelled = False self.show() def cancelSimulation(self): """This function cancels the ongoing ngspice simulation. """ + self.cancelSimulationButton.setEnabled(False) + self.redoSimulationButton.setEnabled(True) + if (self.qProcess.state() == QtCore.QProcess.NotRunning): return - cancelFormat = '{}' + self.simulationCancelled = True self.qProcess.kill() # To show progressBar completed self.progressBar.setMaximum(100) self.progressBar.setProperty("value", 100) + cancelFormat = '{}' self.simulationConsole.append( cancelFormat.format("Simulation Cancelled!")) self.simulationConsole.verticalScrollBar().setValue( 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): + self.cancelSimulationButton.setEnabled(True) + self.redoSimulationButton.setEnabled(False) + + if (self.qProcess.state() != QtCore.QProcess.NotRunning): return # To make the progressbar running @@ -100,10 +105,9 @@ class TerminalUi(QtWidgets.QMainWindow): self.progressBar.setProperty("value", -1) self.simulationConsole.setText("") - self.qProcess.start('ngspice', self.args) + self.simulationCancelled = False - self.cancelSimulationButton.setEnabled(True) - self.redoSimulationButton.setEnabled(False) + self.qProcess.start('ngspice', self.args) def changeColor(self): """Toggles the :class:`Ui_Form` console between dark mode -- cgit