summaryrefslogtreecommitdiff
path: root/src/projManagement/Kicad.py
diff options
context:
space:
mode:
authorfahim2015-05-14 19:21:26 +0530
committerfahim2015-05-14 19:21:26 +0530
commit9469147242465102059e0703b9532e17d63983bc (patch)
tree5e504a30d6ce7a2677f9108769b406111750011f /src/projManagement/Kicad.py
parenta31c044d8d8307060664e2b0025054ca0584016d (diff)
downloadeSim-9469147242465102059e0703b9532e17d63983bc.tar.gz
eSim-9469147242465102059e0703b9532e17d63983bc.tar.bz2
eSim-9469147242465102059e0703b9532e17d63983bc.zip
Subject: openNgspice function completed
Description: openNgspice function completed
Diffstat (limited to 'src/projManagement/Kicad.py')
-rw-r--r--src/projManagement/Kicad.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py
index 65f71266..dd7fdf1a 100644
--- a/src/projManagement/Kicad.py
+++ b/src/projManagement/Kicad.py
@@ -21,6 +21,8 @@ import Validation
from configuration.Appconfig import Appconfig
import Worker
from PyQt4 import QtGui
+import shutil
+from gevent.hub import sleep
class Kicad:
"""
@@ -131,4 +133,39 @@ class Kicad:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
self.msg.setWindowTitle("Error Message")
+
+ def openNgspice(self):
+ """
+ This function call ngspice simulator
+ """
+ self.projDir = self.obj_appconfig.current_project["ProjectName"]
+ #Validating if current project is available or not
+ if self.obj_validation.validateKicad(self.projDir):
+ self.projName = os.path.basename(self.projDir)
+ self.project = os.path.join(self.projDir,self.projName)
+ print "Validated"
+ #Creating ngspice command
+ self.cmd = "xterm -e ngspice "+self.project+".cir.out"
+ self.obj_workThread = Worker.WorkerThread(self.cmd)
+ self.obj_workThread.start()
+
+ while 1:
+ if self.obj_workThread.isFinished():
+ print "Finished"
+ sleep(1)
+ #Moving plot_data_i.txt and plot_data_v.txt to project directory
+ shutil.copy2("plot_data_i.txt", self.projDir)
+ shutil.copy2("plot_data_v.txt", self.projDir)
+ #Deleting this file from current directory
+ os.remove("plot_data_i.txt")
+ os.remove("plot_data_v.txt")
+ break
+ else:
+ pass
+ print "After While Loop"
+
+ else:
+ self.msg = QtGui.QErrorMessage(None)
+ self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
+ self.msg.setWindowTitle("Error Message")
\ No newline at end of file