summaryrefslogtreecommitdiff
path: root/src/kicadtoNgspice
diff options
context:
space:
mode:
Diffstat (limited to 'src/kicadtoNgspice')
-rw-r--r--src/kicadtoNgspice/Analysis.py18
-rw-r--r--src/kicadtoNgspice/Convert.py48
-rw-r--r--src/kicadtoNgspice/DeviceModel.py24
-rw-r--r--src/kicadtoNgspice/KicadtoNgspice.py60
-rw-r--r--src/kicadtoNgspice/Model.py10
-rw-r--r--src/kicadtoNgspice/Processing.py32
-rw-r--r--src/kicadtoNgspice/Source.py14
-rw-r--r--src/kicadtoNgspice/SubcircuitTab.py12
8 files changed, 109 insertions, 109 deletions
diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py
index 43fcca0d..6aa167d6 100644
--- a/src/kicadtoNgspice/Analysis.py
+++ b/src/kicadtoNgspice/Analysis.py
@@ -1,6 +1,6 @@
from PyQt4 import QtGui
-import TrackWidget
+from . import TrackWidget
import os
#from xml.etree import ElementTree as ET
import json
@@ -34,11 +34,11 @@ class Analysis(QtGui.QWidget):
kicadFile = self.clarg1
(projpath,filename) = os.path.split(kicadFile)
if os.path.isfile(os.path.join(projpath, 'analysis')):
- print "Analysis file is present"
+ print("Analysis file is present")
analysisfile = open(os.path.join(projpath,'analysis'))
content = analysisfile.readline()
- print "Content of Analysis file :", content
+ print("Content of Analysis file :", content)
contentlist= content.split()
if contentlist[0] == '.ac':
@@ -140,7 +140,7 @@ class Analysis(QtGui.QWidget):
json_data = json.loads(data)
except:
check = 0
- print "AC Previous Values JSON is Empty"
+ print("AC Previous Values JSON is Empty")
self.acbox = QtGui.QGroupBox()
self.acbox.setTitle("AC Analysis")
@@ -254,7 +254,7 @@ class Analysis(QtGui.QWidget):
self.stop_fre_combo.setCurrentIndex(index)
except:
- print "AC Analysis JSON Parse Error"
+ print("AC Analysis JSON Parse Error")
return self.acbox
@@ -288,7 +288,7 @@ class Analysis(QtGui.QWidget):
json_data = json.loads(data)
except:
check = 0
- print "DC Previous Values JSON is empty"
+ print("DC Previous Values JSON is empty")
self.dcbox = QtGui.QGroupBox()
self.dcbox.setTitle("DC Analysis")
@@ -515,7 +515,7 @@ class Analysis(QtGui.QWidget):
else:
self.check.setChecked(False)
except:
- print "DC Analysis JSON Parse Error"
+ print("DC Analysis JSON Parse Error")
return self.dcbox
@@ -555,7 +555,7 @@ class Analysis(QtGui.QWidget):
json_data = json.loads(data)
except:
check = 0
- print "Transient Previous Values JSON is Empty"
+ print("Transient Previous Values JSON is Empty")
self.trbox = QtGui.QGroupBox()
self.trbox.setTitle("Transient Analysis")
@@ -653,7 +653,7 @@ class Analysis(QtGui.QWidget):
index = self.stop_combobox.findText(json_data["analysis"]["tran"]["Stop Combo"])
self.stop_combobox.setCurrentIndex(index)
except:
- print "Transient Analysis JSON Parse Error"
+ print("Transient Analysis JSON Parse Error")
return self.trbox
diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py
index 4405eff7..baf479f7 100644
--- a/src/kicadtoNgspice/Convert.py
+++ b/src/kicadtoNgspice/Convert.py
@@ -2,7 +2,7 @@ from PyQt4 import QtGui
import os
import shutil
-import TrackWidget
+from . import TrackWidget
from xml.etree import ElementTree as ET
class Convert:
@@ -40,7 +40,7 @@ class Convert:
self.addline = self.addline.partition('(')[0] + "("+vo_val+" "+va_val+" "+freq_val+" "+td_val+" "+theta_val+")"
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in sine voltage source ",self.addline
+ print("Caught an exception in sine voltage source ",self.addline)
elif compline[1] == 'pulse':
try:
@@ -57,7 +57,7 @@ class Convert:
self.addline = self.addline.partition('(')[0] + "("+v1_val+" "+v2_val+" "+td_val+" "+tr_val+" "+tf_val+" "+pw_val+" "+tp_val+")"
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in pulse voltage source ",self.addline
+ print("Caught an exception in pulse voltage source ",self.addline)
elif compline[1] == 'pwl':
try:
@@ -67,7 +67,7 @@ class Convert:
self.addline = self.addline.partition('(')[0] + "("+t_v_val+")"
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in pwl voltage source ",self.addline
+ print("Caught an exception in pwl voltage source ",self.addline)
elif compline[1] == 'ac':
try:
@@ -79,7 +79,7 @@ class Convert:
self.addline = self.addline.partition('ac')[0] +" "+'ac'+" "+ va_val+" "+ph_val
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in ac voltage source ",self.addline
+ print("Caught an exception in ac voltage source ",self.addline)
elif compline[1] == 'dc':
try:
@@ -90,7 +90,7 @@ class Convert:
self.addline = self.addline.partition('dc')[0] + " " +'dc'+ " "+v1_val
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in dc voltage source",self.addline
+ print("Caught an exception in dc voltage source",self.addline)
elif compline[1] == 'exp':
try:
@@ -106,7 +106,7 @@ class Convert:
self.addline = self.addline.partition('(')[0] + "("+v1_val+" "+v2_val+" "+td1_val+" "+tau1_val+" "+td2_val+" "+tau2_val+")"
self.sourcelistvalue.append([self.index,self.addline])
except:
- print "Caught an exception in exp voltage source ",self.addline
+ print("Caught an exception in exp voltage source ",self.addline)
#Updating Schematic with source value
for item in self.sourcelistvalue:
@@ -231,22 +231,22 @@ class Convert:
addmodelLine=".model "+line[3]+"_secondary lcouple (num_turns ="+num_turns2+ ")"
modelParamValue.append([line[0],addmodelLine,"*secondary lcouple"])
except Exception as e:
- print "Caught an exception in transfo model ",line[1]
- print "Exception Message : ",str(e)
+ print("Caught an exception in transfo model ",line[1])
+ print("Exception Message : ",str(e))
elif line[2] == 'ic':
try:
start=line[7]
end=line[8]
- for key,value in line[9].iteritems():
+ for key,value in line[9].items():
initVal = str(self.obj_track.model_entry_var[value].text())
if initVal=="":initVal="0"
node = line[1].split()[1] #Extracting node from model line
addmodelLine = ".ic v("+node+")="+initVal
modelParamValue.append([line[0],addmodelLine,line[4]])
except Exception as e:
- print "Caught an exception in initial condition ",line[1]
- print "Exception Message : ",str(e)
+ print("Caught an exception in initial condition ",line[1])
+ print("Exception Message : ",str(e))
else:
@@ -254,7 +254,7 @@ class Convert:
start = line[7]
end = line[8]
addmodelLine=".model "+ line[3]+" "+line[2]+"("
- for key,value in line[9].iteritems():
+ for key,value in line[9].items():
#print "Tags: ",key
#print "Value: ",value
#Checking for default value and accordingly assign param and default.
@@ -287,8 +287,8 @@ class Convert:
addmodelLine += ") "
modelParamValue.append([line[0],addmodelLine,line[4]])
except Exception as e:
- print "Caught an exception in model ",line[1]
- print "Exception Message : ",str(e)
+ print("Caught an exception in model ",line[1])
+ print("Exception Message : ",str(e))
#Adding it to schematic
@@ -315,17 +315,17 @@ class Convert:
includeLine = [] #All .include line list
if not deviceLibList:
- print "No Library Added in the schematic"
+ 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"
+ print("Found Library line")
index = schematicInfo.index(eachline)
completeLibPath = deviceLibList[words[0]]
(libpath,libname) = os.path.split(completeLibPath)
- print "Library Path :",libpath
+ print("Library Path :",libpath)
#Copying library from devicemodelLibrary to Project Path
#Special case for MOSFET
if eachline[0] == 'm':
@@ -364,7 +364,7 @@ class Convert:
#Adding device line to schematicInfo
- for index,value in deviceLine.iteritems():
+ for index,value in deviceLine.items():
#Update the device line
strLine = " ".join(str(item) for item in value)
schematicInfo[index] = strLine
@@ -395,17 +395,17 @@ class Convert:
self.msg.show()
raise Exception('All subcircuit directories need to be specified.')
elif not subList:
- print "No Subcircuit Added in the schematic"
+ print("No Subcircuit Added in the schematic")
pass
else:
for eachline in schematicInfo:
words = eachline.split()
if words[0] in subList:
- print "Found Subcircuit line"
+ print("Found Subcircuit line")
index = schematicInfo.index(eachline)
completeSubPath = subList[words[0]]
(subpath,subname) = os.path.split(completeSubPath)
- print "Library Path :",subpath
+ print("Library Path :",subpath)
#Copying library from devicemodelLibrary to Project Path
#Replace last word with library name
@@ -415,7 +415,7 @@ class Convert:
src = completeSubPath
dst = projpath
- print os.listdir(src)
+ print(os.listdir(src))
for files in os.listdir(src):
if os.path.isfile(os.path.join(src,files)):
if files != "analysis":
@@ -425,7 +425,7 @@ class Convert:
#Adding subcircuit line to schematicInfo
- for index,value in subLine.iteritems():
+ for index,value in subLine.items():
#Update the subcircuit line
strLine = " ".join(str(item) for item in value)
schematicInfo[index] = strLine
diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py
index a775b8a5..ccc4c602 100644
--- a/src/kicadtoNgspice/DeviceModel.py
+++ b/src/kicadtoNgspice/DeviceModel.py
@@ -2,7 +2,7 @@ from PyQt4 import QtGui
import os
#from xml.etree import ElementTree as ET
import json
-import TrackWidget
+from . import TrackWidget
class DeviceModel(QtGui.QWidget):
@@ -23,7 +23,7 @@ class DeviceModel(QtGui.QWidget):
data = f.read()
json_data = json.loads(data)
except:
- print "Device Model Previous JSON is Empty"
+ print("Device Model Previous JSON is Empty")
QtGui.QWidget.__init__(self)
@@ -48,12 +48,12 @@ class DeviceModel(QtGui.QWidget):
#Set Layout
self.grid = QtGui.QGridLayout()
self.setLayout(self.grid)
- print "Reading Device model details from Schematic"
+ print("Reading Device model details from Schematic")
for eachline in schematicInfo:
words = eachline.split()
if eachline[0] == 'q':
- print "Device Model Transistor: ",words[0]
+ print("Device Model Transistor: ",words[0])
self.devicemodel_dict_beg[words[0]] = self.count
transbox=QtGui.QGroupBox()
transgrid=QtGui.QGridLayout()
@@ -73,7 +73,7 @@ class DeviceModel(QtGui.QWidget):
else:
self.entry_var[self.count].setText("")
except:
- print "Error when set text of device model transistor"
+ print("Error when set text of device model transistor")
except:
pass
@@ -108,7 +108,7 @@ class DeviceModel(QtGui.QWidget):
self.count = self.count + 1
elif eachline[0] == 'd':
- print "Device Model Diode:",words[0]
+ print("Device Model Diode:",words[0])
self.devicemodel_dict_beg[words[0]] = self.count
diodebox = QtGui.QGroupBox()
diodegrid = QtGui.QGridLayout()
@@ -127,7 +127,7 @@ class DeviceModel(QtGui.QWidget):
else:
self.entry_var[self.count].setText("")
except:
- print "Error when set text of device model diode"
+ print("Error when set text of device model diode")
except:
pass
@@ -162,7 +162,7 @@ class DeviceModel(QtGui.QWidget):
self.count = self.count + 1
elif eachline[0] == 'j':
- print "Device Model JFET:",words[0]
+ print("Device Model JFET:",words[0])
self.devicemodel_dict_beg[words[0]] = self.count
jfetbox = QtGui.QGroupBox()
jfetgrid = QtGui.QGridLayout()
@@ -181,7 +181,7 @@ class DeviceModel(QtGui.QWidget):
else:
self.entry_var[self.count].setText("")
except:
- print "Error when set text of Device Model JFET "
+ print("Error when set text of Device Model JFET ")
except:
pass
@@ -301,7 +301,7 @@ class DeviceModel(QtGui.QWidget):
"""
This function is use to keep track of all Device Model widget
"""
- print "Calling Track Device Model Library funtion"
+ print("Calling Track Device Model Library funtion")
sending_btn = self.sender()
#print "Object Called is ",sending_btn.objectName()
self.widgetObjCount = int(sending_btn.objectName())
@@ -332,10 +332,10 @@ class DeviceModel(QtGui.QWidget):
"""
This function is use to keep track of all Device Model widget
"""
- print "Calling Track Library function Without Button"
+ print("Calling Track Library function Without Button")
#print "Object Called is ",sending_btn.objectName()
self.widgetObjCount = iter_value
- print "self.widgetObjCount-----",self.widgetObjCount
+ print("self.widgetObjCount-----",self.widgetObjCount)
self.libfile = path_value
#print "Selected Library File :",self.libfile
diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py
index eaa9592e..637d971c 100644
--- a/src/kicadtoNgspice/KicadtoNgspice.py
+++ b/src/kicadtoNgspice/KicadtoNgspice.py
@@ -18,14 +18,14 @@
import sys
import os
from PyQt4 import QtGui
-from Processing import PrcocessNetlist
-import Analysis
-import Source
-import Model
-import DeviceModel
-import SubcircuitTab
-import Convert
-import TrackWidget
+from .Processing import PrcocessNetlist
+from . import Analysis
+from . import Source
+from . import Model
+from . import DeviceModel
+from . import SubcircuitTab
+from . import Convert
+from . import TrackWidget
import json
#from xml.etree import ElementTree as ET
@@ -42,9 +42,9 @@ class MainWindow(QtGui.QWidget):
def __init__(self,clarg1,clarg2=None):
QtGui.QWidget.__init__(self)
- print "=================================="
- print "Kicad to Ngspice netlist converter "
- print "=================================="
+ print("==================================")
+ print("Kicad to Ngspice netlist converter ")
+ print("==================================")
global kicadNetlist,schematicInfo
global infoline,optionInfo
self.kicadFile = clarg1
@@ -68,7 +68,7 @@ class MainWindow(QtGui.QWidget):
# Read the netlist
kicadNetlist = obj_proc.readNetlist(self.kicadFile)
- print "Given Kicad Schematic Netlist Info :",kicadNetlist
+ print("Given Kicad Schematic Netlist Info :",kicadNetlist)
# Construct parameter information
param = obj_proc.readParamInfo(kicadNetlist)
@@ -76,13 +76,13 @@ class MainWindow(QtGui.QWidget):
# Replace parameter with values
netlist,infoline = obj_proc.preprocessNetlist(kicadNetlist,param)
- print "Schematic Info after processing Kicad Netlist: ",netlist
+ print("Schematic Info after processing Kicad Netlist: ",netlist)
#print "INFOLINE",infoline
# Separate option and schematic information
optionInfo, schematicInfo = obj_proc.separateNetlistInfo(netlist)
- print "OPTIONINFO in the Netlist",optionInfo
+ print("OPTIONINFO in the Netlist",optionInfo)
#List for storing source and its value
global sourcelist, sourcelisttrack
@@ -98,7 +98,7 @@ class MainWindow(QtGui.QWidget):
plotText = []
schematicInfo,outputOption,modelList,unknownModelList,multipleModelList,plotText = obj_proc.convertICintoBasicBlocks(schematicInfo,outputOption,modelList,plotText)
- print "Model available in the Schematic :",modelList
+ print("Model available in the Schematic :",modelList)
"""
@@ -106,7 +106,7 @@ class MainWindow(QtGui.QWidget):
Also if the two model of same name is present under modelParamXML directory
"""
if unknownModelList:
- print "Unknown Model List is : ",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)
@@ -384,7 +384,7 @@ class MainWindow(QtGui.QWidget):
json_data["model"][line[3]]["type"] = line[2]
json_data["model"][line[3]]["values"] = []
- for key, value in line[7].iteritems():
+ for key, value in line[7].items():
if hasattr(value, '__iter__') and i <= end:
for item in value:
fields = {item: str(obj_model.obj_trac.model_entry_var[i].text())}
@@ -438,19 +438,19 @@ class MainWindow(QtGui.QWidget):
try:
#Adding Source Value to Schematic Info
store_schematicInfo = self.obj_convert.addSourceParameter()
- print "Netlist After Adding Source details :",store_schematicInfo
+ print("Netlist After Adding Source details :",store_schematicInfo)
#Adding Model Value to store_schematicInfo
store_schematicInfo = self.obj_convert.addModelParameter(store_schematicInfo)
- print "Netlist After Adding Ngspice Model :",store_schematicInfo
+ print("Netlist After Adding Ngspice Model :",store_schematicInfo)
#Adding Device Library to SchematicInfo
store_schematicInfo = self.obj_convert.addDeviceLibrary(store_schematicInfo,self.kicadFile)
- print "Netlist After Adding Device Model Library :",store_schematicInfo
+ print("Netlist After Adding Device Model Library :",store_schematicInfo)
#Adding Subcircuit Library to SchematicInfo
store_schematicInfo = self.obj_convert.addSubcircuit(store_schematicInfo, self.kicadFile)
- print "Netlist After Adding subcircuits :",store_schematicInfo
+ print("Netlist After Adding subcircuits :",store_schematicInfo)
analysisoutput = self.obj_convert.analysisInsertor(self.obj_track.AC_entry_var["ITEMS"],
self.obj_track.DC_entry_var["ITEMS"],
@@ -462,7 +462,7 @@ class MainWindow(QtGui.QWidget):
self.obj_track.AC_type["ITEMS"],
self.obj_track.op_check)
- print "Analysis OutPut ",analysisoutput
+ print("Analysis OutPut ",analysisoutput)
#Calling netlist file generation function
self.createNetlistFile(store_schematicInfo,plotText)
@@ -471,8 +471,8 @@ class MainWindow(QtGui.QWidget):
QtGui.QMessageBox.information(self, "Information", self.msg, QtGui.QMessageBox.Ok)
except Exception as e:
- print "Exception Message: ",e
- print "There was error while converting kicad to ngspice"
+ print("Exception Message: ",e)
+ print("There was error while converting kicad to ngspice")
self.close()
# Generate .sub file from .cir.out file if it is a subcircuit
@@ -482,7 +482,7 @@ class MainWindow(QtGui.QWidget):
self.createSubFile(subPath)
def createNetlistFile(self,store_schematicInfo,plotText):
- print "Creating Final netlist"
+ print("Creating Final netlist")
#print "INFOLINE",infoline
#print "OPTIONINFO",optionInfo
#print "Device MODEL LIST ",devicemodelList
@@ -504,10 +504,10 @@ class MainWindow(QtGui.QWidget):
f.close()
except :
- print "Error While opening Project Analysis file. Please check it"
+ print("Error While opening Project Analysis file. Please check it")
sys.exit()
else:
- print analysisFileLoc + " does not exist"
+ print(analysisFileLoc + " does not exist")
sys.exit()
#Adding analysis file info to optionInfo
@@ -588,7 +588,7 @@ class MainWindow(QtGui.QWidget):
except :
print("Error in opening .cir.out file.")
else:
- print self.projName + ".cir.out does not exist. Please create a spice netlist."
+ print(self.projName + ".cir.out does not exist. Please create a spice netlist.")
# Read the data from file
data=f.read()
@@ -612,7 +612,7 @@ class MainWindow(QtGui.QWidget):
continue
elif words[0] == ".control":
while words[0] != ".endc":
- eachline=netlist.next()
+ eachline=next(netlist)
eachline=eachline.strip()
if len(eachline)<1:
continue
@@ -634,7 +634,7 @@ class MainWindow(QtGui.QWidget):
out.writelines('\n')
out.writelines('.ends ' + self.projName)
- print "The subcircuit has been written in "+self.projName+".sub"
+ print("The subcircuit has been written in "+self.projName+".sub")
diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py
index 11d65c03..3f83b0d0 100644
--- a/src/kicadtoNgspice/Model.py
+++ b/src/kicadtoNgspice/Model.py
@@ -1,6 +1,6 @@
from PyQt4 import QtGui
import json
-import TrackWidget
+from . import TrackWidget
#from xml.etree import ElementTree as ET
import os
@@ -25,7 +25,7 @@ class Model(QtGui.QWidget):
data = f.read()
json_data = json.loads(data)
except:
- print "Model Previous Values JSON is Empty"
+ print("Model Previous Values JSON is Empty")
@@ -55,7 +55,7 @@ class Model(QtGui.QWidget):
self.start = self.nextcount
#line[7] is parameter dictionary holding parameter tags.
i = 0
- for key,value in line[7].iteritems():
+ for key,value in line[7].items():
#print "Key : ",key
#print "Value : ",value
#Check if value is iterable
@@ -71,7 +71,7 @@ class Model(QtGui.QWidget):
try:
for mod in json_data["model"]:
if json_data["model"][mod]["type"] == line[2] and mod == line[3]:
- self.obj_trac.model_entry_var[self.nextcount].setText(str(json_data["model"][mod]["values"][i].values()[0]))
+ self.obj_trac.model_entry_var[self.nextcount].setText(str(list(json_data["model"][mod]["values"][i].values())[0]))
i = i + 1
except:
pass
@@ -90,7 +90,7 @@ class Model(QtGui.QWidget):
try:
for mod in json_data["model"]:
if json_data["model"][mod]["type"] == line[2] and mod == line[3]:
- self.obj_trac.model_entry_var[self.nextcount].setText(str(json_data["model"][mod]["values"][i].values()[0]))
+ self.obj_trac.model_entry_var[self.nextcount].setText(str(list(json_data["model"][mod]["values"][i].values())[0]))
i = i + 1
except:
pass
diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py
index 09544f19..f9d1b4a8 100644
--- a/src/kicadtoNgspice/Processing.py
+++ b/src/kicadtoNgspice/Processing.py
@@ -23,7 +23,7 @@ class PrcocessNetlist:
"""Read Parameter information and store it into dictionary"""
param={}
for eachline in kicadNetlis:
- print eachline
+ print(eachline)
eachline=eachline.strip()
if len(eachline)>1:
words=eachline.split()
@@ -51,8 +51,8 @@ class PrcocessNetlist:
if key in param:
eachline=eachline.replace('{'+key+'}',param[key])
else:
- print "Parameter " + key +" does not exists"
- value=raw_input('Enter parameter value: ')
+ print("Parameter " + key +" does not exists")
+ value=input('Enter parameter value: ')
eachline=eachline.replace('{'+key+'}',value)
#Convert netlist into lower case letter
eachline=eachline.lower()
@@ -84,7 +84,7 @@ class PrcocessNetlist:
#Inser Special source parameter
schematicInfo1=[]
- print "Reading schematic info for source details"
+ print("Reading schematic info for source details")
for compline in schematicInfo:
words=compline.split()
@@ -149,13 +149,13 @@ class PrcocessNetlist:
schematicInfo1.append(compName+" "+words[1]+" "+words[2]+" "+"V"+compName+" "+words[5])
schematicInfo=schematicInfo+schematicInfo1
- print "Source List : ",sourcelist
+ print("Source List : ",sourcelist)
#print schematicInfo
return schematicInfo,sourcelist
def convertICintoBasicBlocks(self,schematicInfo,outputOption,modelList,plotText):
- print "Reading Schematic info for Model"
+ print("Reading Schematic info for Model")
#Insert details of Ngspice model
unknownModelList = []
multipleModelList = []
@@ -199,7 +199,7 @@ class PrcocessNetlist:
unknownModelList.append(compType)
elif count == 1:
try:
- print "Start Parsing Previous Values XML for ngspice model :",modelPath
+ print("Start Parsing Previous Values XML for ngspice model :",modelPath)
tree = ET.parse(modelPath[0])
root = tree.getroot()
@@ -252,7 +252,7 @@ class PrcocessNetlist:
modelLine += compName
else:
- print "Split Details :",splitDetail
+ print("Split Details :",splitDetail)
modelLine = "a"+str(k)+" "
vectorDetail = splitDetail.split(':')
#print "Vector Details",vectorDetail
@@ -280,7 +280,7 @@ class PrcocessNetlist:
pos += 1
except:
- print "There is error while processing Vector Details"
+ print("There is error while processing Vector Details")
sys.exit(2)
modelLine += compName
@@ -289,16 +289,16 @@ class PrcocessNetlist:
schematicInfo.append(modelLine)
k=k+1
except Exception as e:
- print "Error while appending ModelLine ",modelLine
- print "Exception Message : ",str(e)
+ print("Error while appending ModelLine ",modelLine)
+ print("Exception Message : ",str(e))
#Insert comment at remove line
schematicInfo.insert(index,"* "+compline)
comment = "* Schematic Name: "+compType+", NgSpice Name: "+modelname
#Here instead of adding compType(use for XML), added modelName(Unique Model Name)
modelList.append([index,compline,modelname,compName,comment,title,type,paramDict])
except Exception as e:
- print "Unable to parse the model, Please check your your XML file"
- print "Exception Message : ",str(e)
+ print("Unable to parse the model, Please check your your XML file")
+ print("Exception Message : ",str(e))
sys.exit(2)
elif compType == "ic":
schematicInfo.insert(index,"* "+compline)
@@ -370,9 +370,9 @@ class PrcocessNetlist:
else:
schematicInfo.insert(index,"* "+compline)
- print "UnknownModelList Used in the Schematic",unknownModelList
- print "Multiple Model XML file with same name ",multipleModelList
- print "Model List Details : ",modelList
+ print("UnknownModelList Used in the Schematic",unknownModelList)
+ print("Multiple Model XML file with same name ",multipleModelList)
+ print("Model List Details : ",modelList)
return schematicInfo,outputOption,modelList,unknownModelList,multipleModelList,plotText
diff --git a/src/kicadtoNgspice/Source.py b/src/kicadtoNgspice/Source.py
index d66cfa81..91ee8d43 100644
--- a/src/kicadtoNgspice/Source.py
+++ b/src/kicadtoNgspice/Source.py
@@ -1,6 +1,6 @@
import os
from PyQt4 import QtGui
-import TrackWidget
+from . import TrackWidget
#from xml.etree import ElementTree as ET
import json
@@ -40,7 +40,7 @@ class Source(QtGui.QWidget):
json_data = json.loads(data)
except:
- print "Source Previous Values JSON is Empty"
+ print("Source Previous Values JSON is Empty")
self.grid = QtGui.QGridLayout()
self.setLayout(self.grid)
@@ -48,7 +48,7 @@ class Source(QtGui.QWidget):
if sourcelist:
for line in sourcelist:
#print "Voltage source line index: ",line[0]
- print "SourceList line: ",line
+ print("SourceList line: ",line)
track_id=line[0]
#print "track_id is ",track_id
if line[2] == 'ac':
@@ -159,7 +159,7 @@ class Source(QtGui.QWidget):
templist1 = line[1]
templist2 = templist1.split(' ')
if key == templist2[0] and json_data["source"][key]["type"] == line[2]:
- self.entry_var[self.count].setText(str(json_data["source"][key]["values"][it-4].values()[0]))
+ self.entry_var[self.count].setText(str(list(json_data["source"][key]["values"][it-4].values())[0]))
except:
pass
@@ -198,7 +198,7 @@ class Source(QtGui.QWidget):
templist2 = templist1.split(' ')
if key == templist2[0] and json_data["source"][key]["type"] == line[2]:
- self.entry_var[self.count].setText(str(json_data["source"][key]["values"][it-4].values()[0]))
+ self.entry_var[self.count].setText(str(list(json_data["source"][key]["values"][it-4].values())[0]))
except:
pass
@@ -271,7 +271,7 @@ class Source(QtGui.QWidget):
templist1 = line[1]
templist2 = templist1.split(' ')
if key == templist2[0] and json_data["source"][key]["type"] == line[2]:
- self.entry_var[self.count].setText(str(json_data["source"][key]["values"][it-4].values()[0]))
+ self.entry_var[self.count].setText(str(list(json_data["source"][key]["values"][it-4].values())[0]))
except:
pass
@@ -291,7 +291,7 @@ class Source(QtGui.QWidget):
sourcelisttrack.append([track_id, 'exp', self.start, self.end])
else:
- print "No source is present in your circuit"
+ print("No source is present in your circuit")
#This is used to keep the track of dynamically created widget
diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py
index aba2a145..7a4469df 100644
--- a/src/kicadtoNgspice/SubcircuitTab.py
+++ b/src/kicadtoNgspice/SubcircuitTab.py
@@ -1,6 +1,6 @@
from PyQt4 import QtGui
import json
-import TrackWidget
+from . import TrackWidget
from projManagement import Validation
import os
#from xml.etree import ElementTree as ET
@@ -21,7 +21,7 @@ class SubcircuitTab(QtGui.QWidget):
data = f.read()
json_data = json.loads(data)
except:
- print "Subcircuit Previous values JSON is Empty"
+ print("Subcircuit Previous values JSON is Empty")
QtGui.QWidget.__init__(self)
@@ -49,7 +49,7 @@ class SubcircuitTab(QtGui.QWidget):
for eachline in schematicInfo:
words = eachline.split()
if eachline[0] == 'x':
- print "Subcircuit : Words",words[0]
+ print("Subcircuit : Words",words[0])
self.obj_trac.subcircuitList[project_name+words[0]] = words
self.subcircuit_dict_beg[words[0]] = self.count
subbox = QtGui.QGroupBox()
@@ -70,9 +70,9 @@ class SubcircuitTab(QtGui.QWidget):
else:
self.entry_var[self.count].setText("")
except:
- print "Error when set text of subcircuit"
+ print("Error when set text of subcircuit")
except:
- print "Error before subcircuit"
+ print("Error before subcircuit")
subgrid.addWidget(self.entry_var[self.count], self.row, 1)
@@ -81,7 +81,7 @@ class SubcircuitTab(QtGui.QWidget):
#Send the number of ports specified with the given subcircuit for verification.
#eg. If the line is 'x1 4 0 3 ua741', there are 3 ports(4, 0 and 3).
self.numPorts.append(len(words)-2)
- print "Number of ports of sub circuit : ",self.numPorts
+ print("Number of ports of sub circuit : ",self.numPorts)
self.addbtn.clicked.connect(self.trackSubcircuit)
subgrid.addWidget(self.addbtn, self.row, 2)
subbox.setLayout(subgrid)