summaryrefslogtreecommitdiff
path: root/src/ngspiceSimulation
diff options
context:
space:
mode:
authorPranav P2023-04-07 20:20:33 +0530
committerPranav P2023-04-07 20:20:33 +0530
commitf87ebcf83c4a2a614e79b10039021cc5a0d56889 (patch)
tree799b929fa44ba972b738a6a758093472d7a7e3a5 /src/ngspiceSimulation
parent2b3b684b9f6b039beace62272c3d46dc8ec22147 (diff)
downloadeSim-f87ebcf83c4a2a614e79b10039021cc5a0d56889.tar.gz
eSim-f87ebcf83c4a2a614e79b10039021cc5a0d56889.tar.bz2
eSim-f87ebcf83c4a2a614e79b10039021cc5a0d56889.zip
Added progress bar, QtTimer and removed the plots
Diffstat (limited to 'src/ngspiceSimulation')
-rw-r--r--src/ngspiceSimulation/NgspiceWidget.py40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py
index 8c63a22a..651b421d 100644
--- a/src/ngspiceSimulation/NgspiceWidget.py
+++ b/src/ngspiceSimulation/NgspiceWidget.py
@@ -1,6 +1,7 @@
from PyQt5 import QtWidgets, QtCore
from configuration.Appconfig import Appconfig
from configparser import ConfigParser
+from progressBar import progressBar
import os
@@ -19,6 +20,7 @@ class NgspiceWidget(QtWidgets.QWidget):
self.terminal = QtWidgets.QWidget(self)
self.layout = QtWidgets.QVBoxLayout(self)
self.layout.addWidget(self.terminal)
+ self.errorFlag = False
print("Argument to ngspice command : ", command)
@@ -39,12 +41,16 @@ class NgspiceWidget(QtWidgets.QWidget):
os.chdir(tempdir)
else: # For Linux OS
- self.command = "cd " + projPath + \
- ";ngspice -r " + command.replace(".cir.out", ".raw") + \
- " " + command
+ # self.command = "cd " + projPath + \
+ # ";ngspice -r " + command.replace(".cir.out", ".raw") + \
+ # " " + command
# Creating argument for process
- self.args = ['-hold', '-e', self.command]
- self.process.start('xterm', self.args)
+ self.args = ['-b', '-r', command.replace(".cir.out", ".raw"), command]
+ self.process.setWorkingDirectory(projPath)
+ self.launchProgressBar()
+ self.process.start('ngspice', self.args)
+ self.process.readyReadStandardOutput.connect(lambda: self.readyReadAll())
+ self.process.finished.connect(self.progressBarUi.showProgressCompleted)
self.obj_appconfig.process_obj.append(self.process)
print(self.obj_appconfig.proc_dict)
(
@@ -52,7 +58,23 @@ class NgspiceWidget(QtWidgets.QWidget):
[self.obj_appconfig.current_project['ProjectName']].append(
self.process.pid())
)
- self.process = QtCore.QProcess(self)
- self.command = "gaw " + command.replace(".cir.out", ".raw")
- self.process.start('sh', ['-c', self.command])
- print(self.command)
+ self.gawProcess = QtCore.QProcess(self)
+ self.gawCommand = "gaw " + command.replace(".cir.out", ".raw")
+ self.gawProcess.start('sh', ['-c', self.gawCommand])
+ print(self.gawCommand)
+
+ @QtCore.pyqtSlot()
+ def readyReadAll(self):
+ self.progressBarUi.writeIntoConsole(
+ str(self.process.readAllStandardOutput().data(), encoding='utf-8')
+ )
+ stderror = self.process.readAllStandardError()
+ if stderror.toUpper().contains(b"ERROR"):
+ self.errorFlag = True
+ self.progressBarUi.writeIntoConsole(str(stderror.data(), encoding='utf-8'))
+
+ def launchProgressBar(self):
+ self.progressBar = QtWidgets.QWidget()
+ self.progressBarUi = progressBar.Ui_Dialog()
+ self.progressBarUi.setupUi(self.progressBar)
+ self.progressBar.show()