diff options
author | nilshah98 | 2019-06-24 16:07:59 +0530 |
---|---|---|
committer | nilshah98 | 2019-06-24 16:07:59 +0530 |
commit | 6729452e815c8f4733f36deba572ee054113ca2c (patch) | |
tree | 18fb927274c4957907ed5fddf89eb6f739d0f10f /src | |
parent | 36d047799641be04f4e8f441187e9382d6e87e7e (diff) | |
download | eSim-6729452e815c8f4733f36deba572ee054113ca2c.tar.gz eSim-6729452e815c8f4733f36deba572ee054113ca2c.tar.bz2 eSim-6729452e815c8f4733f36deba572ee054113ca2c.zip |
Recommended changes made
Diffstat (limited to 'src')
-rwxr-xr-x | src/frontEnd/Application.py | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 4f40650f..974d55f1 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -30,9 +30,10 @@ import time from PyQt4.Qt import QSize import sys import os -import time # Its our main window of application. + + class Application(QtGui.QMainWindow): """This class initializes all objects used in this file(Application.py).""" global project_name @@ -325,34 +326,23 @@ class Application(QtGui.QMainWindow): if self.projDir is not None: self.obj_Mainview.obj_dockarea.ngspiceEditor(self.projDir) - # Fail Safe, to never go in infinte loop - - ''' - t_end = time.time() + 5*60 - while(time.time() < t_end): - pass - ''' - # Run the while loop for a max of 300 seconds (5 minutes) - - if("plot_data_i.txt" in os.listdir(self.projDir)): - lastModificationTime = os.path.getmtime(self.projDir+"/plot_data_i.txt") - newModificationTime = os.path.getmtime(self.projDir+"/plot_data_i.txt") - - while(newModificationTime == lastModificationTime): - newModificationTime = os.path.getmtime(self.projDir+"/plot_data_i.txt") - # Poll for data every 0.2 seconds, so system doesn't crash - time.sleep(0.2) - - else: - files = os.listdir(self.projDir) - while("plot_data_i.txt" not in files): - files = os.listdir(self.projDir) - # Poll for data every 0.2 seconds, so system doesn't crash - time.sleep(0.2) + currTime = time.time() + count = 0 + while True: + try: + st = os.stat(os.path.join(self.projDir, "plot_data_i.txt")) + if st.st_mtime >= currTime: + break + except Exception: + pass + time.sleep(0.2) + # Fail Safe ===> + count += 1 + if count >= 100: + raise Exception("ngspice taking too long, check netlist file") - # time.sleep(2) # Need permanent solution # Calling Python Plotting - try: self.obj_Mainview.obj_dockarea.plottingEditor() except Exception as e: |