diff options
Diffstat (limited to 'src')
52 files changed, 524 insertions, 516 deletions
diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index 10bf5ffd..cb5bdca3 100644 --- a/src/configuration/Appconfig.py +++ b/src/configuration/Appconfig.py @@ -23,7 +23,8 @@ import os class Appconfig(QtGui.QWidget): """ - All configuration goes here + All configuration goes here. + May change in future for code optimization. """ #Home directory home = os.path.join(os.path.expanduser("~"),"eSim-Workspace") diff --git a/src/configuration/Appconfig.pyc b/src/configuration/Appconfig.pyc Binary files differindex 7ba34c34..83b07bae 100644 --- a/src/configuration/Appconfig.pyc +++ b/src/configuration/Appconfig.pyc diff --git a/src/deviceModelLibrary/Diode/1n4007.lib b/src/deviceModelLibrary/Diode/1n4007.lib new file mode 100755 index 00000000..89d421d8 --- /dev/null +++ b/src/deviceModelLibrary/Diode/1n4007.lib @@ -0,0 +1,2 @@ +.model 1n4007 D( IS=7.02767e-09 RS=0.0341512 N=1.80803 EG=1.05743 XTI=5 BV=1000 IBV=5e-08 CJO=1E-11 ++VJ=0.7 M=0.5 FC=0.5 TT=1E-07 KF=0 AF=1 ) diff --git a/src/deviceModelLibrary/Diode/1n4148.lib b/src/deviceModelLibrary/Diode/1n4148.lib new file mode 100755 index 00000000..b32fdf86 --- /dev/null +++ b/src/deviceModelLibrary/Diode/1n4148.lib @@ -0,0 +1,2 @@ +.model 1n4148 D( Is=2.495E-09 Rs=4.755E-01 n=1.679 tt=3.030E-09 Cjo=1.700E-12 M=1.959E-01 ++ Vj=1 Bv=1.000E+02 ibv=1.000E-04 ) diff --git a/src/deviceModelLibrary/Diode/D.lib b/src/deviceModelLibrary/Diode/D.lib new file mode 100755 index 00000000..890c37fe --- /dev/null +++ b/src/deviceModelLibrary/Diode/D.lib @@ -0,0 +1,3 @@ +.model D1N750 D( Is=880.5E-18 Rs=.25 Ikf=0 N=1 Xti=3 Eg=1.11 Cjo=175p M=.5516 ++ Vj=.75 Fc=.5 Isr=1.859n Nr=2 Bv=8.1 Ibv=20.245m Nbv=1.6989 Ibvl=1.9556m ++ Nbvl=14.976 Tbv1=-21.277u) diff --git a/src/deviceModelLibrary/IGBT/NIGBT.lib b/src/deviceModelLibrary/IGBT/NIGBT.lib new file mode 100755 index 00000000..8c09dcbc --- /dev/null +++ b/src/deviceModelLibrary/IGBT/NIGBT.lib @@ -0,0 +1,10 @@ +.MODEL IXGH40N60 NIGBT ( ++ TAU=287.56E-9 ++ KP=50.034 ++ AREA=37.500E-6 ++ AGD=18.750E-6 ++ VT=4.1822 ++ KF=.36047 ++ CGS=31.942E-9 ++ COXD=53.188E-9 ++ VTD=2.6570) diff --git a/src/deviceModelLibrary/IGBT/PIGBT.lib b/src/deviceModelLibrary/IGBT/PIGBT.lib new file mode 100755 index 00000000..d4f9e814 --- /dev/null +++ b/src/deviceModelLibrary/IGBT/PIGBT.lib @@ -0,0 +1,10 @@ +.MODEL IXGH40N60 PIGBT ( ++ TAU=287.56E-9 ++ KP=50.034 ++ AREA=37.500E-6 ++ AGD=18.750E-6 ++ VT=4.1822 ++ KF=.36047 ++ CGS=31.942E-9 ++ COXD=53.188E-9 ++ VTD=2.6570) diff --git a/src/deviceModelLibrary/JFET/NJF.lib b/src/deviceModelLibrary/JFET/NJF.lib new file mode 100755 index 00000000..dbb2cbae --- /dev/null +++ b/src/deviceModelLibrary/JFET/NJF.lib @@ -0,0 +1,4 @@ +.model J2N3819 NJF(Beta=1.304m Betatce=-.5 Rd=1 Rs=1 Lambda=2.25m Vto=-3 ++ Vtotc=-2.5m Is=33.57f Isr=322.4f N=1 Nr=2 Xti=3 Alpha=311.7u ++ Vk=243.6 Cgd=1.6p M=.3622 Pb=1 Fc=.5 Cgs=2.414p Kf=9.882E-18 ++ Af=1) diff --git a/src/deviceModelLibrary/JFET/PJF.lib b/src/deviceModelLibrary/JFET/PJF.lib new file mode 100755 index 00000000..5589571d --- /dev/null +++ b/src/deviceModelLibrary/JFET/PJF.lib @@ -0,0 +1,5 @@ +.model J2N3820 PJF(Beta=1.304m Betatce=-.5 Rd=1 Rs=1 Lambda=2.25m Vto=-3 ++ Vtotc=-2.5m Is=33.57f Isr=322.4f N=1 Nr=2 Xti=3 Alpha=311.7u ++ Vk=243.6 Cgd=1.6p M=.3622 Pb=1 Fc=.5 Cgs=2.414p Kf=9.882E-18 ++ Af=1) + diff --git a/src/deviceModelLibrary/MOS/NMOS-0.5um.lib b/src/deviceModelLibrary/MOS/NMOS-0.5um.lib new file mode 100755 index 00000000..2e6f4635 --- /dev/null +++ b/src/deviceModelLibrary/MOS/NMOS-0.5um.lib @@ -0,0 +1,6 @@ +.model mos_n NMOS( TPG=1 TOX=9.5n CJ=550u ETA=0.02125 VMAX=1.8E05 ++ GAMMA=0.62 CGSO=0.3n LD=50n MJSW=0.35 PB=1.1 ++ CGBO=0.45n XJ=0.2U CGDO=0.3n KAPPA=0.1 LEVEL=3 ++ VTO=0.6 NFS=7.20E11 THETA=0.23 CJSW=0.3n PHI=0.7 ++ RSH=2.0 MJ=0.6 UO=420 KP=156u DELTA=0.88 ++ NSUB=1.40E17 )
\ No newline at end of file diff --git a/src/deviceModelLibrary/MOS/NMOS-180nm.lib b/src/deviceModelLibrary/MOS/NMOS-180nm.lib new file mode 100755 index 00000000..51e9b119 --- /dev/null +++ b/src/deviceModelLibrary/MOS/NMOS-180nm.lib @@ -0,0 +1,13 @@ +.model CMOSN NMOS (LEVEL=8 VERSION=3.2 TNOM=27 TOX=4.1E-9 XJ=1E-7 NCH=2.3549E17 VTH0=0.3823463 K1=0.5810697 ++ K2=4.774618E-3 K3=0.0431669 K3B=1.1498346 W0=1E-7 NLX=1.910552E-7 DVT0W=0 DVT1W=0 DVT2W=0 ++ DVT0=1.2894824 DVT1=0.3622063 DVT2=0.0713729 U0=280.633249 UA=-1.208537E-9 UB=2.158625E-18 ++ UC=5.342807E-11 VSAT=9.366802E4 A0=1.7593146 AGS=0.3939741 B0=-6.413949E-9 B1=-1E-7 KETA=-5.180424E-4 ++ A1=0 A2=1 RDSW=105.5517558 PRWG=0.5 PRWB=-0.1998871 WR=1 WINT=7.904732E-10 LINT=1.571424E-8 XL=0 ++ XW=-1E-8 DWG=1.297221E-9 DWB=1.479041E-9 VOFF=-0.0955434 NFACTOR=2.4358891 CIT=0 CDSC=2.4E-4 CDSCD=0 ++ CDSCB=0 ETA0=3.104851E-3 ETAB=-2.512384E-5 DSUB=0.0167075 PCLM=0.8073191 PDIBLC1=0.1666161 PDIBLC2=3.112892E-3 ++ PDIBLCB=-0.1 DROUT=0.7875618 PSCBE1=8E10 PSCBE2=9.213635E-10 PVAG=3.85243E-3 DELTA=0.01 RSH=6.7 MOBMOD=1 ++ PRT=0 UTE=-1.5 KT1=-0.11 KT1L=0 KT2=0.022 UA1=4.31E-9 UB1=-7.61E-18 UC1=-5.6E-11 AT=3.3E4 WL=0 WLN=1 ++ WW=0 WWN=1 WWL=0 LL=0 LLN=1 LW=0 LWN=1 LWL=0 CAPMOD=2 XPART=0.5 CGDO=7.08E-10 CGSO=7.08E-10 CGBO=1E-12 ++ CJ=9.68858E-4 PB=0.8 MJ=0.3864502 CJSW=2.512138E-10 PBSW=0.809286 MJSW=0.1060414 CJSWG=3.3E-10 PBSWG=0.809286 ++ MJSWG=0.1060414 CF=0 PVTH0=-1.192722E-3 PRDSW=-5 PK2=6.450505E-5 WKETA=-4.27294E-4 LKETA=-0.0104078 ++ PU0=6.3268729 PUA=2.226552E-11 PUB=0 PVSAT=969.1480157 PETA0=1E-4 PKETA=-1.049509E-3) diff --git a/src/deviceModelLibrary/MOS/NMOS-5um.lib b/src/deviceModelLibrary/MOS/NMOS-5um.lib new file mode 100755 index 00000000..a237e1fe --- /dev/null +++ b/src/deviceModelLibrary/MOS/NMOS-5um.lib @@ -0,0 +1,5 @@ +* 5um technology + +.model mos_n NMOS( Cgso=0.4n Tox=85n Vto=1 phi=0.7 ++ Level=1 ++ Mj=.5 UO=750 Cgdo=0.4n Gamma=1.4 LAMBDA=0.01 LD=0.7u JS=1u CJ=0.4m CJSW=0.8n MJSW=0.5 PB=0.7 CGBO=0.2n ) diff --git a/src/deviceModelLibrary/MOS/PMOS-0.5um.lib b/src/deviceModelLibrary/MOS/PMOS-0.5um.lib new file mode 100755 index 00000000..848e8b05 --- /dev/null +++ b/src/deviceModelLibrary/MOS/PMOS-0.5um.lib @@ -0,0 +1,6 @@ +.model mos_p PMOS( TPG=-1 TOX=9.5n CJ=950u ETA=0.025 VMAX=0.3u ++ GAMMA=0.52 CGSO=0.35n LD=70n MJSW=0.25 PB=1 ++ CGBO=0.45n XJ=0.2U CGDO=0.35n KAPPA=8.0 LEVEL=3 ++ VTO=-0.6 NFS=6.50E11 THETA=0.2 CJSW=0.2n PHI=0.7 ++ RSH=2.5 MJ=0.5 UO=130 KP=48u DELTA=0.25 ++ NSUB=1.0E17 )
\ No newline at end of file diff --git a/src/deviceModelLibrary/MOS/PMOS-180nm.lib b/src/deviceModelLibrary/MOS/PMOS-180nm.lib new file mode 100755 index 00000000..032b5b95 --- /dev/null +++ b/src/deviceModelLibrary/MOS/PMOS-180nm.lib @@ -0,0 +1,11 @@ +.model CMOSP PMOS (LEVEL=8 VERSION=3.2 TNOM=27 TOX=4.1E-9 XJ=1E-7 NCH=4.1589E17 VTH0=-0.3938813 K1=0.5479015 ++ K2=0.0360586 K3=0.0993095 K3B=5.7086622 W0=1E-6 NLX=1.313191E-7 DVT0W=0 DVT1W=0 DVT2W=0 DVT0=0.4911363 ++ DVT1=0.2227356 DVT2=0.1 U0=115.6852975 UA=1.505832E-9 UB=1E-21 UC=-1E-10 VSAT=1.329694E5 A0=1.7590478 ++ AGS=0.3641621 B0=3.427126E-7 B1=1.062928E-6 KETA=0.0134667 A1=0.6859506 A2=0.3506788 RDSW=168.5705677 ++ PRWG=0.5 PRWB=-0.4987371 WR=1 WINT=0 LINT=3.028832E-8 XL=0 XW=-1E-8 DWG=-2.349633E-8 DWB=-7.152486E-9 ++ VOFF=-0.0994037 NFACTOR=1.9424315 CIT=0 CDSC=2.4E-4 CDSCD=0 CDSCB=0 ETA0=0.0608072 ETAB=-0.0426148 ++ DSUB=0.7343015 PCLM=3.2579974 PDIBLC1=7.229527E-6 PDIBLC2=0.025389 PDIBLCB=-1E-3 DROUT=0 PSCBE1=1.454878E10 ++ PSCBE2=4.202027E-9 PVAG=15 DELTA=0.01 RSH=7.8 MOBMOD=1 PRT=0 UTE=-1.5 KT1=-0.11 KT1L=0 KT2=0.022 UA1=4.31E-9 ++ UB1=-7.61E-18 UC1=-5.6E-11 AT=3.3E4 WL=0 WLN=1 WW=0 WWN=1 WWL=0 LL=0 LLN=1 LW=0 LWN=1 LWL=0 CAPMOD=2 XPART=0.5 ++ CGDO=6.32E-10 CGSO=6.32E-10 CGBO=1E-12 CJ=1.172138E-3 PB=0.8421173 MJ=0.4109788 CJSW=2.242609E-10 PBSW=0.8 + MJSW=0.3752089 CJSWG=4.22E-10 PBSWG=0.8 MJSWG=0.3752089 CF=0 PVTH0=1.888482E-3 PRDSW=11.5315407 PK2=1.559399E-3 ++ WKETA=0.0319301 LKETA=2.955547E-3 PU0=-1.1105313 PUA=-4.62102E-11 PUB=1E-21 PVSAT=50 PETA0=1E-4 PKETA=-4.346368E-3) diff --git a/src/deviceModelLibrary/MOS/PMOS-5um.lib b/src/deviceModelLibrary/MOS/PMOS-5um.lib new file mode 100755 index 00000000..9c3ed976 --- /dev/null +++ b/src/deviceModelLibrary/MOS/PMOS-5um.lib @@ -0,0 +1,5 @@ +*5um technology + +.model mos_p PMOS( Cgso=0.4n Tox=85n Vto=-1 phi=0.65 ++ Level=1 ++ Mj=.5 UO=250 Cgdo=0.4n Gamma=0.65 LAMBDA=0.03 LD=0.6u JS=1u CJ=0.18m CJSW=0.6n MJSW=0.5 PB=0.7 CGBO=0.2n ) diff --git a/src/deviceModelLibrary/Misc/CORE.lib b/src/deviceModelLibrary/Misc/CORE.lib new file mode 100755 index 00000000..c48c4b51 --- /dev/null +++ b/src/deviceModelLibrary/Misc/CORE.lib @@ -0,0 +1,2 @@ +.model K3019PL_3C8 Core(MS=415.2K A=44.82 C=.4112 K=25.74 ++ Area=1.38 Path=4.52) diff --git a/src/deviceModelLibrary/Transistor/NPN.lib b/src/deviceModelLibrary/Transistor/NPN.lib new file mode 100755 index 00000000..6509fe7a --- /dev/null +++ b/src/deviceModelLibrary/Transistor/NPN.lib @@ -0,0 +1,4 @@ +.model Q2N2222 NPN( Is=14.34f Xti=3 Eg=1.11 Vaf=74.03 Bf=400 Ne=1.307 ++ Ise=14.34f Ikf=.2847 Xtb=1.5 Br=6.092 Nc=2 Isc=0 Ikr=0 Rc=1 Cjc=7.306p ++ Mjc=.3416 Vjc=.75 Fc=.5 Cje=22.01p Mje=.377 Vje=.75 Tr=46.91n Tf=411.1p ++ Itf=.6 Vtf=1.7 Xtf=3 Rb=10) diff --git a/src/deviceModelLibrary/Transistor/PNP.lib b/src/deviceModelLibrary/Transistor/PNP.lib new file mode 100755 index 00000000..7edda0ea --- /dev/null +++ b/src/deviceModelLibrary/Transistor/PNP.lib @@ -0,0 +1,4 @@ +.model Q2N2907A PNP(Is=650.6E-18 Xti=3 Eg=1.11 Vaf=115.7 Bf=231.7 Ne=1.829 ++ Ise=54.81f Ikf=1.079 Xtb=1.5 Br=3.563 Nc=2 Isc=0 Ikr=0 Rc=.715 ++ Cjc=14.76p Mjc=.5383 Vjc=.75 Fc=.5 Cje=19.82p Mje=.3357 Vje=.75 ++ Tr=111.3n Tf=603.7p Itf=.65 Vtf=5 Xtf=1.7 Rb=10) diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index e09e4113..b1c9252b 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -82,25 +82,30 @@ class Application(QtGui.QMainWindow): self.mainToolbar.addAction(self.exitproj) self.mainToolbar.addAction(self.helpfile) - #self.test = self.addToolBar("Temp") - + def initView(self): """ - Create gui from the class Views and initialize it + Create GUI from the class Views and initialize it """ self.view = ViewManagement.ViewManagement() self.setCentralWidget(self.view) def new_project(self): + """ + This function call New Project Info class. + """ print "New Project called" self.project = NewProjectInfo() self.project.body() def open_project(self): + """ + This project call Open Project Info class + """ print "Open Project called" self.project = OpenProjectInfo() self.project.body() @@ -127,7 +132,7 @@ class Application(QtGui.QMainWindow): def testing(self): - print "Sucess hit kicad button" + print "Success hit kicad button" @@ -136,7 +141,7 @@ def main(args): """ It is main function of the module.It starts the application """ - print "Hello Main" + print "Starting eSim......" app = QtGui.QApplication(args) """ @@ -150,7 +155,7 @@ def main(args): progressBar.setValue(i) t = time.time() while time.time() < t + 0.1: - app.processEvents() + app.processEvents() time.sleep(2) diff --git a/src/frontEnd/Application.pyc b/src/frontEnd/Application.pyc Binary files differindex 52649138..eb322c39 100644 --- a/src/frontEnd/Application.pyc +++ b/src/frontEnd/Application.pyc diff --git a/src/frontEnd/ViewManagement.py b/src/frontEnd/ViewManagement.py index bfb294dd..cc95c12c 100755 --- a/src/frontEnd/ViewManagement.py +++ b/src/frontEnd/ViewManagement.py @@ -26,6 +26,9 @@ from kicadtoNgspice.KicadtoNgspice import * class ViewManagement(QtGui.QSplitter): + """ + This class creates View on FrontWindow + """ def __init__(self, *args): # call init method of superclass diff --git a/src/frontEnd/ViewManagement.pyc b/src/frontEnd/ViewManagement.pyc Binary files differindex 53ca0251..075d7aed 100644 --- a/src/frontEnd/ViewManagement.pyc +++ b/src/frontEnd/ViewManagement.pyc diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index 8727e799..d759cff6 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -23,7 +23,7 @@ import os class Workspace(QtGui.QWidget): """ - Start workspace gui + This class creates Workspace GUI. """ def __init__(self): super(Workspace, self).__init__() @@ -35,7 +35,7 @@ class Workspace(QtGui.QWidget): def initWorkspace(self): - print "Calling workspace" + #print "Calling workspace" self.note = QtGui.QTextEdit(self) self.workspace_label = QtGui.QLabel(self) self.worspace_loc = QtGui.QLineEdit(self) @@ -108,7 +108,7 @@ class Workspace(QtGui.QWidget): def browseLocation(self): print "Browse Location called" - self.workspace_directory = QtGui.QFileDialog.getExistingDirectory(self, "open","/home") + self.workspace_directory = QtGui.QFileDialog.getExistingDirectory(self, "Browse Location",os.path.expanduser("~")) print "Path file :", self.workspace_directory self.worspace_loc.setText(self.workspace_directory)
\ No newline at end of file diff --git a/src/frontEnd/Workspace.pyc b/src/frontEnd/Workspace.pyc Binary files differindex 2d2829a6..568412c7 100644 --- a/src/frontEnd/Workspace.pyc +++ b/src/frontEnd/Workspace.pyc diff --git a/src/frontEnd/__init__.pyc b/src/frontEnd/__init__.pyc Binary files differindex bc735777..4fed5140 100644 --- a/src/frontEnd/__init__.pyc +++ b/src/frontEnd/__init__.pyc diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index 2dcb43c3..d2870532 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -4,6 +4,9 @@ from PyQt4.Qt import QRect import TrackWidget class Analysis(QtGui.QWidget): + """ + This class create Analysis Tab in KicadtoNgspice Window. + """ def __init__(self): QtGui.QWidget.__init__(self) self.track_obj= TrackWidget.TrackWidget() @@ -25,27 +28,7 @@ class Analysis(QtGui.QWidget): self.grid.addWidget(self.createDCgroup(),2,0) self.grid.addWidget(self.createTRANgroup(),3,0) - ''' - self.grid.addWidget(self.createTRANgroup(),3,0) - self.grid.addWidget(self.createTRANgroup(),4,0) - self.grid.addWidget(self.createTRANgroup(),5,0) - self.grid.addWidget(self.createTRANgroup(),6,0) - self.grid.addWidget(self.createTRANgroup(),7,0) - self.grid.addWidget(self.createTRANgroup(),8,0) - self.grid.addWidget(self.createTRANgroup(),9,0) - self.grid.addWidget(self.createTRANgroup(),10,0) - self.grid.addWidget(self.createTRANgroup(),11,0) - self.grid.addWidget(self.createTRANgroup(),12,0) - self.grid.addWidget(self.createTRANgroup(),13,0) - self.grid.addWidget(self.createTRANgroup(),14,0) - self.grid.addWidget(self.createTRANgroup(),15,0) - self.grid.addWidget(self.createTRANgroup(),16,0) - self.grid.addWidget(self.createTRANgroup(),17,0) - self.grid.addWidget(self.createTRANgroup(),18,0) - self.grid.addWidget(self.createTRANgroup(),19,0) - self.grid.addWidget(self.createTRANgroup(),20,0) - ''' - + self.setLayout(self.grid) self.show() diff --git a/src/kicadtoNgspice/Analysis.pyc b/src/kicadtoNgspice/Analysis.pyc Binary files differindex b33c052a..89df9218 100644 --- a/src/kicadtoNgspice/Analysis.pyc +++ b/src/kicadtoNgspice/Analysis.pyc diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index c0d98548..20597651 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -1,10 +1,13 @@ import os import sys - +import shutil import TrackWidget class Convert: + """ + This class has all the necessary function required to convert kicad netlist to ngspice netlist. + """ def __init__(self,sourcelisttrack,source_entry_var,schematicInfo): print "Start Conversion" self.sourcelisttrack = sourcelisttrack @@ -14,6 +17,9 @@ class Convert: def addSourceParameter(self): + """ + This function add the source details to schematicInfo + """ print "Adding Source parameter" #print "SourceListTrack : ",self.sourcelisttrack #print "Schematic Info ",self.schematicInfo @@ -112,6 +118,9 @@ class Convert: def analysisInsertor(self,ac_entry_var,dc_entry_var, tran_entry_var,set_checkbox,ac_parameter,dc_parameter,tran_parameter,ac_type): + """ + This function creates an analysis file in current project + """ self.ac_entry_var = ac_entry_var self.dc_entry_var = dc_entry_var self.tran_entry_var = tran_entry_var @@ -145,6 +154,9 @@ class Convert: self.writefile.close() def converttosciform(self, string_obj): + """ + This function is used for scientific conversion. + """ self.string_obj = string_obj if self.string_obj[0] == 'm': return "e-03" @@ -158,6 +170,9 @@ class Convert: return "e-00" def defaultvalue(self, value): + """ + This function select default value as 0 if Analysis widget do not hold any value. + """ self.value= value if self.value == '': return 0 @@ -166,7 +181,9 @@ class Convert: def addModelParameter(self,schematicInfo): - print "Schematic info after adding source detail",schematicInfo + """ + This function add the Ngspice Model details to schematicInfo + """ #Create object of TrackWidget self.obj_track = TrackWidget.TrackWidget() @@ -176,7 +193,7 @@ class Convert: modelParamValue = [] for line in self.obj_track.modelTrack: - print "Model Track :",line + #print "Model Track :",line if line[2] == 'transfo': try: start=line[5] @@ -214,8 +231,8 @@ class Convert: end = line[6] addmodelLine=".model "+ line[3]+" "+line[2]+"(" for key,value in line[9].iteritems(): - print "Tags: ",key - print "Value: ",value + #print "Tags: ",key + #print "Value: ",value #Checking for default value and accordingly assign param and default. if ':' in key: key = key.split(':') @@ -258,6 +275,78 @@ class Convert: return schematicInfo - - -
\ No newline at end of file + + def addDeviceLibrary(self,schematicInfo,kicadFile): + """ + This function add the library details to schematicInfo + """ + print "Adding Device library to Schematic info file" + + (projpath,filename) = os.path.split(kicadFile) + + print "Project Path",projpath + + deviceLibList = self.obj_track.deviceModelTrack + deviceLine = {} #Key:Index, Value:with its updated line in the form of list + includeLine = [] #All .include line list + + if not deviceLibList: + print "No Library Added in the schematic" + pass + else: + for eachline in schematicInfo: + words = eachline.split() + if words[0] in deviceLibList: + print "Found Library line" + index = schematicInfo.index(eachline) + completeLibPath = deviceLibList[words[0]] + (libpath,libname) = os.path.split(completeLibPath) + print "Library Path :",libpath + #Copying library from devicemodelLibrary to Project Path + #Special case for MOSFET + if eachline[0] == 'm': + #For mosfet library name come along with MOSFET dimension information + tempStr = libname.split(':') + libname = tempStr[0] + dimension = tempStr[1] + #Replace last word with library name + words[-1] = libname.split('.')[0] + #Appending Dimension of MOSFET + words.append(dimension) + deviceLine[index] = words + includeLine.append(".include "+libname) + + src = completeLibPath.split(':')[0] + dst = projpath + shutil.copy2(src, dst) + else: + #Replace last word with library name + words[-1] = libname.split('.')[0] + deviceLine[index] = words + includeLine.append(".include "+libname) + + src = completeLibPath + dst = projpath + shutil.copy2(src,dst) + + else: + pass + + + #Adding device line to schematicInfo + for index,value in deviceLine.iteritems(): + #Update the device line + strLine = " ".join(str(item) for item in value) + schematicInfo[index] = strLine + + #This has to be second i.e after deviceLine details + #Adding .include line to Schematic Info at the start of line + for item in list(set(includeLine)): + schematicInfo.insert(0,item) + + + + + + return schematicInfo +
\ No newline at end of file diff --git a/src/kicadtoNgspice/Convert.pyc b/src/kicadtoNgspice/Convert.pyc Binary files differnew file mode 100644 index 00000000..22a8b4a5 --- /dev/null +++ b/src/kicadtoNgspice/Convert.pyc diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py new file mode 100644 index 00000000..6fd2b663 --- /dev/null +++ b/src/kicadtoNgspice/DeviceModel.py @@ -0,0 +1,182 @@ +from PyQt4 import QtGui + +import TrackWidget + + +class DeviceModel(QtGui.QWidget): + """ + This class creates Device Library Tab in KicadtoNgspice Window + It dynamically creates the widget for device like diode,mosfet,transistor and jfet. + """ + + def __init__(self,schematicInfo): + QtGui.QWidget.__init__(self) + #print "Starting Device Modeling" + + #Creating track widget object + self.obj_trac = TrackWidget.TrackWidget() + + #Row and column count + self.row = 0 + self.count = 1 #Entry count + self.entry_var = {} + + #For MOSFET + self.widthLabel = {} + self.lengthLabel = {} + self.multifactorLable = {} + + + #List to hold information about device + self.deviceDetail = {} + + #Set Layout + self.grid = QtGui.QGridLayout() + self.setLayout(self.grid) + + for eachline in schematicInfo: + words = eachline.split() + if eachline[0] == 'q': + print "Words ",words[0] + self.label = QtGui.QLabel("Add library for Transistor "+words[0]+" : "+words[4]) + self.grid.addWidget(self.label,self.row,0) + self.entry_var[self.count] = QtGui.QLineEdit() + self.entry_var[self.count].setText("") + self.grid.addWidget(self.entry_var[self.count],self.row,1) + self.addbtn = QtGui.QPushButton("Add") + self.addbtn.setObjectName("%d" %self.count) + self.addbtn.clicked.connect(self.trackLibrary) + self.grid.addWidget(self.addbtn,self.row,2) + + #Adding Device Details + self.deviceDetail[self.count] = words[0] + + #Increment row and widget count + self.row = self.row+1 + self.count = self.count+1 + + elif eachline[0] == 'd': + print "Words",words[0] + self.label = QtGui.QLabel("Add library for Diode "+words[0]+" : "+words[3]) + self.grid.addWidget(self.label,self.row,0) + self.entry_var[self.count] = QtGui.QLineEdit() + self.entry_var[self.count].setText("") + self.grid.addWidget(self.entry_var[self.count],self.row,1) + self.addbtn = QtGui.QPushButton("Add") + self.addbtn.setObjectName("%d" %self.count) + self.addbtn.clicked.connect(self.trackLibrary) + self.grid.addWidget(self.addbtn,self.row,2) + + #Adding Device Details + self.deviceDetail[self.count] = words[0] + + #Increment row and widget count + self.row = self.row+1 + self.count = self.count+1 + + elif eachline[0] == 'j': + print "Words",words[0] + self.label = QtGui.QLabel("Add library for JFET "+words[0]+" : "+words[4]) + self.grid.addWidget(self.label,self.row,0) + self.entry_var[self.count] = QtGui.QLineEdit() + self.entry_var[self.count].setText("") + self.grid.addWidget(self.entry_var[self.count],self.row,1) + self.addbtn = QtGui.QPushButton("Add") + self.addbtn.setObjectName("%d" %self.count) + self.addbtn.clicked.connect(self.trackLibrary) + self.grid.addWidget(self.addbtn,self.row,2) + + #Adding Device Details + self.deviceDetail[self.count] = words[0] + + #Increment row and widget count + self.row = self.row+1 + self.count = self.count+1 + + + + elif eachline[0] == 'm': + self.label = QtGui.QLabel("Add library for MOSFET "+words[0]+" : "+words[5]) + self.grid.addWidget(self.label,self.row,0) + self.entry_var[self.count] =QtGui.QLineEdit() + self.entry_var[self.count].setText("") + self.grid.addWidget(self.entry_var[self.count],self.row,1) + self.addbtn = QtGui.QPushButton("Add") + self.addbtn.setObjectName("%d" %self.count) + self.addbtn.clicked.connect(self.trackLibrary) + self.grid.addWidget(self.addbtn,self.row,2) + + #Adding Device Details + self.deviceDetail[self.count] = words[0] + + #Increment row and widget count + self.row = self.row+1 + self.count = self.count+1 + + #Adding to get MOSFET dimension + self.widthLabel[self.count] = QtGui.QLabel("Enter width of MOSFET "+words[0]+"(default=100u):") + self.grid.addWidget(self.widthLabel[self.count],self.row,0) + self.entry_var[self.count] = QtGui.QLineEdit() + self.entry_var[self.count].setText("") + self.entry_var[self.count].setMaximumWidth(150) + self.grid.addWidget(self.entry_var[self.count],self.row,1) + self.row = self.row + 1 + self.count = self.count+1 + + self.lengthLabel[self.count] = QtGui.QLabel("Enter length of MOSFET "+words[0]+"(default=100u):") + self.grid.addWidget(self.lengthLabel[self.count],self.row,0) + self.entry_var[self.count] = QtGui.QLineEdit() + self.entry_var[self.count].setText("") + self.entry_var[self.count].setMaximumWidth(150) + self.grid.addWidget(self.entry_var[self.count],self.row,1) + self.row = self.row + 1 + self.count = self.count+1 + + + self.multifactorLable[self.count] = QtGui.QLabel("Enter multiplicative factor of MOSFET "+words[0]+"(default=1):") + self.grid.addWidget(self.multifactorLable[self.count],self.row,0) + self.entry_var[self.count] = QtGui.QLineEdit() + self.entry_var[self.count].setText("") + self.entry_var[self.count].setMaximumWidth(150) + self.grid.addWidget(self.entry_var[self.count],self.row,1) + self.row = self.row + 1 + self.count = self.count+1 + + + self.show() + + + def trackLibrary(self): + """ + This function is use to keep track of all Device Model widget + """ + print "Calling Track Library funtion" + sending_btn = self.sender() + #print "Object Called is ",sending_btn.objectName() + self.widgetObjCount = int(sending_btn.objectName()) + + self.libfile = str(QtGui.QFileDialog.getOpenFileName(self,"Open Library Directory","../deviceModelLibrary")) + #print "Selected Library File :",self.libfile + + #Setting Library to Text Edit Line + self.entry_var[self.widgetObjCount].setText(self.libfile) + self.deviceName = self.deviceDetail[self.widgetObjCount] + + #Storing to track it during conversion + + + if self.deviceName[0] == 'm': + width = str(self.entry_var[self.widgetObjCount+1].text()) + length = str(self.entry_var[self.widgetObjCount+2].text()) + multifactor = str(self.entry_var[self.widgetObjCount+3].text()) + if width == "" : width="100u" + if length == "": length="100u" + if multifactor == "": multifactor="1" + + self.obj_trac.deviceModelTrack[self.deviceName] = self.libfile+":"+"W="+width+" L="+length+" M="+multifactor + + else: + self.obj_trac.deviceModelTrack[self.deviceName] = self.libfile + + +
\ No newline at end of file diff --git a/src/kicadtoNgspice/DeviceModel.pyc b/src/kicadtoNgspice/DeviceModel.pyc Binary files differnew file mode 100644 index 00000000..f747be9c --- /dev/null +++ b/src/kicadtoNgspice/DeviceModel.pyc diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index f05f2ebe..f8faa997 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -22,12 +22,17 @@ from Processing import PrcocessNetlist import Analysis import Source import Model +import DeviceModel import Convert import TrackWidget class MainWindow(QtGui.QWidget): + """ + This class craete KicadtoNgspice window. + And Call Convert function if convert button is pressed. + """ def __init__(self): QtGui.QWidget.__init__(self) #Create object of track widget @@ -69,11 +74,18 @@ class MainWindow(QtGui.QWidget): self.modelTab.setWidget(Model.Model(schematicInfo,modelList)) #self.modelTabLayout = QtGui.QVBoxLayout(self.modelTab.widget()) self.modelTab.setWidgetResizable(True) + + self.deviceModelTab = QtGui.QScrollArea() + self.deviceModelTab.setWidget(DeviceModel.DeviceModel(schematicInfo)) + self.deviceModelTab.setWidgetResizable(True) + + self.tabWidget = QtGui.QTabWidget() - self.tabWidget.addTab(self.analysisTab,"Analysis Tab") - self.tabWidget.addTab(self.sourceTab,"Source Tab") - self.tabWidget.addTab(self.modelTab,"Model Tab") + self.tabWidget.addTab(self.analysisTab,"Analysis") + self.tabWidget.addTab(self.sourceTab,"Source Details") + self.tabWidget.addTab(self.modelTab,"NgSpice Model") + self.tabWidget.addTab(self.deviceModelTab,"Device Modeling") self.mainLayout = QtGui.QVBoxLayout() self.mainLayout.addWidget(self.tabWidget) #self.mainLayout.addStretch(1) @@ -97,9 +109,14 @@ class MainWindow(QtGui.QWidget): #Adding Source Value to Schematic Info schematicInfo = self.obj_convert.addSourceParameter() - #Adding Model Value to schematic Info + #Adding Model Value to schematicInfo schematicInfo = self.obj_convert.addModelParameter(schematicInfo) + #Adding Device Library to SchematicInfo + schematicInfo = self.obj_convert.addDeviceLibrary(schematicInfo,kicadFile) + + + analysisoutput = self.obj_convert.analysisInsertor(self.obj_track.AC_entry_var["ITEMS"], self.obj_track.DC_entry_var["ITEMS"], self.obj_track.TRAN_entry_var["ITEMS"], @@ -108,36 +125,35 @@ class MainWindow(QtGui.QWidget): self.obj_track.DC_Parameter["ITEMS"], self.obj_track.TRAN_Parameter["ITEMS"], self.obj_track.AC_type["ITEMS"]) - print "SchematicInfo after adding Model Details",schematicInfo + #print "SchematicInfo after adding Model Details",schematicInfo + #Calling netlist file generation function - self.createNetlistFile() + self.createNetlistFile(schematicInfo) + self.msg = "The Kicad to Ngspice Conversion completed successfully!!!!!!" QtGui.QMessageBox.information(self, "Information", self.msg, QtGui.QMessageBox.Ok) self.close() except Exception as e: print "Exception Message: ",e - print "SchematicInfo after adding Model Details",schematicInfo print "There was error while converting kicad to ngspice" self.close() - def createNetlistFile(self): + def createNetlistFile(self,schematicInfo): print "Creating Final netlist" - print "INFOLINE",infoline - print "OPTIONINFO",optionInfo - print "Device MODEL LIST ",devicemodelList - print "SUBCKT ",subcktList - print "OUTPUTOPTION",outputOption - print "KicadfIle",kicadFile + #print "INFOLINE",infoline + #print "OPTIONINFO",optionInfo + #print "Device MODEL LIST ",devicemodelList + #print "SUBCKT ",subcktList + #print "OUTPUTOPTION",outputOption + #print "KicadfIle",kicadFile #checking if analysis files is present - (filepath,filename) = os.path.split(kicadFile) - analysisFileLoc = os.path.join(filepath,"analysis") - print "FilePath",filepath - print "FileName",filename - print "Analysis File Location",analysisFileLoc + (projpath,filename) = os.path.split(kicadFile) + analysisFileLoc = os.path.join(projpath,"analysis") + #print "Analysis File Location",analysisFileLoc if os.path.exists(analysisFileLoc): try: f = open(analysisFileLoc) @@ -163,7 +179,7 @@ class MainWindow(QtGui.QWidget): else: pass - print "Option Info",optionInfo + #print "Option Info",optionInfo analysisOption = [] initialCondOption=[] simulatorOption =[] @@ -255,15 +271,7 @@ def main(args): print "OPTIONINFO",optionInfo print "SCHEMATICINFO",schematicInfo - #Getting model and subckt list - global devicemodelList,subcktList - devicemodelList = [] - subcktList = [] - devicemodelList,subcktList = obj_proc.getModelSubcktList(schematicInfo,devicemodelList,subcktList) - - print "Device MODEL LIST ",devicemodelList - print "SUBCKT ",subcktList - + #List for storing source and its value global sourcelist, sourcelisttrack sourcelist=[] diff --git a/src/kicadtoNgspice/KicadtoNgspice.pyc b/src/kicadtoNgspice/KicadtoNgspice.pyc Binary files differindex 29e4d0c6..de20b98b 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.pyc +++ b/src/kicadtoNgspice/KicadtoNgspice.pyc diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py index 79f47ce0..f450cf56 100644 --- a/src/kicadtoNgspice/Model.py +++ b/src/kicadtoNgspice/Model.py @@ -5,12 +5,16 @@ import TrackWidget class Model(QtGui.QWidget): + """ + This class creates Model Tab of KicadtoNgspice window. + The widgets are created dynamically in the Model Tab. + """ def __init__(self,schematicInfo,modelList): QtGui.QWidget.__init__(self) - print "Start Ngspice Modelling" - print "Schematic Info in Model Widget",schematicInfo - print "Model List",modelList + #print "Start Ngspice Modelling" + #print "Schematic Info in Model Widget",schematicInfo + #print "Model List",modelList #Creating track widget object self.obj_trac = TrackWidget.TrackWidget() @@ -28,7 +32,7 @@ class Model(QtGui.QWidget): self.setLayout(self.grid) for line in modelList: - print "ModelList Item:",line + #print "ModelList Item:",line #Adding title label for model #Key: Tag name,Value:Entry widget number tag_dict = {} @@ -38,8 +42,8 @@ class Model(QtGui.QWidget): self.nextrow=self.nextrow+1 #line[7] is parameter dictionary holding parameter tags. for key,value in line[7].iteritems(): - print "Key : ",key - print "Value : ",value + #print "Key : ",key + #print "Value : ",value #Check if value is iterable if hasattr(value, '__iter__'): #For tag having vector value @@ -73,6 +77,8 @@ class Model(QtGui.QWidget): line[6] = type i.e analog or digital Now adding start,end and tag_dict which will be line[7],line[8] and line[9] respectively ''' + + #This keeps the track of Model Tab Widget self.obj_trac.modelTrack.append([line[0],line[1],line[2],line[3],line[4],line[5],line[6],self.start,self.end,tag_dict]) print "The tag dictionary : ",tag_dict diff --git a/src/kicadtoNgspice/Model.pyc b/src/kicadtoNgspice/Model.pyc Binary files differnew file mode 100644 index 00000000..72aaef1b --- /dev/null +++ b/src/kicadtoNgspice/Model.pyc diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py index 63f38bb2..6fb79921 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -5,6 +5,10 @@ from xml.etree import ElementTree as ET class PrcocessNetlist: + """ + This class include all the function required for pre-proccessing of netlist + before converting to Ngspice Netlist. + """ modelxmlDIR = '../modelParamXML' def __init__(self): pass @@ -75,62 +79,7 @@ class PrcocessNetlist: schematicInfo.append(eachline) return optionInfo,schematicInfo - def getModelSubcktList(self,schematicInfo,modelList,subcktList): - #Processing Netlist for modellist and subcktlist details - for eachline in schematicInfo: - words = eachline.split() - if eachline[0]=='d': - modelName=words[3] - if modelName in modelList: - continue - else: - modelList.append(modelName) - elif eachline[0]=='q': - modelName=words[4] - index=schematicInfo.index(eachline) - schematicInfo.remove(eachline) - schematicInfo.insert(index,words[0]+" "+words[3]+" "+words[2]+" "+words[1]+" "+words[4]) - if modelName in modelList: - continue - else: - modelList.append(modelName) - elif eachline[0]=='m': - modelName=words[4] - index=schematicInfo.index(eachline) - schematicInfo.remove(eachline) - ''' - width=raw_input(' Enter width of mosfet '+words[0]+'(default=100u):') - length=raw_input(' Enter length of mosfet '+words[0]+'(default=100u):') - multiplicative_factor=raw_input(' Enter multiplicative factor of mosfet '+words[0]+'(default=1):') - - if width=="": width="100u" - if multiplicative_factor=="": multiplicative_factor="100u" - if length=="": length="100u" - schematicInfo.insert(index,words[0]+" "+words[1]+" "+words[2]+" "+words[3]+" "+words[3]+" "+words[4]+" "+'M='+multiplicative_factor+" "+'L='+length+" "+'W='+width) - ''' - - schematicInfo.insert(index,words[0]+" "+words[1]+" "+words[2]+" "+words[3]+" "+words[3]+" "+words[4]) - if modelName in modelList: - continue - modelList.append(modelName) - elif eachline[0]=='j': - modelName=words[4] - index=schematicInfo.index(eachline) - schematicInfo.remove(eachline) - schematicInfo.insert(index,words[0]+" "+words[1]+" "+words[2]+" "+words[3]+" "+words[4]) - if modelName in modelList: - continue - else: - modelList.append(modelName) - elif eachline[0]=='x': - subcktName=words[len(words)-1] - if subcktName in subcktList: - continue - else: - subcktList.append(subcktName) - return modelList,subcktList - def insertSpecialSourceParam(self,schematicInfo,sourcelist): #Inser Special source parameter schematicInfo1=[] @@ -337,39 +286,7 @@ class PrcocessNetlist: #print "Count",count #print "UnknownModelList",unknownModelList #print "MultipleModelList",multipleModelList - ''' - if compType=="gain": - schematicInfo.append("a"+str(k)+" "+words[1]+" "+words[2]+" "+compName) - k=k+1 - #Insert comment at remove line - schematicInfo.insert(index,"* "+compline) - print "-----------------------------------------------------------\n" - print "Adding Gain" - Comment='* Gain '+compType - Title='Add parameters for Gain '+compName - in_offset=' Enter offset for input (default=0.0): ' - gain=' Enter gain (default=1.0): ' - out_offset=' Enter offset for output (default=0.0): ' - print "-----------------------------------------------------------" - modelList.append([index,compline,compType,compName,Comment,Title,in_offset,gain,out_offset]) - elif compType=="summer": - schematicInfo.append("a"+str(k)+" ["+words[1]+" "+words[2]+"] "+words[3]+" "+compName) - k=k+1 - #Insert comment at remove line - schematicInfo.insert(index,"* "+compline) - print "-----------------------------------------------------------\n" - print "Adding summer" - Comment='* Summer '+compType - Title='Add parameters for Summer '+compName - in1_offset=' Enter offset for input 1 (default=0.0): ' - in2_offset=' Enter offset for input 2 (default=0.0): ' - in1_gain=' Enter gain for input 1 (default=1.0): ' - in2_gain=' Enter gain for input 2 (default=1.0): ' - out_gain=' Enter gain for output (default=1.0): ' - out_offset=' Enter offset for output (default=0.0): ' - print "-----------------------------------------------------------" - modelList.append([index,compline,compType,compName,Comment,Title,in1_offset,in2_offset,in1_gain,in2_gain,out_gain,out_offset]) - ''' + return schematicInfo,outputOption,modelList,unknownModelList,multipleModelList diff --git a/src/kicadtoNgspice/Processing.pyc b/src/kicadtoNgspice/Processing.pyc Binary files differnew file mode 100644 index 00000000..efd69b68 --- /dev/null +++ b/src/kicadtoNgspice/Processing.pyc diff --git a/src/kicadtoNgspice/Sample.py b/src/kicadtoNgspice/Sample.py deleted file mode 100644 index 5f562724..00000000 --- a/src/kicadtoNgspice/Sample.py +++ /dev/null @@ -1,320 +0,0 @@ -from PyQt4 import QtGui,QtCore - -import sys -import re -import datetime -################################################################ -def main(): - app = QtGui.QApplication(sys.argv) - mw = MainWindow() - sys.exit(app.exec_()) - -################################################################ -class MainWindow(QtGui.QMainWindow): - def __init__(self): - QtGui.QMainWindow.__init__(self) - - # create stuff - self.rw = ReportWidget() - self.setCentralWidget(self.rw) - self.sw = StartWindow() - self.createActions() - self.createMenus() - self.createStatusBar() - - # create progress bar - self.pb = QtGui.QProgressBar(self.statusBar()) - self.statusBar().addPermanentWidget(self.pb) - - # connections - self.connect(self.sw, QtCore.Qt.SIGNAL("okClicked"), - self.rw.create) - self.connect(self.rw.table, QtCore.Qt.SIGNAL("progressChanged"), - self.update_progress) - self.connect(self.rw.table, QtCore.Qt.SIGNAL("displayFinished"), - self.hide_progress_bar) - - # format the main window - self.setGeometry(100,100,750,550) - - # show windows - self.show() - self.sw.show() - - def update_progress(self, n, nrows): - self.pb.show() - self.pb.setRange(0, nrows) - self.pb.setValue(n) - self.statusBar().showMessage(self.tr("Parsing eventlog data...")) - - def hide_progress_bar(self): - self.pb.hide() - self.statusBar().showMessage(self.tr("Finished")) - - def about(self): - QtGui.QMessageBox.about(self, self.tr("About AIS Audit Tool"), - self.tr("AIS Audit Tool\n\n" - "%s\n" - "%s\n" - "%s" % (__author__, __version__, __date__))) - - def createActions(self): - self.exitAct = QtGui.QAction(self.tr("E&xit;"), self) - self.exitAct.setShortcut(self.tr("Ctrl+Q")) - self.exitAct.setStatusTip(self.tr("Exit the application")) - self.connect(self.exitAct, QtCore.Qt.SIGNAL("triggered()"), self, QtCore.Qt.SLOT("close()")) - - self.aboutAct = QtGui.QAction(self.tr("&About;"), self) - self.aboutAct.setStatusTip(self.tr("Show the application's About box")) - self.connect(self.aboutAct, QtCore.Qt.SIGNAL("triggered()"), self.about) - - self.aboutQtAct = QtGui.QAction(self.tr("About &Qt;"), self) - self.aboutQtAct.setStatusTip(self.tr("Show the Qt library's About box")) - self.connect(self.aboutQtAct, QtCore.Qt.SIGNAL("triggered()"), qApp, QtCore.Qt.SLOT("aboutQt()")) - - def createMenus(self): - self.fileMenu = self.menuBar().addMenu(self.tr("&File;")) - self.fileMenu.addAction(self.exitAct) - - self.helpMenu = self.menuBar().addMenu(self.tr("&Help;")) - self.helpMenu.addAction(self.aboutAct) - self.helpMenu.addAction(self.aboutQtAct) - - def createStatusBar(self): - sb = QtGui.QStatusBar() - sb.setFixedHeight(18) - self.setStatusBar(sb) - self.statusBar().showMessage(self.tr("Ready")) - -################################################################ -class StartWindow(QtGui.QWidget): - def __init__(self, *args): - QtGui.QWidget.__init__(self, *args) - - # date box - self.label_date = QtGui.QLabel() - self.label_date.setText("Set date of last audit:") - default = datetime.date.today() - datetime.timedelta(DEFAULT_DAYS_FROM_LAST_AUDIT) - self.datebox = QtGui.QDateEdit(QtCore.Qt.QDate(default.year, default.month, default.day)) - - # buttons - spacer = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) - self.button_ok = QtGui.QPushButton() - self.button_ok.setText("OK") - self.button_ok.setDefault(True) - button_cancel = QtGui.QPushButton() - button_cancel.setText("Cancel") - - # layout - layout_right = QtGui.QVBoxLayout(self) - layout_right.addWidget(self.label_date) - layout_right.addWidget(self.datebox) - layout_right.addItem(spacer) - layout_right.addWidget(self.button_ok) - layout_right.addWidget(button_cancel) - - # connections - self.connect(button_cancel, QtCore.Qt.SIGNAL("clicked(bool)"), - self.close) - self.connect(self.button_ok, QtCore.Qt.SIGNAL("clicked(bool)"), - self.ok_clicked) - - def ok_clicked(self): - self.close() - year = self.datebox.date().year() - month = self.datebox.date().month() - day = self.datebox.date().day() - dateobj = datetime.date(int(year),int(month),int(day)) - self.emit(QtCore.Qt.SIGNAL("okClicked"), dateobj) - -################################################################ -class ReportWidget(QtGui.QWidget): - def __init__(self, *args): - QtGui.QWidget.__init__(self, *args) - self.cbUsers = QtGui.QCheckBox("Hide SYSTEM users") - self.cbSorting = QtGui.QCheckBox("Sorting enabled") - self.table = MyTable() - self.textbrowser = QtGui.QTextBrowser() - self.textbrowser.setFontFamily("Courier") - self.textbrowser.setFontPointSize(10) - hlayout = QtGui.QHBoxLayout() - hlayout.addWidget(self.cbUsers) - hlayout.addWidget(self.cbSorting) - vlayout = QtGui.QVBoxLayout() - vlayout.setMargin(2) - vlayout.addLayout(hlayout) - vlayout.addWidget(self.table) - self.setLayout(vlayout) - self.setGeometry(100,100,750,550) - - # connections - self.connect(self.cbUsers, QtCore.Qt.SIGNAL("stateChanged(int)"), - self.cbUsersChanged) - self.connect(self.cbSorting, QtCore.Qt.SIGNAL("stateChanged(int)"), - self.cbSortingChanged) - - def create(self, dateobj): - """ Parses the eventlog data, displays it in a table, and - displays the user login/logout also """ - self.table.display_data(dateobj) - - def cbUsersChanged(self): - state = self.cbUsers.checkState() - if state == 0: - self.table.show_system_users() - elif state == 2: - self.table.hide_system_users() - - def cbSortingChanged(self): - state = self.cbSorting.checkState() - if state == 0: - self.table.setSortingEnabled(False) - elif state == 2: - self.table.setSortingEnabled(True) - -################################################################ -class MyTable(QtGui.QTableWidget): - """ Creates a custom table widget """ - def __init__(self, *args): - QtGui.QTableWidget.__init__(self, *args) - self.setSelectionMode(self.ContiguousSelection) - self.setGeometry(0,0,700,400) - self.setShowGrid(False) - self.other_users_list = [] - - def hide_system_users(self): - for n in self.other_users_list: - self.setRowHidden(n, True) - - def show_system_users(self): - for n in self.other_users_list: - self.setRowHidden(n, False) - - def display_data(self, dateobj): - """ Reads in data as a 2D list and formats and displays it in - the table """ - - print "Fetching data..." - ep = EventlogParser() - data = ep.parse_log(dateobj) - print "Done." - - if len(data)==0: - data = ["No data for this date range."] - - nrows = len(data) - ncols = len(data[0]) - self.setRowCount(nrows) - self.setColumnCount(ncols) - self.setHorizontalHeaderLabels(['No.', 'Date','Time','Type','Event','User','Computer']) - - for i in xrange(len(data)): - # update progress dialog - if (i%20) == 0: - self.emit(QtCore.Qt.SIGNAL("progressChanged"), i, nrows) - qApp.processEvents() - - # set each cell to be a QTableWidgetItem from the _process_row method - items = self._process_row(data[i]) - for j in range(len(items)): - self.setItem(i, j, items[j]) - self.setRowHeight(i, 16) - - # set column width first time through - if i == 0: - self.resizeColumnsToContents() - self.setColumnWidth(4, 250) - - # format column width - self.resizeColumnsToContents() - self.setColumnWidth(4, 250) - - # emit signal for finished processing - self.emit(QtCore.Qt.SIGNAL("displayFinished")) - - def _process_row(self, row): - """ Formats items in the row of the 2-D list data - Input: the row of data from the EventlogParser in a list - Returns a list of QTableWidgetItems to be one row in the table - """ - - icon = [] - for i in xrange(len(row)): - # general formatting for all cells (may be overwritten) - icon.append(QtGui.QIcon()) - computer = row[6] - - # time processing - if i == 2: - try: - hour = int(re.split(r":", row[i])[0]) - except: - raise - if hour <= EARLY_HOUR or hour >= LATE_HOUR: - backcolor_time = QtGui.QColor(0,0,102) - else: - backcolor_time = QtGui.QColor("white") - - # success or failure processing - elif i == 3: - if row[i] == "8": - row[i] = "Success" - icon[i] = QtGui.QIcon("success.png") - elif row[i] == "16": - row[i] = "Failure" - icon[i] = QtGui.QIcon("failure.png") - else: - row[i] = "Unknown" - icon[i] = QtGui.QIcon("unknown.png") - - # event processing - elif i == 4: - backcolor = QtGui.QColor("white") - if row[i] in RED_EVENTIDS: - backcolor = QtGui.QColor("red") - elif row[i] in ORANGE_EVENTIDS: - backcolor = QtGui.QColor("orange") - elif row[i] in YELLOW_EVENTIDS: - backcolor = QtGui.QColor("yellow") - elif row[i] in GREEN_EVENTIDS: - pass - elif row[i] in OTHER_EVENTIDS: - backcolor = QtGui.QColor("blue") - try: - row[i] = row[i] + ": " + EVENT_DESC[row[i]] - except: - pass - - # user processing - elif i == 5: - if row[i] in (computer, "", "SYSTEM", "NETWORK SERVICE", "LOCAL SERVICE", "ANONYMOUS LOGON"): - font = QtGui.QFont("Arial", 8) - font.setBold(False) - textcolor = QtGui.QColor("gray") - user = 'other' - else: - font = QtGui. QFont("Arial", 8) - font.setBold(True) - textcolor = QtGui.QColor("black") - user = 'user' - - # create table widget item - tableitem_list = [] - for i in xrange(len(row)): - tableitem = QtGui.QTableWidgetItem(row[i]) - if i == 2: - tableitem.setBackgroundColor(backcolor_time) - else: - tableitem.setBackgroundColor(backcolor) - tableitem.setTextColor(textcolor) - tableitem.setFont(font) - tableitem.setTextAlignment(QtCore.Qt.AlignTop) - tableitem.setToolTip(row[i]) - tableitem.setIcon(icon[i]) - tableitem_list.append(tableitem) - - return tableitem_list - -################################################################ -if __name__ == "__main__": - main() diff --git a/src/kicadtoNgspice/Source.py b/src/kicadtoNgspice/Source.py index ee460cb0..6b9a2aa4 100644 --- a/src/kicadtoNgspice/Source.py +++ b/src/kicadtoNgspice/Source.py @@ -5,6 +5,9 @@ import TrackWidget class Source(QtGui.QWidget): + """ + This class create Source Tab of KicadtoNgSpice Window. + """ def __init__(self,sourcelist,sourcelisttrack): QtGui.QWidget.__init__(self) @@ -24,6 +27,9 @@ class Source(QtGui.QWidget): def createSourceWidget(self,sourcelist,sourcelisttrack): + """ + This function dynamically create source widget in the Source tab of KicadtoNgSpice window + """ self.grid = QtGui.QGridLayout() self.setLayout(self.grid) @@ -33,7 +39,7 @@ class Source(QtGui.QWidget): #print "Voltage source line index: ",line[0] #print "SourceList line Test: ",line track_id=line[0] - print "track_id is ",track_id + #print "track_id is ",track_id if line[2]=='ac': label=QtGui.QLabel(line[3]) self.grid.addWidget(label,self.row,1) @@ -143,7 +149,7 @@ class Source(QtGui.QWidget): print "No source is present in your circuit" - + #This is used to keep the track of dynamically created widget self.obj_track.sourcelisttrack["ITEMS"] = sourcelisttrack self.obj_track.source_entry_var["ITEMS"] = self.entry_var self.show() diff --git a/src/kicadtoNgspice/Source.pyc b/src/kicadtoNgspice/Source.pyc Binary files differnew file mode 100644 index 00000000..e023e82e --- /dev/null +++ b/src/kicadtoNgspice/Source.pyc diff --git a/src/kicadtoNgspice/TrackWidget.py b/src/kicadtoNgspice/TrackWidget.py index 3ecbd883..f6c4969d 100644 --- a/src/kicadtoNgspice/TrackWidget.py +++ b/src/kicadtoNgspice/TrackWidget.py @@ -1,7 +1,6 @@ class TrackWidget: """ - This Class track the widget of Kicad to NgSpice converter - module. + This Class track the dynamically created widget of KicadtoNgSpice Window. """ #Track widget list for Source details sourcelisttrack = {"ITEMS":"None"} @@ -17,6 +16,9 @@ class TrackWidget: set_CheckBox = {"ITEMS":"None"} AC_type = {"ITEMS":"None"} - #Track widget for Model details + #Track widget for Model detail modelTrack = [] - model_entry_var = {}
\ No newline at end of file + model_entry_var = {} + + #Track Widget for Device Model detail + deviceModelTrack = {}
\ No newline at end of file diff --git a/src/kicadtoNgspice/TrackWidget.pyc b/src/kicadtoNgspice/TrackWidget.pyc Binary files differnew file mode 100644 index 00000000..388068f9 --- /dev/null +++ b/src/kicadtoNgspice/TrackWidget.pyc diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py index a575af21..65f71266 100644 --- a/src/projManagement/Kicad.py +++ b/src/projManagement/Kicad.py @@ -21,10 +21,10 @@ import Validation from configuration.Appconfig import Appconfig import Worker from PyQt4 import QtGui -import time + class Kicad: """ - Class Kicad open Schematic,PCB and Layout + This class called the Kicad Schematic,KicadtoNgspice Converter,Layout editor and Footprint Editor """ def __init__(self): self.obj_validation = Validation.Validation() @@ -32,12 +32,15 @@ class Kicad: def openSchematic(self): + """ + This function create command to open Kicad schematic + """ print "Kicad Schematic is called" self.projDir = self.obj_appconfig.current_project["ProjectName"] #Validating if current project is available or not if self.obj_validation.validateKicad(self.projDir): - print "calling Kicad schematic ",self.projDir + #print "calling Kicad schematic ",self.projDir self.projName = os.path.basename(self.projDir) self.project = os.path.join(self.projDir,self.projName) @@ -54,12 +57,15 @@ class Kicad: def openFootprint(self): + """ + This function create command to open Footprint editor + """ print "Kicad Foot print Editor called" self.projDir = self.obj_appconfig.current_project["ProjectName"] #Validating if current project is available or not if self.obj_validation.validateKicad(self.projDir): - print "calling Kicad FootPrint Editor ",self.projDir + #print "calling Kicad FootPrint Editor ",self.projDir self.projName = os.path.basename(self.projDir) self.project = os.path.join(self.projDir,self.projName) @@ -74,6 +80,9 @@ class Kicad: self.msg.setWindowTitle("Error Message") def openLayout(self): + """ + This function create command to open Layout editor + """ print "Kicad Layout is called" self.projDir = self.obj_appconfig.current_project["ProjectName"] #Validating if current project is available or not @@ -88,24 +97,26 @@ class Kicad: self.obj_workThread.start() else: - self.msg = QtGui.QErrorMessage(None) + 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 openKicadToNgspice(self): + """ + This function create command to call kicad to Ngspice converter. + """ print "Open Kicad to Ngspice Conversion" self.projDir = self.obj_appconfig.current_project["ProjectName"] #Validating if current project is available or not if self.obj_validation.validateKicad(self.projDir): - print "Project is present" + #print "Project is present" #Cheking if project has .cir file or not if self.obj_validation.validateCir(self.projDir): - print "CIR file present" + #print "CIR file present" self.projName = os.path.basename(self.projDir) self.project = os.path.join(self.projDir,self.projName) #Creating a command to run - #self.cmd = "python /home/fahim/Workspace/eSim/src/kicadtoNgspice/KicadtoNgspice.py "+self.project+".cir " self.cmd = "python ../kicadtoNgspice/KicadtoNgspice.py "+self.project+".cir " self.obj_workThread = Worker.WorkerThread(self.cmd) self.obj_workThread.start() @@ -120,4 +131,4 @@ 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") -
\ No newline at end of file +
\ No newline at end of file diff --git a/src/projManagement/Kicad.pyc b/src/projManagement/Kicad.pyc Binary files differindex 4011f875..2c78004a 100644 --- a/src/projManagement/Kicad.pyc +++ b/src/projManagement/Kicad.pyc diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py index 33f0894f..a3d84979 100644 --- a/src/projManagement/Validation.py +++ b/src/projManagement/Validation.py @@ -21,11 +21,19 @@ import re class Validation: + """ + This is Validation class use for validating Project. + e.g if .proj is present in project directory + or if new project name is already exist in workspace etc + """ def __init__(self): pass def validateOpenproj(self,projDir): - print "Validate openProj called" + """ + This function validate Open Project Information. + """ + print "Validating Open Project Information" projName = os.path.basename(str(projDir)) lookProj = os.path.join(str(projDir),projName+".proj") #Check existence of project @@ -33,13 +41,14 @@ class Validation: return True else: return False - def validateNewproj(self,projDir): - print "Validate newProj called" - print "Project Directory : ",projDir + """This Project Validate New Project Information + """ + print "Validating New Project Information" + #print "Project Directory : ",projDir #Checking existence of project with same name if os.path.exists(projDir): @@ -52,6 +61,9 @@ class Validation: return "VALID" def validateKicad(self,projDir): + """ + This function validate if Kicad components are present + """ print "Validation for Kicad components" if projDir == None: return False @@ -59,7 +71,10 @@ class Validation: return True def validateCir(self,projDir): - print "Checking if .cir file is present or not" + """ + This function checks if ".cir" file is present. + """ + #print "Checking if .cir file is present or not" projName = os.path.basename(str(projDir)) lookCir = os.path.join(str(projDir),projName+".cir") #Check existence of project diff --git a/src/projManagement/Validation.pyc b/src/projManagement/Validation.pyc Binary files differindex 34e4aca0..145c59e4 100644 --- a/src/projManagement/Validation.pyc +++ b/src/projManagement/Validation.pyc diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py index 641d6ee8..084b8048 100644 --- a/src/projManagement/Worker.py +++ b/src/projManagement/Worker.py @@ -21,6 +21,9 @@ from configuration.Appconfig import Appconfig class WorkerThread(QtCore.QThread): + """ + This is Thread class use to run the command + """ def __init__(self,args): QtCore.QThread.__init__(self) self.args = args @@ -30,13 +33,13 @@ class WorkerThread(QtCore.QThread): def run(self): - print "Calling :",self.args + print "Calling Command:",self.args self.call_system(self.args) def call_system(self,command): - print "System called" procThread = Appconfig() 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 Binary files differindex 1144e9ed..dd276d50 100644 --- a/src/projManagement/Worker.pyc +++ b/src/projManagement/Worker.pyc diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py index 10251d1b..d6045fd3 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -23,7 +23,7 @@ import os class NewProjectInfo(QtGui.QWidget): """ - Class ProjectInfo accept model information from user + This class is called when User create new Project. """ def __init__(self): @@ -33,7 +33,10 @@ class NewProjectInfo(QtGui.QWidget): def body(self): - print "Calling NewProjectInfo" + """ + This function create gui for New Project Info + """ + #print "Calling NewProjectInfo" self.projLabel = QtGui.QLabel("Enter Project Name :") self.projEdit = QtGui.QLineEdit() @@ -59,14 +62,17 @@ class NewProjectInfo(QtGui.QWidget): def createProject(self): - print "Create Project Called" + """ + This function create Project related directories and files + """ + #print "Create Project Called" self.workspace = self.obj_appconfig.default_workspace['workspace'] self.projName = self.projEdit.text() self.projName = str(self.projName).rstrip().lstrip() #Remove leading and trailing space self.projDir = os.path.join(self.workspace,str(self.projName)) - print "Project Name:",self.projName + #Validation for newProject if self.projName == "": self.reply = "NONE" @@ -83,7 +89,7 @@ class NewProjectInfo(QtGui.QWidget): self.projFile = os.path.join(self.projDir,self.projName+".proj") f = open(self.projFile,"w") except: - print "Some Thing Wrong" + #print "Some Thing Went Wrong" self.msg = QtGui.QErrorMessage(self) self.msg.showMessage('Unable to create project. Please make sure you have write permission on '+self.workspace) self.msg.setWindowTitle("Error Message") @@ -94,20 +100,20 @@ class NewProjectInfo(QtGui.QWidget): self.obj_appconfig.current_project['ProjectName'] = self.projDir elif self.reply == "CHECKEXIST": - print "Project already exist" + #print "Project already exist" self.msg = QtGui.QErrorMessage(self) self.msg.showMessage('The project "'+self.projName+'" already exist.Please select the different name or delete existing project') self.msg.setWindowTitle("Error Message") elif self.reply == "CHECKNAME": - print "Name is not proper" + #print "Name is not proper" self.msg = QtGui.QErrorMessage(self) self.msg.showMessage('The project name should not contain space between them') self.msg.setWindowTitle("Error Message") elif self.reply == "NONE": - print "Empyt Project Name" + #print "Empty Project Name" self.msg = QtGui.QErrorMessage(self) self.msg.showMessage('The project name cannot be empty') self.msg.setWindowTitle("Error Message") diff --git a/src/projManagement/newProject.pyc b/src/projManagement/newProject.pyc Binary files differindex 2754be24..383d796c 100644 --- a/src/projManagement/newProject.pyc +++ b/src/projManagement/newProject.pyc diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py index 97e851e8..4112810c 100644 --- a/src/projManagement/openProject.py +++ b/src/projManagement/openProject.py @@ -25,8 +25,7 @@ from configuration.Appconfig import Appconfig class OpenProjectInfo(QtGui.QWidget): """ - Class ProjectInfo accept model information from user - + This class is called when User click on Open Project Button """ def __init__(self): super(OpenProjectInfo, self).__init__() @@ -38,13 +37,13 @@ class OpenProjectInfo(QtGui.QWidget): #print "default workspace is now 1", self.openDir self.projDir=QtGui.QFileDialog.getExistingDirectory(self,"open",self.openDir) if self.obj_validation.validateOpenproj(self.projDir) == True: - print "Pass open project test" + #print "Pass open project test" self.obj_Appconfig = Appconfig() self.obj_Appconfig.current_project['ProjectName'] = str(self.projDir) else: - print "Failed open project test" + #print "Failed open project test" reply = QtGui.QMessageBox.critical(None, "Error Message",'''<b> Error: The project doesn't contain .proj file.</b><br/> <b>Please select the proper project directory else you won't be able to perform any operation</b>''',QtGui.QMessageBox.Ok|QtGui.QMessageBox.Cancel) if reply == QtGui.QMessageBox.Ok: diff --git a/src/projManagement/openProject.pyc b/src/projManagement/openProject.pyc Binary files differindex 441e488f..9c53d6f2 100644 --- a/src/projManagement/openProject.pyc +++ b/src/projManagement/openProject.pyc |