summaryrefslogtreecommitdiff
path: root/src/frontEnd/Application.py
diff options
context:
space:
mode:
authorPranav P2023-05-23 17:11:33 +0530
committerPranav P2023-05-23 17:11:33 +0530
commit7b36bfed265309672689cd6ddd04c9a24d115e9c (patch)
treea865782fcc37447fec610a6383c133a48f7d7f41 /src/frontEnd/Application.py
parent1c0b9197069c12f2a9b0c35be936e97d38c6a372 (diff)
downloadeSim-7b36bfed265309672689cd6ddd04c9a24d115e9c.tar.gz
eSim-7b36bfed265309672689cd6ddd04c9a24d115e9c.tar.bz2
eSim-7b36bfed265309672689cd6ddd04c9a24d115e9c.zip
Changed the polling approach to check ngspice simulation completion
Diffstat (limited to 'src/frontEnd/Application.py')
-rw-r--r--src/frontEnd/Application.py54
1 files changed, 4 insertions, 50 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index 7457ba7d..3b403279 100644
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -559,59 +559,16 @@ class Application(QtWidgets.QMainWindow):
# else:
# proc = 'xterm'
- # Edited by Sumanto Kar 25/08/2021
- if False and os.name != 'nt' and \
- self.checkIfProcessRunning('xterm') is False:
- self.msg = QtWidgets.QErrorMessage()
- self.msg.setModal(True)
- self.msg.setWindowTitle("Warning Message")
- self.msg.showMessage(
- 'Simulation was interrupted/failed. '
- 'Please close all the Ngspice windows '
- 'and then rerun the simulation.'
- )
- self.msg.exec_()
- return
-
st = os.stat(os.path.join(self.projDir, "plot_data_i.txt"))
is_ngspice_running = self.checkIfProcessRunning("ngspice")
if not is_ngspice_running:
+ self.simulationCompleted = True
if st.st_mtime >= currTime - 1:
self.is_file_changed = True
- self.timer.stop()
-
self.plot_simulation()
- return
- else:
- self.timer.stop()
- return
+ return
except Exception:
pass
-
- if self.is_file_changed is False:
- self.timer.start()
-
- # Fail Safe ===>
- self.count += 1
- if self.count >= 10:
- self.timer.stop()
- print(
- "Ngspice taking too long for simulation. "
- "Check netlist file (*.cir.out) "
- "to change simulation parameters."
- )
-
- self.msg = QtWidgets.QErrorMessage()
- self.msg.setModal(True)
- self.msg.setWindowTitle("Warning Message")
- self.msg.showMessage(
- 'Ngspice taking too long for simulation. '
- 'Check netlist file (*.cir.out) '
- 'to change simulation parameters.'
- )
- self.msg.exec_()
-
- return
def enableButtons(self, state):
self.ngspice.setEnabled(state)
@@ -629,14 +586,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)
self.is_file_changed = False
+ self.simulationCompleted = False
self.simulationEssentials = {
- "timer": self.timer,
"enableButtons": self.enableButtons,
"isSimulationSuccess": self.isSimulationSuccess,
"resetSimulationVariables": self.resetSimulationVariables,
+ "checkChangeInPlotFile": self.check_change_in_plotfile,
}
if self.projDir is not None:
@@ -660,9 +617,6 @@ class Application(QtWidgets.QMainWindow):
return
self.count = 0
- self.timer.setInterval(1000)
- self.timer.timeout.connect(lambda: self.check_change_in_plotfile(self.currTime))
- self.timer.start()
else:
self.msg = QtWidgets.QErrorMessage()