summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPranav P2023-05-19 11:16:58 +0530
committerPranav P2023-05-19 11:16:58 +0530
commit1c0b9197069c12f2a9b0c35be936e97d38c6a372 (patch)
tree0ddc8b79294c721d3dae2436b65e2ca1eb9a958d /src
parent5ade06b5d3559b1d01dafdfabcb71f169bfd633c (diff)
downloadeSim-1c0b9197069c12f2a9b0c35be936e97d38c6a372.tar.gz
eSim-1c0b9197069c12f2a9b0c35be936e97d38c6a372.tar.bz2
eSim-1c0b9197069c12f2a9b0c35be936e97d38c6a372.zip
Added redo simulation button to progressbar window
Diffstat (limited to 'src')
-rw-r--r--src/frontEnd/Application.py9
-rw-r--r--src/ngspiceSimulation/NgspiceWidget.py5
-rw-r--r--src/progressBar/progressBar.py23
3 files changed, 35 insertions, 2 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index 0f8e7dac..7457ba7d 100644
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -621,6 +621,10 @@ class Application(QtWidgets.QMainWindow):
def isSimulationSuccess(self):
return self.is_file_changed
+
+ def resetSimulationVariables(self):
+ self.count = 0
+ self.currTime = 0
def open_ngspice(self):
"""This Function execute ngspice on current project."""
@@ -632,10 +636,11 @@ class Application(QtWidgets.QMainWindow):
"timer": self.timer,
"enableButtons": self.enableButtons,
"isSimulationSuccess": self.isSimulationSuccess,
+ "resetSimulationVariables": self.resetSimulationVariables,
}
if self.projDir is not None:
- currTime = time.time()
+ self.currTime = time.time()
# Edited by Sumanto Kar 25/08/2021
self.enableButtons(False)
@@ -656,7 +661,7 @@ class Application(QtWidgets.QMainWindow):
self.count = 0
self.timer.setInterval(1000)
- self.timer.timeout.connect(lambda: self.check_change_in_plotfile(currTime))
+ self.timer.timeout.connect(lambda: self.check_change_in_plotfile(self.currTime))
self.timer.start()
else:
diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py
index 9a56414b..cbcd381b 100644
--- a/src/ngspiceSimulation/NgspiceWidget.py
+++ b/src/ngspiceSimulation/NgspiceWidget.py
@@ -52,6 +52,7 @@ class NgspiceWidget(QtWidgets.QWidget):
# Creating argument for process
self.args = ['-b', '-r', command.replace(".cir.out", ".raw"), command]
self.process.setWorkingDirectory(projPath)
+ self.progressBarUi.setNgspiceArgs(self.args)
self.process.start('ngspice', self.args)
self.process.readyReadStandardOutput.connect(lambda: self.readyReadAll())
self.process.finished.connect(self.finishSimulation)
@@ -68,6 +69,7 @@ class NgspiceWidget(QtWidgets.QWidget):
print(self.gawCommand)
def finishSimulation(self):
+ self.readyToPrintSimulationStatus = True
self.enableButtons = self.simulationEssentials['enableButtons']
self.enableButtons(True)
@@ -76,6 +78,8 @@ class NgspiceWidget(QtWidgets.QWidget):
self.qTimer.timeout.connect(self.writeSimulationStatus)
def writeSimulationStatus(self):
+ if self.readyToPrintSimulationStatus is False:
+ return
self.isSimulationSuccess = self.simulationEssentials['isSimulationSuccess']
if self.isSimulationSuccess():
@@ -84,6 +88,7 @@ class NgspiceWidget(QtWidgets.QWidget):
self.progressBarUi.writeSimulationStatusToConsole(isSuccess=False)
self.progressBarUi.scrollConsoleToBottom()
+ self.readyToPrintSimulationStatus = False
@QtCore.pyqtSlot()
def readyReadAll(self):
diff --git a/src/progressBar/progressBar.py b/src/progressBar/progressBar.py
index 24edb865..5b667db7 100644
--- a/src/progressBar/progressBar.py
+++ b/src/progressBar/progressBar.py
@@ -18,6 +18,7 @@ class Ui_Form(object):
self.qTimer = simulationEssentials['timer']
self.enableButtons = simulationEssentials['enableButtons']
self.isSimulationSuccess = simulationEssentials['isSimulationSuccess']
+ self.resetSimulationVariables = simulationEssentials['resetSimulationVariables']
self.iconDir = "../progressBar/icons"
# super().__init__()
def setupUi(self, Form):
@@ -49,6 +50,10 @@ class Ui_Form(object):
self.progressBar.setFormat("")
self.progressBar.setObjectName("progressBar")
self.horizontalLayout.addWidget(self.progressBar)
+ self.redo_simulation_button = QtWidgets.QPushButton(self.verticalLayoutWidget)
+ self.redo_simulation_button.setMaximumSize(QtCore.QSize(16777215, 35))
+ self.redo_simulation_button.setObjectName("redo_simulation_button")
+ self.horizontalLayout.addWidget(self.redo_simulation_button)
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")
@@ -85,6 +90,7 @@ class Ui_Form(object):
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
+ self.redo_simulation_button.setText(_translate("Form", "Redo Simulation"))
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"
@@ -99,6 +105,7 @@ class Ui_Form(object):
self.light_dark_mode_button.clicked.connect(self.changeColor)
self.cancel_simulation_button.clicked.connect(self.cancelSimulation)
+ self.redo_simulation_button.clicked.connect(self.redoSimulation)
def writeIntoConsole(self, consoleLog):
self.simulationConsole.insertPlainText(consoleLog)
@@ -115,6 +122,10 @@ class Ui_Form(object):
def scrollConsoleToBottom(self):
scrollLength = self.simulationConsole.verticalScrollBar().maximum()
self.simulationConsole.verticalScrollBar().setValue(scrollLength)
+
+ def showProgressRunning(self):
+ self.progressBar.setMaximum(0)
+ self.progressBar.setProperty("value", -1)
def showProgressCompleted(self):
self.progressBar.setMaximum(100)
@@ -130,6 +141,18 @@ class Ui_Form(object):
self.simulationConsole.append(cancelFormat.format("Simulation Cancelled!"))
self.scrollConsoleToBottom()
+ def setNgspiceArgs(self, args):
+ self.args = args
+
+ def redoSimulation(self):
+ if self.qTimer.isActive():
+ return
+ self.showProgressRunning()
+ self.simulationConsole.setText("")
+ self.resetSimulationVariables()
+ self.qProcess.start('ngspice', self.args)
+ self.qTimer.start()
+
def changeColor(self):
if self.dark_color is True:
self.simulationConsole.setStyleSheet("QTextEdit {\n"