summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfahim2015-05-14 19:21:26 +0530
committerfahim2015-05-14 19:21:26 +0530
commit9469147242465102059e0703b9532e17d63983bc (patch)
tree5e504a30d6ce7a2677f9108769b406111750011f /src
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')
-rwxr-xr-xsrc/frontEnd/Application.py3
-rw-r--r--src/frontEnd/DockArea.py19
-rw-r--r--src/frontEnd/ProjectExplorer.py3
-rw-r--r--src/frontEnd/ProjectExplorer.pycbin5049 -> 5121 bytes
-rw-r--r--src/frontEnd/Workspace.py2
-rw-r--r--src/frontEnd/Workspace.pycbin3394 -> 3404 bytes
-rw-r--r--src/ngspiceSimulation/pythonPlotting.py12
-rw-r--r--src/ngspiceSimulation/pythonPlotting.pycbin17155 -> 17120 bytes
-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
12 files changed, 63 insertions, 18 deletions
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index 879c841f..f7e5034d 100755
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -98,6 +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.footprint = QtGui.QAction(QtGui.QIcon('../images/default.png'),'<b>Footprint Editor</b>',self)
self.footprint.triggered.connect(self.obj_kicad.openFootprint)
@@ -213,6 +214,8 @@ class MainView(QtGui.QWidget):
#Adding to main Layout
self.mainLayout.addWidget(self.leftSplit)
+ self.leftSplit.setSizes([self.width()/4.5,self.height()])
+ self.middleSplit.setSizes([self.width(),self.height()/2])
self.setLayout(self.mainLayout)
diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py
index e9755302..70af5384 100644
--- a/src/frontEnd/DockArea.py
+++ b/src/frontEnd/DockArea.py
@@ -1,7 +1,7 @@
from PyQt4 import QtGui,QtCore
from ngspiceSimulation.pythonPlotting import plotWindow
-#from configuration.Appconfig import Appconfig
-
+from configuration.Appconfig import Appconfig
+import os
dockList = ['Blank']
count = 1
@@ -12,7 +12,8 @@ class DockArea(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
-
+ self.obj_appconfig = Appconfig()
+
for dockName in dockList:
dock[dockName] = QtGui.QDockWidget(dockName)
dock[dockName].setWidget(QtGui.QTextEdit())
@@ -51,14 +52,16 @@ class DockArea(QtGui.QMainWindow):
"""
This function create widget for Library Editor
"""
- global count
- self.plottingWidget = QtGui.QWidget()
- #self.plottingArea = QtGui.QTextEdit()
+ self.projDir = self.obj_appconfig.current_project["ProjectName"]
+ self.projName = os.path.basename(self.projDir)
+ self.project = os.path.join(self.projDir,self.projName)
+ global count
+ self.plottingWidget = QtGui.QWidget()
+
self.plottingLayout = QtGui.QVBoxLayout()
- #self.plottingLayout.addWidget(self.plottingArea)
- self.plottingLayout.addWidget(plotWindow())
+ self.plottingLayout.addWidget(plotWindow(self.project,self.projName))
#Adding to main Layout
self.plottingWidget.setLayout(self.plottingLayout)
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py
index d1c76bbf..921d0594 100644
--- a/src/frontEnd/ProjectExplorer.py
+++ b/src/frontEnd/ProjectExplorer.py
@@ -63,9 +63,10 @@ class ProjectExplorer(QtGui.QWidget):
self.textwindow = QtGui.QWidget()
self.textwindow.setMinimumSize(600, 500)
+ self.textwindow.setGeometry(QtCore.QRect(400,150,400,400))
self.textwindow.setWindowTitle(filename)
+
self.text = QtGui.QTextEdit()
- #self.text.setMaximumSize(580, 450)
self.save = QtGui.QPushButton('Save and Exit')
self.save.setDisabled(True)
self.windowgrid = QtGui.QGridLayout()
diff --git a/src/frontEnd/ProjectExplorer.pyc b/src/frontEnd/ProjectExplorer.pyc
index 4be2d8b1..87ff05a8 100644
--- a/src/frontEnd/ProjectExplorer.pyc
+++ b/src/frontEnd/ProjectExplorer.pyc
Binary files differ
diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py
index 8ba6c60f..9dd97f1a 100644
--- a/src/frontEnd/Workspace.py
+++ b/src/frontEnd/Workspace.py
@@ -65,7 +65,7 @@ class Workspace(QtGui.QWidget):
self.grid.addWidget(self.okbtn, 4,13)
self.grid.addWidget(self.cancelbtn, 4,14)
- self.setGeometry(QtCore.QRect(400,200,400,400))
+ self.setGeometry(QtCore.QRect(500,250,400,400))
self.setMaximumSize(4000, 200)
self.setWindowTitle("Workspace Launcher")
#self.setWindowIcon(QtGui.QIcon('logo.png'))
diff --git a/src/frontEnd/Workspace.pyc b/src/frontEnd/Workspace.pyc
index b5484f93..038bc7e3 100644
--- a/src/frontEnd/Workspace.pyc
+++ b/src/frontEnd/Workspace.pyc
Binary files differ
diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py
index c7a82851..c3203fe0 100644
--- a/src/ngspiceSimulation/pythonPlotting.py
+++ b/src/ngspiceSimulation/pythonPlotting.py
@@ -9,15 +9,13 @@ from matplotlib.figure import Figure
import tkMessageBox
-from configuration.Appconfig import Appconfig
-
class plotWindow(QtGui.QMainWindow):
- def __init__(self):
+ def __init__(self,fpath,projectName):
QtGui.QMainWindow.__init__(self)
- #Creating App config object
- #self.obj_appconfig = Appconfig()
- self.fpath = "/home/fahim/Installed-Software/FreeEDA/Examples/RC"
- self.projName = "RC"
+ 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
index 864fa3a6..49fcd283 100644
--- a/src/ngspiceSimulation/pythonPlotting.pyc
+++ b/src/ngspiceSimulation/pythonPlotting.pyc
Binary files differ
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