diff options
author | fahim | 2015-05-15 17:51:50 +0530 |
---|---|---|
committer | fahim | 2015-05-15 17:51:50 +0530 |
commit | a341c872157b497306e964c4407b012774cc0597 (patch) | |
tree | 22ade101e6e0e40109ba3dfc6dba8c4ae21ecb3e | |
parent | b02da14912ca9bf756db0828d6d94d1d732d8476 (diff) | |
download | eSim-a341c872157b497306e964c4407b012774cc0597.tar.gz eSim-a341c872157b497306e964c4407b012774cc0597.tar.bz2 eSim-a341c872157b497306e964c4407b012774cc0597.zip |
Subject: Update KicadToNgSpice Converter file
Description: Added proper GUI for error message in case of unknown model
used in schematic or multiple model is available in modelParamXML
directory.
-rw-r--r-- | src/frontEnd/ProjectExplorer.pyc | bin | 5121 -> 5121 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/Analysis.pyc | bin | 11759 -> 11738 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/Convert.pyc | bin | 11437 -> 11395 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/DeviceModel.pyc | bin | 4836 -> 4832 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/KicadtoNgspice.py | 69 | ||||
-rw-r--r-- | src/kicadtoNgspice/Model.pyc | bin | 1948 -> 1945 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/Processing.pyc | bin | 8494 -> 8485 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/Source.pyc | bin | 4004 -> 4000 bytes | |||
-rw-r--r-- | src/kicadtoNgspice/TrackWidget.pyc | bin | 889 -> 887 bytes | |||
-rw-r--r-- | src/ngspiceSimulation/pythonPlotting.py | 21 | ||||
-rw-r--r-- | src/ngspiceSimulation/pythonPlotting.pyc | bin | 17145 -> 16955 bytes |
11 files changed, 48 insertions, 42 deletions
diff --git a/src/frontEnd/ProjectExplorer.pyc b/src/frontEnd/ProjectExplorer.pyc Binary files differindex 87ff05a8..3a843b23 100644 --- a/src/frontEnd/ProjectExplorer.pyc +++ b/src/frontEnd/ProjectExplorer.pyc diff --git a/src/kicadtoNgspice/Analysis.pyc b/src/kicadtoNgspice/Analysis.pyc Binary files differindex 31c7d222..ccbb0cc3 100644 --- a/src/kicadtoNgspice/Analysis.pyc +++ b/src/kicadtoNgspice/Analysis.pyc diff --git a/src/kicadtoNgspice/Convert.pyc b/src/kicadtoNgspice/Convert.pyc Binary files differindex bb1cffde..cb17c4cd 100644 --- a/src/kicadtoNgspice/Convert.pyc +++ b/src/kicadtoNgspice/Convert.pyc diff --git a/src/kicadtoNgspice/DeviceModel.pyc b/src/kicadtoNgspice/DeviceModel.pyc Binary files differindex 94e4054e..934c694f 100644 --- a/src/kicadtoNgspice/DeviceModel.pyc +++ b/src/kicadtoNgspice/DeviceModel.pyc diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index a320e1b2..dbb39ddc 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -30,19 +30,42 @@ import TrackWidget class MainWindow(QtGui.QWidget): """ - This class craete KicadtoNgspice window. - And Call Convert function if convert button is pressed. + This class create KicadtoNgspice window. + And Call Convert function if convert button is pressed. + The convert function takes all the value entered by user and create a final netlist "*.cir.out". + This final netlist is compatible with NgSpice. """ def __init__(self): QtGui.QWidget.__init__(self) #Create object of track widget self.obj_track = TrackWidget.TrackWidget() - - print "Init Kicad to Ngspice" - #print "Current Project",sys.argv[1] - + """ + Checking if any unknown model is used in schematic which is not recognized by NgSpice. + Also if the two model of same name is present under modelParamXML directory + """ + if unknownModelList: + print "Unknown Model List is : ",unknownModelList + self.msg = QtGui.QErrorMessage() + self.content = "Your schematic contain unknown model "+', '.join(unknownModelList) + self.msg.showMessage(self.content) + self.msg.setWindowTitle("Unknown Models") - #Creating GUI for kicadtoNgspice window + elif multipleModelList: + print "Multiple Model List is : ",multipleModelList + self.msg = QtGui.QErrorMessage() + self.mcontent = "Look like you have duplicate model in modelParamXML directory "+', '.join(multipleModelList[0]) + self.msg.showMessage(self.mcontent) + self.msg.setWindowTitle("Multiple Models") + + else: + self.createMainWindow() + + + def createMainWindow(self): + """ + This function create main window of Kicad to Ngspice converter + """ + self.grid = QtGui.QGridLayout(self) self.convertbtn = QtGui.QPushButton("Convert") self.convertbtn.clicked.connect(self.callConvert) @@ -51,11 +74,11 @@ class MainWindow(QtGui.QWidget): self.grid.addWidget(self.createcreateConvertWidget(),0,0) self.grid.addWidget(self.convertbtn,1,1) self.grid.addWidget(self.cancelbtn,1,2) - #self.setGeometry(800, 800, 1000, 1000) self.setWindowState(QtCore.Qt.WindowMaximized) self.setLayout(self.grid) + self.setWindowTitle("Kicad To NgSpice Converter") self.show() - + def createcreateConvertWidget(self): @@ -237,8 +260,7 @@ class MainWindow(QtGui.QWidget): out.close() - - + #Main Function @@ -248,7 +270,6 @@ def main(args): print "==================================" global kicadFile,kicadNetlist,schematicInfo global infoline,optionInfo - #kicadFile = "/home/fahim/eSim-Workspace/BJT_amplifier/BJT_amplifier.cir" kicadFile = sys.argv[1] #Object of Processing @@ -283,7 +304,8 @@ def main(args): print "SCHEMATICINFO",schematicInfo #List storing model detail - global modelList,outputOption + global modelList,outputOption,unknownModelList,multipleModelList + modelList = [] outputOption = [] schematicInfo,outputOption,modelList,unknownModelList,multipleModelList = obj_proc.convertICintoBasicBlocks(schematicInfo,outputOption,modelList) @@ -291,27 +313,10 @@ def main(args): print "Multiple Model List",multipleModelList print "Model List",modelList - - - #Checking for unknown Model List and Multiple Model List - if unknownModelList: - print "ErrorMessage : These Models are not available.Please check it",unknownModelList - sys.exit(2) - else: - if multipleModelList: - print "ErrorMessage: There are multiple model of same name. Please check it",multipleModelList - sys.exit(2) - else: - pass - - - - + app = QtGui.QApplication(args) - #app.setApplicationName("KicadToNgspice") - #app.setQuitOnLastWindowClosed(True) kingWindow = MainWindow() - kingWindow.show() + #kingWindow.show() #No need to call show as we are doing it in createMainWindow sys.exit(app.exec_()) diff --git a/src/kicadtoNgspice/Model.pyc b/src/kicadtoNgspice/Model.pyc Binary files differindex 4ed30220..39ddfc27 100644 --- a/src/kicadtoNgspice/Model.pyc +++ b/src/kicadtoNgspice/Model.pyc diff --git a/src/kicadtoNgspice/Processing.pyc b/src/kicadtoNgspice/Processing.pyc Binary files differindex 1542143d..2b8c5301 100644 --- a/src/kicadtoNgspice/Processing.pyc +++ b/src/kicadtoNgspice/Processing.pyc diff --git a/src/kicadtoNgspice/Source.pyc b/src/kicadtoNgspice/Source.pyc Binary files differindex a3eb39eb..a634f8ad 100644 --- a/src/kicadtoNgspice/Source.pyc +++ b/src/kicadtoNgspice/Source.pyc diff --git a/src/kicadtoNgspice/TrackWidget.pyc b/src/kicadtoNgspice/TrackWidget.pyc Binary files differindex e23bacc4..7f819d81 100644 --- a/src/kicadtoNgspice/TrackWidget.pyc +++ b/src/kicadtoNgspice/TrackWidget.pyc diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py index e2156920..9e7761fe 100644 --- a/src/ngspiceSimulation/pythonPlotting.py +++ b/src/ngspiceSimulation/pythonPlotting.py @@ -1,8 +1,6 @@ from __future__ import division # Used for decimal division eg 2/3=0.66 and not '0' 6/2=3.0 and 6//2=3 -import sys, os -from PyQt4 import QtGui, uic, QtCore -from decimal import * -import matplotlib +from PyQt4 import QtGui, QtCore +from decimal import Decimal from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar from matplotlib.figure import Figure @@ -12,8 +10,6 @@ import tkMessageBox class plotWindow(QtGui.QMainWindow): def __init__(self,fpath,projectName): QtGui.QMainWindow.__init__(self) - print "Path : ",fpath - print "Project :",projectName self.fpath = fpath self.projName = projectName self.createMainFrame() @@ -24,9 +20,13 @@ class plotWindow(QtGui.QMainWindow): def createMainFrame(self): self.main_frame = QtGui.QWidget() self.dpi = 100 + #Creating Figure Canvas self.fig = Figure((7.0, 7.0), dpi=self.dpi) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self.main_frame) + self.canvas.setSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding) + self.canvas.updateGeometry() + self.axes = self.fig.add_subplot(111) self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame) @@ -37,10 +37,11 @@ class plotWindow(QtGui.QMainWindow): right_vbox = QtGui.QVBoxLayout() right_grid = QtGui.QGridLayout() top_grid = QtGui.QGridLayout() - + + ##Processing data file to extract data in proper format self.fobj = File_data() plot_type = self.fobj.openFile(self.fpath) - #print "hi:",plot_type + print "Plot Type :",plot_type self.fobj.computeAxes() self.chkbox=[] self.a = self.fobj.numVals() @@ -113,7 +114,7 @@ class plotWindow(QtGui.QMainWindow): right_grid.addWidget(self.Note2,4,1) right_vbox.addLayout(right_grid) - + ''' netlist = QtGui.QTextEdit() with open (self.fpath+"/"+self.projName+'.cir.out') as f2: fdata = f2.read() @@ -122,7 +123,7 @@ class plotWindow(QtGui.QMainWindow): left_vbox.addWidget(netlist) - + ''' hbox = QtGui.QHBoxLayout() hbox.addLayout(left_vbox) hbox.addLayout(right_vbox) diff --git a/src/ngspiceSimulation/pythonPlotting.pyc b/src/ngspiceSimulation/pythonPlotting.pyc Binary files differindex bd5a225f..cb7a4f00 100644 --- a/src/ngspiceSimulation/pythonPlotting.pyc +++ b/src/ngspiceSimulation/pythonPlotting.pyc |