diff options
author | Pranav P | 2023-05-24 12:14:06 +0530 |
---|---|---|
committer | Pranav P | 2023-05-24 12:14:06 +0530 |
commit | 22570451ec4e2a86f489125ca540b7a86d682286 (patch) | |
tree | 963f18f3ebef703c1781683c514fa4a013e0e12b /src/frontEnd/Application.py | |
parent | 7b36bfed265309672689cd6ddd04c9a24d115e9c (diff) | |
download | eSim-22570451ec4e2a86f489125ca540b7a86d682286.tar.gz eSim-22570451ec4e2a86f489125ca540b7a86d682286.tar.bz2 eSim-22570451ec4e2a86f489125ca540b7a86d682286.zip |
Reduced passage of functions between objects via simulationEssentials
Diffstat (limited to 'src/frontEnd/Application.py')
-rw-r--r-- | src/frontEnd/Application.py | 76 |
1 files changed, 33 insertions, 43 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 3b403279..2eabcb12 100644 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -83,7 +83,7 @@ class Application(QtWidgets.QMainWindow): self.systemTrayIcon.setIcon(QtGui.QIcon(init_path + 'images/logo.png')) self.systemTrayIcon.setVisible(True) - self.is_file_changed = False + self.isFileChanged = False def initToolBar(self): """ @@ -552,23 +552,37 @@ class Application(QtWidgets.QMainWindow): pass return False - def check_change_in_plotfile(self, currTime): - try: - # if os.name == 'nt': - # proc = 'mintty' - # else: - # proc = 'xterm' - - st = os.stat(os.path.join(self.projDir, "plot_data_i.txt")) - is_ngspice_running = self.checkIfProcessRunning("ngspice") - if not is_ngspice_running: + def checkChangeInPlotFile(self, currTime, exitStatus): + self.enableButtons(True) + if exitStatus == QtCore.QProcess.NormalExit: + try: + # if os.name == 'nt': + # proc = 'mintty' + # else: + # proc = 'xterm' + + st = os.stat(os.path.join(self.projDir, "plot_data_i.txt")) self.simulationCompleted = True - if st.st_mtime >= currTime - 1: - self.is_file_changed = True - self.plot_simulation() + if st.st_mtime >= currTime: + self.isFileChanged = True + + 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)) + return - except Exception: - pass + except Exception: + pass def enableButtons(self, state): self.ngspice.setEnabled(state) @@ -577,30 +591,23 @@ class Application(QtWidgets.QMainWindow): self.wrkspce.setEnabled(state) def isSimulationSuccess(self): - return self.is_file_changed - - def resetSimulationVariables(self): - self.count = 0 - self.currTime = 0 + return self.isFileChanged def open_ngspice(self): """This Function execute ngspice on current project.""" self.projDir = self.obj_appconfig.current_project["ProjectName"] - self.is_file_changed = False + self.isFileChanged = False self.simulationCompleted = False self.simulationEssentials = { "enableButtons": self.enableButtons, - "isSimulationSuccess": self.isSimulationSuccess, - "resetSimulationVariables": self.resetSimulationVariables, - "checkChangeInPlotFile": self.check_change_in_plotfile, + "checkChangeInPlotFile": self.checkChangeInPlotFile, } if self.projDir is not None: self.currTime = time.time() # Edited by Sumanto Kar 25/08/2021 - self.enableButtons(False) if self.obj_Mainview.obj_dockarea.ngspiceEditor( self.projDir, self.simulationEssentials) is False: print( @@ -616,8 +623,6 @@ class Application(QtWidgets.QMainWindow): self.msg.exec_() return - self.count = 0 - else: self.msg = QtWidgets.QErrorMessage() self.msg.setModal(True) @@ -628,21 +633,6 @@ class Application(QtWidgets.QMainWindow): ) self.msg.exec_() - def plot_simulation(self): - 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)) - def open_subcircuit(self): """ This function opens 'subcircuit' option in left-tool-bar. |