summaryrefslogtreecommitdiff
path: root/src/kicadtoNgspice/KicadtoNgspice.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/kicadtoNgspice/KicadtoNgspice.py')
-rw-r--r--src/kicadtoNgspice/KicadtoNgspice.py77
1 files changed, 69 insertions, 8 deletions
diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py
index 01887ec5..4af345fc 100644
--- a/src/kicadtoNgspice/KicadtoNgspice.py
+++ b/src/kicadtoNgspice/KicadtoNgspice.py
@@ -17,32 +17,39 @@
#===============================================================================
import sys
import os
-from PyQt4 import QtGui
+from PyQt4 import QtGui,QtCore
+from Processing import PrcocessNetlist
import Analysis
import Source
+import Convert
+import TrackWidget
+
class MainWindow(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
- #self.kicadfile = sys.argv[1]
- self.kicadfile = "/home/fahim/eSim-Workspace/BJT_amplifier/BJT_amplifier.cir"
- print "Init Kicad to Ngspice"
-
+ #Create object of track widget
+ self.obj_track = TrackWidget.TrackWidget()
+
+ print "Init Kicad to Ngspice"
#Creating GUI for kicadtoNgspice window
self.grid = QtGui.QGridLayout(self)
self.convertbtn = QtGui.QPushButton("Convert")
+ self.convertbtn.clicked.connect(self.callConvert)
self.cancelbtn = QtGui.QPushButton("Cancel")
self.cancelbtn.clicked.connect(self.close)
self.grid.addWidget(self.createcreateConvertWidget(),0,0)
self.grid.addWidget(self.convertbtn,1,1)
self.grid.addWidget(self.cancelbtn,1,2)
- self.setGeometry(500, 500, 600, 600)
+ #self.setGeometry(800, 800, 1000, 1000)
+ self.setWindowState(QtCore.Qt.WindowMaximized)
self.setLayout(self.grid)
self.show()
def createcreateConvertWidget(self):
+
self.convertWindow = QtGui.QWidget()
self.analysisTab = QtGui.QScrollArea()
@@ -51,7 +58,7 @@ class MainWindow(QtGui.QWidget):
self.analysisTab.setWidgetResizable(True)
self.sourceTab = QtGui.QScrollArea()
- self.sourceTab.setWidget(Source.Source(self.kicadfile))
+ self.sourceTab.setWidget(Source.Source(sourcelist,sourcelisttrack))
self.sourceTabLayout = QtGui.QVBoxLayout(self.sourceTab.widget())
self.sourceTab.setWidgetResizable(True)
@@ -72,6 +79,19 @@ class MainWindow(QtGui.QWidget):
return self.convertWindow
+
+ def callConvert(self):
+ """
+ Calling Convert Class Constructor
+ """
+ global schematicInfo
+ self.obj_convert = Convert.Convert(self.obj_track.sourcelisttrack["ITEMS"],
+ self.obj_track.entry_var["ITEMS"],
+ schematicInfo)
+
+ #Adding Source Value to Schematic Info
+ schematicInfo = self.obj_convert.addSourceParameter()
+
@@ -79,9 +99,50 @@ def main(args):
print "=================================="
print "Kicad to Ngspice netlist converter "
print "=================================="
+ global kicadFile,kicadNetlist,schematicInfo
+ kicadFile = "/home/fahim/eSim-Workspace/BJT_amplifier/BJT_amplifier.cir"
+ #kicadFile = sys.argv[1]
+
+ #Object of Processing
+ obj_proc = PrcocessNetlist()
+
+ # Read the netlist
+ kicadNetlist = obj_proc.readNetlist(kicadFile)
+
+ # Construct parameter information
+ param=obj_proc.readParamInfo(kicadNetlist)
+
+ # Replace parameter with values
+ netlist,infoline=obj_proc.preprocessNetlist(kicadNetlist,param)
+
+ print "NETLIST ",netlist
+ print "INFOLINE",infoline
+
+ # Separate option and schematic information
+ optionInfo, schematicInfo=obj_proc.separateNetlistInfo(netlist)
+
+ print "OPTIONINFO",optionInfo
+ print "SCHEMATICINFO",schematicInfo
+
+ #Getting model and subckt list
+ modelList=[]
+ subcktList=[]
+ modelList,subcktList = obj_proc.getModelSubcktList(schematicInfo,modelList,subcktList)
+
+ print "MODEL LIST ",modelList
+ print "SUBCKT ",subcktList
+
+ #List for storing source and its value
+ global sourcelist, sourcelisttrack
+ sourcelist=[]
+ sourcelisttrack=[]
+ schematicInfo,sourcelist=obj_proc.insertSpecialSourceParam(schematicInfo,sourcelist)
- #print "The passed netlist file is ",sys.argv[1]
+ print "SOURCELIST",sourcelist
+ print "SCHEMATICINFO",schematicInfo
+
+
app = QtGui.QApplication(args)
#app.setApplicationName("KicadToNgspice")
#app.setQuitOnLastWindowClosed(True)