diff options
author | Pranav P | 2023-05-04 19:26:04 +0530 |
---|---|---|
committer | Pranav P | 2023-05-04 19:26:04 +0530 |
commit | cf6bb2edf063ba6d3415434899e8a73a42755aa0 (patch) | |
tree | b4f043ce7b8266ba3b4227d716b292adfa69e55c | |
parent | 299b330406e6124ba3542833d8cb9b82cfc10d03 (diff) | |
download | eSim-cf6bb2edf063ba6d3415434899e8a73a42755aa0.tar.gz eSim-cf6bb2edf063ba6d3415434899e8a73a42755aa0.tar.bz2 eSim-cf6bb2edf063ba6d3415434899e8a73a42755aa0.zip |
Disabled multiple simulations
-rw-r--r-- | src/frontEnd/Application.py | 15 | ||||
-rwxr-xr-x | src/frontEnd/DockArea.py | 6 | ||||
-rw-r--r-- | src/ngspiceSimulation/NgspiceWidget.py | 14 | ||||
-rw-r--r-- | src/progressBar/progressBar.py | 11 |
4 files changed, 33 insertions, 13 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 3c11045f..a34442b8 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -581,6 +581,7 @@ class Application(QtWidgets.QMainWindow): if st.st_mtime >= currTime - 1 and not is_ngspice_running: self.is_file_changed = True self.timer.stop() + self.plot_simulation() return except Exception: @@ -610,18 +611,30 @@ class Application(QtWidgets.QMainWindow): self.msg.exec_() return + + def enableButtons(self, state): + self.ngspice.setEnabled(state) + self.conversion.setEnabled(state) + self.closeproj.setEnabled(state) + self.wrkspce.setEnabled(state) def open_ngspice(self): """This Function execute ngspice on current project.""" self.projDir = self.obj_appconfig.current_project["ProjectName"] self.timer = QtCore.QTimer(self) + self.simulationEssentials = { + "timer": self.timer, + "enableButtons": self.enableButtons, + } + if self.projDir is not None: currTime = time.time() # Edited by Sumanto Kar 25/08/2021 + self.enableButtons(False) if self.obj_Mainview.obj_dockarea.ngspiceEditor( - self.projDir, self.timer) is False: + self.projDir, self.simulationEssentials) is False: print( "Netlist file (*.cir.out) not found." ) diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py index 4cab6261..cf21199d 100755 --- a/src/frontEnd/DockArea.py +++ b/src/frontEnd/DockArea.py @@ -117,10 +117,10 @@ class DockArea(QtWidgets.QMainWindow): ) count = count + 1 - def ngspiceEditor(self, projDir, timer): + def ngspiceEditor(self, projDir, simulationEssentials): """ This function creates widget for Ngspice window.""" self.projDir = projDir - self.qTimer = timer + self.simulationEssentials = simulationEssentials self.projName = os.path.basename(self.projDir) self.ngspiceNetlist = os.path.join( self.projDir, self.projName + ".cir.out") @@ -134,7 +134,7 @@ class DockArea(QtWidgets.QMainWindow): self.ngspiceLayout = QtWidgets.QVBoxLayout() self.ngspiceLayout.addWidget( - NgspiceWidget(self.ngspiceNetlist, self.projDir, self.qTimer) + NgspiceWidget(self.ngspiceNetlist, self.projDir, self.simulationEssentials) ) # Adding to main Layout diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py index f87ab96e..9909dd07 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, timer): + def __init__(self, command, projPath, simulationEssentials): """ - Creates constructor for NgspiceWidget class. - Checks whether OS is Linux or Windows and @@ -18,8 +18,8 @@ class NgspiceWidget(QtWidgets.QWidget): self.obj_appconfig = Appconfig() self.process = QtCore.QProcess(self) self.terminal = QtWidgets.QWidget(self) - self.qTimer = timer - self.progressBarUi = progressBar.Ui_Form(self.process, self.qTimer) + self.simulationEssentials = simulationEssentials + self.progressBarUi = progressBar.Ui_Form(self.process, self.simulationEssentials) self.progressBarUi.setupUi(self.terminal) self.layout = QtWidgets.QVBoxLayout(self) self.layout.addWidget(self.terminal) @@ -52,7 +52,7 @@ class NgspiceWidget(QtWidgets.QWidget): self.process.setWorkingDirectory(projPath) self.process.start('ngspice', self.args) self.process.readyReadStandardOutput.connect(lambda: self.readyReadAll()) - self.process.finished.connect(self.progressBarUi.showProgressCompleted) + self.process.finished.connect(self.finishSimulation) self.obj_appconfig.process_obj.append(self.process) print(self.obj_appconfig.proc_dict) ( @@ -65,6 +65,12 @@ class NgspiceWidget(QtWidgets.QWidget): self.gawProcess.start('sh', ['-c', self.gawCommand]) print(self.gawCommand) + def finishSimulation(self): + self.enableButtons = self.simulationEssentials['enableButtons'] + + self.enableButtons(True) + self.progressBarUi.showProgressCompleted() + @QtCore.pyqtSlot() def readyReadAll(self): self.progressBarUi.writeIntoConsole( diff --git a/src/progressBar/progressBar.py b/src/progressBar/progressBar.py index be705ce1..4bc1e982 100644 --- a/src/progressBar/progressBar.py +++ b/src/progressBar/progressBar.py @@ -12,9 +12,10 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Form(object): - def __init__(self, qProcess, qTimer): + def __init__(self, qProcess, simulationEssentials): self.qProcess = qProcess - self.qTimer = qTimer + self.qTimer = simulationEssentials['timer'] + self.enableButtons = simulationEssentials['enableButtons'] # super().__init__() def setupUi(self, Form): Form.setObjectName("Form") @@ -97,10 +98,10 @@ class Ui_Form(object): self.cancel_simulation_button.clicked.connect(self.cancelSimulation) def writeIntoConsole(self, consoleLog): - self.simulationConsole.insertPlainText(consoleLog) + self.simulationConsole.insertPlainText(consoleLog) - def showProgressCompleted(self): - self.progressBar.setMaximum(100) + def showProgressCompleted(self): + self.progressBar.setMaximum(100) self.progressBar.setProperty("value", 100) def cancelSimulation(self): |