summaryrefslogtreecommitdiff
path: root/src/projManagement
diff options
context:
space:
mode:
authorfahim2015-05-14 19:21:26 +0530
committerfahim2015-05-14 19:21:26 +0530
commit9469147242465102059e0703b9532e17d63983bc (patch)
tree5e504a30d6ce7a2677f9108769b406111750011f /src/projManagement
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')
-rw-r--r--src/projManagement/Kicad.py37
-rw-r--r--src/projManagement/Kicad.pycbin4302 -> 5358 bytes
-rw-r--r--src/projManagement/Worker.py5
-rw-r--r--src/projManagement/Worker.pycbin1501 -> 1522 bytes
4 files changed, 41 insertions, 1 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
diff --git a/src/projManagement/Kicad.pyc b/src/projManagement/Kicad.pyc
index 78351af9..3c0772e0 100644
--- a/src/projManagement/Kicad.pyc
+++ b/src/projManagement/Kicad.pyc
Binary files differ
diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py
index 084b8048..f7186913 100644
--- a/src/projManagement/Worker.py
+++ b/src/projManagement/Worker.py
@@ -18,7 +18,7 @@
from PyQt4 import QtCore
import subprocess
from configuration.Appconfig import Appconfig
-
+import os
class WorkerThread(QtCore.QThread):
"""
@@ -27,10 +27,12 @@ class WorkerThread(QtCore.QThread):
def __init__(self,args):
QtCore.QThread.__init__(self)
self.args = args
+
def __del__(self):
self.wait()
+
def run(self):
print "Calling Command:",self.args
@@ -41,5 +43,6 @@ class WorkerThread(QtCore.QThread):
proc = subprocess.Popen(command.split())
procThread.procThread_list.append(proc)
+
\ No newline at end of file
diff --git a/src/projManagement/Worker.pyc b/src/projManagement/Worker.pyc
index 3e44fe79..5e5bb178 100644
--- a/src/projManagement/Worker.pyc
+++ b/src/projManagement/Worker.pyc
Binary files differ