summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/frontEnd/Application.py4
-rwxr-xr-xsrc/frontEnd/DockArea.py5
-rw-r--r--src/ngspiceSimulation/NgspiceWidget.py5
-rw-r--r--src/progressBar/progressBar.py11
4 files changed, 19 insertions, 6 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index 730ba9d8..3c11045f 100644
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -614,13 +614,14 @@ class Application(QtWidgets.QMainWindow):
def open_ngspice(self):
"""This Function execute ngspice on current project."""
self.projDir = self.obj_appconfig.current_project["ProjectName"]
+ self.timer = QtCore.QTimer(self)
if self.projDir is not None:
currTime = time.time()
# Edited by Sumanto Kar 25/08/2021
if self.obj_Mainview.obj_dockarea.ngspiceEditor(
- self.projDir) is False:
+ self.projDir, self.timer) is False:
print(
"Netlist file (*.cir.out) not found."
)
@@ -635,7 +636,6 @@ class Application(QtWidgets.QMainWindow):
return
self.count = 0
- self.timer = QtCore.QTimer(self)
self.timer.setInterval(1000)
self.timer.timeout.connect(lambda: self.check_change_in_plotfile(currTime))
self.timer.start()
diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py
index 461240b9..4cab6261 100755
--- a/src/frontEnd/DockArea.py
+++ b/src/frontEnd/DockArea.py
@@ -117,9 +117,10 @@ class DockArea(QtWidgets.QMainWindow):
)
count = count + 1
- def ngspiceEditor(self, projDir):
+ def ngspiceEditor(self, projDir, timer):
""" This function creates widget for Ngspice window."""
self.projDir = projDir
+ self.qTimer = timer
self.projName = os.path.basename(self.projDir)
self.ngspiceNetlist = os.path.join(
self.projDir, self.projName + ".cir.out")
@@ -133,7 +134,7 @@ class DockArea(QtWidgets.QMainWindow):
self.ngspiceLayout = QtWidgets.QVBoxLayout()
self.ngspiceLayout.addWidget(
- NgspiceWidget(self.ngspiceNetlist, self.projDir)
+ NgspiceWidget(self.ngspiceNetlist, self.projDir, self.qTimer)
)
# Adding to main Layout
diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py
index 69654933..f87ab96e 100644
--- a/src/ngspiceSimulation/NgspiceWidget.py
+++ b/src/ngspiceSimulation/NgspiceWidget.py
@@ -8,7 +8,7 @@ import os
# This Class creates NgSpice Window
class NgspiceWidget(QtWidgets.QWidget):
- def __init__(self, command, projPath):
+ def __init__(self, command, projPath, timer):
"""
- Creates constructor for NgspiceWidget class.
- Checks whether OS is Linux or Windows and
@@ -18,7 +18,8 @@ class NgspiceWidget(QtWidgets.QWidget):
self.obj_appconfig = Appconfig()
self.process = QtCore.QProcess(self)
self.terminal = QtWidgets.QWidget(self)
- self.progressBarUi = progressBar.Ui_Form()
+ self.qTimer = timer
+ self.progressBarUi = progressBar.Ui_Form(self.process, self.qTimer)
self.progressBarUi.setupUi(self.terminal)
self.layout = QtWidgets.QVBoxLayout(self)
self.layout.addWidget(self.terminal)
diff --git a/src/progressBar/progressBar.py b/src/progressBar/progressBar.py
index bf60a64b..be705ce1 100644
--- a/src/progressBar/progressBar.py
+++ b/src/progressBar/progressBar.py
@@ -12,6 +12,10 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
+ def __init__(self, qProcess, qTimer):
+ self.qProcess = qProcess
+ self.qTimer = qTimer
+ # super().__init__()
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(1244, 644)
@@ -90,6 +94,8 @@ class Ui_Form(object):
self.light_dark_mode_button.setIcon(QtGui.QIcon("icons/light_mode.png"))
self.light_dark_mode_button.clicked.connect(self.changeColor)
+ self.cancel_simulation_button.clicked.connect(self.cancelSimulation)
+
def writeIntoConsole(self, consoleLog):
self.simulationConsole.insertPlainText(consoleLog)
@@ -97,6 +103,11 @@ class Ui_Form(object):
self.progressBar.setMaximum(100)
self.progressBar.setProperty("value", 100)
+ def cancelSimulation(self):
+ self.qTimer.stop()
+ self.qProcess.kill()
+ self.showProgressCompleted()
+
def changeColor(self):
if self.dark_color is True:
self.simulationConsole.setStyleSheet("QTextEdit {\n"