summaryrefslogtreecommitdiff
path: root/src/projManagement/Kicad.py
diff options
context:
space:
mode:
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