summaryrefslogtreecommitdiff
path: root/src/frontEnd
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontEnd')
-rwxr-xr-xsrc/frontEnd/Application.py42
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: