diff options
author | Pranav P | 2023-06-01 17:38:18 +0530 |
---|---|---|
committer | Pranav P | 2023-06-01 17:38:18 +0530 |
commit | d8a2de2ef6126654184a1924cd21d242bea1be18 (patch) | |
tree | c2622c775565c892ad0cf42cb45f263bc63d9f6b /src/frontEnd/Application.py | |
parent | fb53f8b67cb15802c1d5ddbe59cf880c1d98954f (diff) | |
download | eSim-d8a2de2ef6126654184a1924cd21d242bea1be18.tar.gz eSim-d8a2de2ef6126654184a1924cd21d242bea1be18.tar.bz2 eSim-d8a2de2ef6126654184a1924cd21d242bea1be18.zip |
PR fixes
Diffstat (limited to 'src/frontEnd/Application.py')
-rw-r--r-- | src/frontEnd/Application.py | 72 |
1 files changed, 28 insertions, 44 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 26a988ce..d3025fe4 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -40,7 +40,6 @@ from frontEnd import Workspace from frontEnd import DockArea from PyQt5.Qt import QSize import shutil -import time import sys import psutil @@ -551,47 +550,37 @@ class Application(QtWidgets.QMainWindow): pass return False - def checkChangeInPlotData(self, currTime, exitStatus): +# @QtCore.pyqtSlot(int, QtCore.QProcess.ExitStatus) + def checkChangeInPlotData(self, exitCode): """Checks whether there is a change in the analysis files. (To see if simulation was successful) and displays the plotter where graphs can be plotted. - - :param currTime: The time stamp of the analysis file - before simulation starts - :type currTime: float - :param exitStatus: The exit status of the ngspice QProcess - :type exitStatus: class:`QtCore.QProcess.ExitStatus` + :param exitCode: The exit status of the ngspice QProcess + :type exitCode: int """ self.toggleToolbarButtons(True) - if exitStatus == QtCore.QProcess.NormalExit: + if exitCode == 0: try: - - st = os.stat(os.path.join(self.projDir, "plot_data_i.txt")) - if st.st_mtime >= currTime: - - try: - self.obj_Mainview.obj_dockarea.plottingEditor() - except Exception as e: - self.msg = QtWidgets.QErrorMessage() - self.msg.setModal(True) - self.msg.setWindowTitle("Error Message") - self.msg.showMessage( - 'Error while opening python plotting Editor.' - ' Please look at console for more details.' - ) - self.msg.exec_() - print("Exception Message:", str(e), - traceback.format_exc()) - self.obj_appconfig.print_error('Exception Message : ' - + str(e)) - - self.currTime = time.time() - - return - except Exception: - pass + self.obj_Mainview.obj_dockarea.plottingEditor() + except Exception as e: + self.msg = QtWidgets.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Error Message") + self.msg.showMessage( + 'Error while opening python plotting Editor.' + ' Please look at console for more details.' + ) + self.msg.exec_() + print("Exception Message:", str(e), traceback.format_exc()) + self.obj_appconfig.print_error('Exception Message : ' + + str(e)) def toggleToolbarButtons(self, state): + """This function is used to disable buttons related to simulation + during the ngspice simulation and to enable it back once the + simulation is completed + param: state: Decides whether to enable or disable the button + type: state: bool""" self.ngspice.setEnabled(state) self.conversion.setEnabled(state) self.closeproj.setEnabled(state) @@ -602,19 +591,14 @@ class Application(QtWidgets.QMainWindow): self.projDir = self.obj_appconfig.current_project["ProjectName"] if self.projDir is not None: - - self.currTime = time.time() - - process = self.obj_Mainview.obj_dockarea.qprocess - process.started.connect(lambda: - self.toggleToolbarButtons(state=False)) - process.finished.connect(lambda exitCode, exitStatus: - self.checkChangeInPlotData(self.currTime, - exitStatus)) + simulationEssentials = { + 'checkChangeInPlotData': self.checkChangeInPlotData, + 'toggleToolbarButtons': self.toggleToolbarButtons + } # Edited by Sumanto Kar 25/08/2021 if self.obj_Mainview.obj_dockarea.ngspiceEditor( - self.projDir) is False: + self.projDir, simulationEssentials) is False: print( "Netlist file (*.cir.out) not found." ) |