diff options
author | Eyantra698Sumanto | 2022-01-29 20:28:43 +0530 |
---|---|---|
committer | Eyantra698Sumanto | 2022-01-29 20:28:43 +0530 |
commit | 036b3c28cefcc2e95be3d0f660e01fe2bd9630d5 (patch) | |
tree | 3b61a678d533c71b43d63dfff8b26ca9f4190792 /src/frontEnd | |
parent | 24af4e69adcc52fe8b03ad4ca5bb422d29b8292e (diff) | |
parent | 1d044a719c68488dd90cef2faf5b1101c005ab4c (diff) | |
download | eSim-036b3c28cefcc2e95be3d0f660e01fe2bd9630d5.tar.gz eSim-036b3c28cefcc2e95be3d0f660e01fe2bd9630d5.tar.bz2 eSim-036b3c28cefcc2e95be3d0f660e01fe2bd9630d5.zip |
Resolved Conflicts
Diffstat (limited to 'src/frontEnd')
-rwxr-xr-x | src/frontEnd/Application.py | 65 | ||||
-rwxr-xr-x | src/frontEnd/DockArea.py | 1 |
2 files changed, 59 insertions, 7 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 6bafe704..d22f7ccc 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -11,15 +11,16 @@ # NOTES: --- # AUTHOR: Fahim Khan, fahim.elex@gmail.com # MODIFIED: Rahul Paknikar, rahulp@iitb.ac.in -# Sumanto Kar, jeetsumanto123@gmail.com +# Sumanto Kar, sumantokar@iitb.ac.in, FOSSEE, IIT Bombay # ORGANIZATION: eSim Team at FOSSEE, IIT Bombay # CREATED: Tuesday 24 February 2015 -# REVISION: Sunday 13 December 2020 +# REVISION: Wednesday 25 August 2021 # ========================================================================= import os import traceback # noqa:F401 +import traceback if os.name == 'nt': # noqa from frontEnd import pathmagic # noqa:F401 init_path = '' @@ -41,9 +42,11 @@ from PyQt5.Qt import QSize import shutil import time import sys - +import psutil # Its our main window of application. + + class Application(QtWidgets.QMainWindow): """This class initializes all objects used in this file.""" global project_name @@ -532,11 +535,28 @@ class Application(QtWidgets.QMainWindow): print("Current Project is : ", self.obj_appconfig.current_project) self.obj_Mainview.obj_dockarea.usermanual() + def checkIfProcessRunning(self, processName): + ''' + Check if there is any running process + that contains the given name processName. + ''' + # Iterate over the all the running process + for proc in psutil.process_iter(): + try: + # Check if process name contains the given name string. + if processName.lower() in proc.name().lower(): + return True + except (psutil.NoSuchProcess, + psutil.AccessDenied, psutil.ZombieProcess): + pass + return False + def open_ngspice(self): """This Function execute ngspice on current project.""" self.projDir = self.obj_appconfig.current_project["ProjectName"] if self.projDir is not None: + self.obj_Mainview.obj_dockarea.ngspiceEditor(self.projDir) if self.obj_Mainview.obj_dockarea.ngspiceEditor( self.projDir) is False: @@ -553,12 +573,41 @@ class Application(QtWidgets.QMainWindow): ) self.msg.exec_() return +======= + # Edited by Sumanto Kar 25/08/2021 + if self.obj_Mainview.obj_dockarea.ngspiceEditor( + self.projDir) is False: + print( + "No netlist file (*.cir.out)" + "Check netlist file to change simulation parameters." + ) +>>>>>>> master + self.msg = QtWidgets.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Warning Message") + self.msg.showMessage( + 'No netlist file (*.cir.out)' + ) + self.msg.exec_() + return currTime = time.time() count = 0 while True: try: + # Edited by Sumanto Kar 25/08/2021 st = os.stat(os.path.join(self.projDir, "plot_data_i.txt")) + if self.checkIfProcessRunning('xterm') is False: + self.msg = QtWidgets.QErrorMessage() + self.msg.setModal(True) + self.msg.setWindowTitle("Warning Message") + self.msg.showMessage( + 'Simulation was interuppted. ' + 'Please close all the Xterm windows.' + 'And then rerun the simulation' + ) + self.msg.exec_() + return if st.st_mtime >= currTime: break except Exception: @@ -570,7 +619,8 @@ class Application(QtWidgets.QMainWindow): if count >= 10: print( "Ngspice taking too long for simulation. " - "Check netlist file to change simulation parameters." + "Check netlist file (*.cir.out) " + "to change simulation parameters." ) self.msg = QtWidgets.QErrorMessage() @@ -578,7 +628,8 @@ class Application(QtWidgets.QMainWindow): self.msg.setWindowTitle("Warning Message") self.msg.showMessage( 'Ngspice taking too long for simulation. ' - 'Check netlist file to change simulation parameters.' + 'Check netlist file (*.cir.out) ' + 'to change simulation parameters.' ) self.msg.exec_() @@ -596,7 +647,7 @@ class Application(QtWidgets.QMainWindow): ' Please look at console for more details.' ) self.msg.exec_() - print("Exception Message:", str(e)) + print("Exception Message:", str(e), traceback.format_exc()) self.obj_appconfig.print_error('Exception Message : ' + str(e)) else: @@ -745,7 +796,7 @@ class Application(QtWidgets.QMainWindow): else: self.msg = QtWidgets.QErrorMessage() self.msg.setModal(True) - self.msg.setWindowTitle("Missing Ngspice netlist") + self.msg.setWindowTitle("Missing Ngspice Netlist") self.msg.showMessage( 'Current project does not contain any Ngspice file. ' + 'Please create Ngspice file with extension .cir.out' diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py index 267e6617..461240b9 100755 --- a/src/frontEnd/DockArea.py +++ b/src/frontEnd/DockArea.py @@ -124,6 +124,7 @@ class DockArea(QtWidgets.QMainWindow): self.ngspiceNetlist = os.path.join( self.projDir, self.projName + ".cir.out") + # Edited by Sumanto Kar 25/08/2021 if os.path.isfile(self.ngspiceNetlist) is False: return False |