diff options
author | fahim | 2015-05-15 12:06:14 +0530 |
---|---|---|
committer | fahim | 2015-05-15 12:06:14 +0530 |
commit | 657794c3c482f8b8d8964a0b81d5d5c1e43ee346 (patch) | |
tree | 76e8df7c6edd0d46c3fd42d24fc2321ed780e4d4 | |
parent | 9469147242465102059e0703b9532e17d63983bc (diff) | |
download | eSim-657794c3c482f8b8d8964a0b81d5d5c1e43ee346.tar.gz eSim-657794c3c482f8b8d8964a0b81d5d5c1e43ee346.tar.bz2 eSim-657794c3c482f8b8d8964a0b81d5d5c1e43ee346.zip |
Subject: Updated openNgspice function
Description: updated openNgspice function. Added return value which will
be used to call python plotting function
-rwxr-xr-x | src/frontEnd/Application.py | 16 | ||||
-rw-r--r-- | src/ngspiceSimulation/pythonPlotting.py | 4 | ||||
-rw-r--r-- | src/ngspiceSimulation/pythonPlotting.pyc | bin | 17120 -> 17168 bytes | |||
-rw-r--r-- | src/projManagement/Kicad.py | 35 | ||||
-rw-r--r-- | src/projManagement/Kicad.pyc | bin | 5358 -> 5337 bytes |
5 files changed, 31 insertions, 24 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index f7e5034d..7dee39a7 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -98,7 +98,7 @@ class Application(QtGui.QMainWindow): self.conversion.triggered.connect(self.obj_kicad.openKicadToNgspice) self.ngspice = QtGui.QAction(QtGui.QIcon('../images/default.png'), '<b>Simulation</b>', self) - self.ngspice.triggered.connect(self.obj_kicad.openNgspice) + self.ngspice.triggered.connect(self.open_ngspice) self.footprint = QtGui.QAction(QtGui.QIcon('../images/default.png'),'<b>Footprint Editor</b>',self) self.footprint.triggered.connect(self.obj_kicad.openFootprint) @@ -151,7 +151,19 @@ class Application(QtGui.QMainWindow): self.obj_Mainview.obj_projectExplorer.addTreeNode(directory, filelist) except: pass - #self.setCentralWidget(self.obj_Mainview) + + def open_ngspice(self): + """ + This Function execute ngspice on current project + """ + + ret_val = self.obj_kicad.openNgspice() + + if ret_val: + self.obj_Mainview.obj_dockarea.plottingEditor() + + else: + print "Return False" def exit_project(self): diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py index c3203fe0..c7f40ae3 100644 --- a/src/ngspiceSimulation/pythonPlotting.py +++ b/src/ngspiceSimulation/pythonPlotting.py @@ -12,10 +12,10 @@ import tkMessageBox class plotWindow(QtGui.QMainWindow): def __init__(self,fpath,projectName): QtGui.QMainWindow.__init__(self) + print "Path : ",fpath + print "Project :",projectName self.fpath = fpath+".cir.out" self.projName = projectName - print "File Path",self.fpath - print "Project Name",self.projName self.createMainFrame() self.combo = [] self.combo1 = [] diff --git a/src/ngspiceSimulation/pythonPlotting.pyc b/src/ngspiceSimulation/pythonPlotting.pyc Binary files differindex 49fcd283..eb8c6ddb 100644 --- a/src/ngspiceSimulation/pythonPlotting.pyc +++ b/src/ngspiceSimulation/pythonPlotting.pyc diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py index dd7fdf1a..aa4ba8eb 100644 --- a/src/projManagement/Kicad.py +++ b/src/projManagement/Kicad.py @@ -20,9 +20,10 @@ import os import Validation from configuration.Appconfig import Appconfig import Worker -from PyQt4 import QtGui +from PyQt4 import QtGui, QtCore import shutil from gevent.hub import sleep +import subprocess class Kicad: """ @@ -143,29 +144,23 @@ class Kicad: 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" - + proc = subprocess.Popen(self.cmd.split()) + proc.communicate()[0] + + #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") + + return True + 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 + return False
\ No newline at end of file diff --git a/src/projManagement/Kicad.pyc b/src/projManagement/Kicad.pyc Binary files differindex 3c0772e0..f805c100 100644 --- a/src/projManagement/Kicad.pyc +++ b/src/projManagement/Kicad.pyc |