summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ngspicetoModelica/ModelicaUI.py31
-rw-r--r--src/ngspicetoModelica/NgspicetoModelica.py499
-rw-r--r--src/projManagement/Kicad.py53
-rw-r--r--src/projManagement/Validation.py7
-rw-r--r--src/projManagement/Worker.py4
-rw-r--r--src/projManagement/newProject.py30
-rw-r--r--src/projManagement/openProject.py24
-rw-r--r--src/subcircuit/convertSub.py8
-rw-r--r--src/subcircuit/newSub.py17
-rw-r--r--src/subcircuit/openSub.py4
10 files changed, 468 insertions, 209 deletions
diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py
index 8606ce36..daef6e76 100644
--- a/src/ngspicetoModelica/ModelicaUI.py
+++ b/src/ngspicetoModelica/ModelicaUI.py
@@ -1,5 +1,4 @@
import os
-import sys
from subprocess import Popen, PIPE, STDOUT
from PyQt4 import QtGui, QtCore
from configuration.Appconfig import Appconfig
@@ -40,7 +39,7 @@ class OpenModelicaEditor(QtGui.QWidget):
self.loadOMbtn.clicked.connect(self.callOMEdit)
self.grid.addWidget(self.loadOMbtn, 3, 1)
- #self.setGeometry(300, 300, 350, 300)
+ # self.setGeometry(300, 300, 350, 300)
self.setLayout(self.grid)
self.show()
@@ -55,7 +54,7 @@ class OpenModelicaEditor(QtGui.QWidget):
try:
self.cmd1 = "python ../ngspicetoModelica/NgspicetoModelica.py " + \
self.ngspiceNetlist + ' ' + self.map_json
- #self.obj_workThread1 = Worker.WorkerThread(self.cmd1)
+ # self.obj_workThread1 = Worker.WorkerThread(self.cmd1)
# self.obj_workThread1.start()
convert_process = Popen(
self.cmd1,
@@ -68,15 +67,19 @@ class OpenModelicaEditor(QtGui.QWidget):
if not error_code:
self.msg = QtGui.QMessageBox()
self.msg.setText(
- "Ngspice netlist successfully converted to OpenModelica netlist")
+ "Ngspice netlist successfully converted to OpenModelica" +
+ "netlist")
self.obj_appconfig.print_info(
- "Ngspice netlist successfully converted to OpenModelica netlist")
+ "Ngspice netlist successfully converted to OpenModelica" +
+ "netlist"
+ )
self.msg.exec_()
else:
self.err_msg = QtGui.QErrorMessage()
self.err_msg.showMessage(
- 'Unable to convert NgSpice netlist to Modelica netlist. Check the netlist :' +
+ 'Unable to convert NgSpice netlist to Modelica netlist.' +
+ 'Check the netlist :' +
error_code)
self.err_msg.setWindowTitle(
"Ngspice to Modelica conversion error")
@@ -85,7 +88,8 @@ class OpenModelicaEditor(QtGui.QWidget):
except Exception as e:
self.msg = QtGui.QErrorMessage()
self.msg.showMessage(
- 'Unable to convert NgSpice netlist to Modelica netlist. Check the netlist :' +
+ 'Unable to convert NgSpice netlist to Modelica netlist.' +
+ 'Check the netlist :' +
str(e))
self.msg.setWindowTitle("Ngspice to Modelica conversion error")
@@ -101,9 +105,16 @@ class OpenModelicaEditor(QtGui.QWidget):
else:
self.msg = QtGui.QMessageBox()
self.msgContent = "There was an error while opening OMEdit.<br/>\
- Please make sure OpenModelica is installed in your system. <br/>\
- To install it on Linux : Go to <a href=https://www.openmodelica.org/download/download-linux>OpenModelica Linux</a> and install nigthly build release.<br/>\
- To install it on Windows : Go to <a href=https://www.openmodelica.org/download/download-windows>OpenModelica Windows</a> and install latest version.<br/>"
+ Please make sure OpenModelica is installed in your \
+ system. <br/>\
+ To install it on Linux : Go to <a href= \
+ https://www.openmodelica.org/download/download-linux> \
+ OpenModelica Linux</a> \
+ and install nigthly build release.<br/> \
+ To install it on Windows : Go to <a href= \
+ https://www.openmodelica.org/download/download-windows>\
+ OpenModelica Windows</a> and install latest version. \
+ <br/>"
self.msg.setTextFormat(QtCore.Qt.RichText)
self.msg.setText(self.msgContent)
self.msg.setWindowTitle("Missing OpenModelica")
diff --git a/src/ngspicetoModelica/NgspicetoModelica.py b/src/ngspicetoModelica/NgspicetoModelica.py
index 3a148515..dfeafb53 100644
--- a/src/ngspicetoModelica/NgspicetoModelica.py
+++ b/src/ngspicetoModelica/NgspicetoModelica.py
@@ -84,15 +84,17 @@ class NgMoConverter:
schematicInfo.append(eachline)
else:
schematicInfo.append(eachline)
- # No need of making it lower case as netlist is already converted to ngspice
+ # No need of making it lower case as netlist
+ # is already converted to ngspice
# schematicInfo.append(eachline.lower())
return optionInfo, schematicInfo
def addModel(self, optionInfo):
"""
- Add model parameters in the modelica file and create dictionary of model parameters
- This function extract model and subckt information along with their parameters with the help of optionInfo
+ Add model parameters in the modelica file and create dictionary of
+ model parameters. This function extract model and subckt information
+ along with their parameters with the help of optionInfo
"""
modelName = []
modelInfo = {}
@@ -188,7 +190,8 @@ class NgMoConverter:
modelInfo[refModelName][info[0]] = info[1]
f.close()
- return modelName, modelInfo, subcktName, paramInfo, transInfo, inbuiltModelDict
+ return (modelName, modelInfo, subcktName,
+ paramInfo, transInfo, inbuiltModelDict)
def processParam(self, paramInfo):
"""
@@ -225,12 +228,14 @@ class NgMoConverter:
def separateSource(self, compInfo):
"""
- Find if dependent sources are present in the schematic and if so make a dictionary with source details
+ Find if dependent sources are present in the schematic and
+ if so make a dictionary with source details
"""
sourceInfo = {}
source = []
for eachline in compInfo:
- words = eachline.split() # This line need to be confirmed with Manas
+ words = eachline.split()
+ # This line need to be confirmed with Manas
if eachline[0] in ['f', 'h']:
source.append(words[3])
if len(source) > 0:
@@ -241,12 +246,12 @@ class NgMoConverter:
return sourceInfo
def getUnitVal(self, compValue):
- #regExp = re.compile("([0-9]+)([a-zA-Z]+)")
+ # regExp = re.compile("([0-9]+)([a-zA-Z]+)")
# Remove '(' and ')' if any
compValue = compValue.replace('(', '').replace(')', '')
compValue = compValue.lower()
- #regExp = re.compile("([-])?([0-9]+)\.?([0-9]+)?([a-zA-Z])?")
- regExp = re.compile("([-])?([0-9]+)\.?([0-9]+)?(\w+)?")
+ # regExp = re.compile("([-])?([0-9]+)\.?([0-9]+)?([a-zA-Z])?")
+ regExp = re.compile(r"([-])?([0-9]+)\.?([0-9]+)?(\w+)?")
# separating number and string
matchString = regExp.match(str(compValue))
try:
@@ -279,20 +284,21 @@ class NgMoConverter:
def compInit(self, compInfo, node, modelInfo, subcktName,
dir_name, transInfo, inbuiltModelDict):
"""
- For each component in the netlist initialize it according to Modelica format
+ For each component in the netlist initialize it
+ according to Modelica format
"""
- #print "CompInfo inside compInit function : compInit------->",compInfo
+ # print "CompInfo inside compInit function : compInit------->",compInfo
# initial processing to check if MOs is present. If so, library to be
# used is BondLib
modelicaCompInit = []
numNodesSub = {}
mosInfo = {}
- IfMOS = '0'
+ # IfMOS = '0'
for eachline in compInfo:
- #words = eachline.split()
+ # words = eachline.split()
if eachline[0] == 'm':
- IfMOS = '1'
+ # IfMOS = '1'
break
if len(subcktName) > 0:
subOptionInfo = []
@@ -304,9 +310,9 @@ class NgMoConverter:
subOptionInfo, subSchemInfo = self.separateNetlistInfo(data)
for eachline in subSchemInfo:
- #words = eachline.split()
+ # words = eachline.split()
if eachline[0] == 'm':
- IfMOS = '1'
+ # IfMOS = '1'
break
# Lets Start with Source details
@@ -324,17 +330,30 @@ class NgMoConverter:
if sourceType == 'v':
if typ[0] == "pulse":
per = words[9].split(')')
- stat = self.mappingData["Sources"][sourceType][typ[0]] + ' ' + compName + '(rising = ' + self.getUnitVal(words[6]) + ', V = ' + self.getUnitVal(words[4])\
- + ', width = ' + self.getUnitVal(words[8]) + ', period = ' + self.getUnitVal(per[0]) + ', offset = ' + self.getUnitVal(
- typ[1]) + ', startTime = ' + self.getUnitVal(words[5]) + ', falling = ' + self.getUnitVal(words[7]) + ');'
+ stat = self.mappingData["Sources"][sourceType][typ[0]] +\
+ ' ' + compName + '(rising = ' +\
+ self.getUnitVal(words[6]) + ', V = ' +\
+ self.getUnitVal(words[4])\
+ + ', width = ' + self.getUnitVal(words[8]) +\
+ ', period = ' + self.getUnitVal(per[0]) +\
+ ', offset = ' + self.getUnitVal(
+ typ[1]) + ', startTime = ' +\
+ self.getUnitVal(words[5]) + ', falling = ' +\
+ self.getUnitVal(words[7]) + ');'
modelicaCompInit.append(stat)
if typ[0] == "sine":
theta = words[7].split(')')
- stat = self.mappingData["Sources"][sourceType][typ[0]] + ' ' + compName + '(offset = ' + self.getUnitVal(typ[1]) + ', V = ' + self.getUnitVal(
- words[4]) + ', freqHz = ' + self.getUnitVal(words[5]) + ', startTime = ' + self.getUnitVal(words[6]) + ', phase = ' + self.getUnitVal(theta[0]) + ');'
+ stat = self.mappingData["Sources"][sourceType][typ[0]] +\
+ ' ' + compName + '(offset = ' +\
+ self.getUnitVal(typ[1]) +\
+ ', V = ' + self.getUnitVal(words[4]) + ', freqHz = ' +\
+ self.getUnitVal(words[5]) + ', startTime = ' +\
+ self.getUnitVal(words[6]) + ', phase = ' +\
+ self.getUnitVal(theta[0]) + ');'
modelicaCompInit.append(stat)
if typ[0] == "pwl":
- keyw = self.mappingData["Sources"][sourceType][typ[0]] + ' '
+ keyw = self.mappingData["Sources"][sourceType][typ[0]] +\
+ ' '
stat = keyw + compName + \
'(table = [' + self.getUnitVal(typ[1]) + \
',' + self.getUnitVal(words[4]) + ';'
@@ -347,19 +366,21 @@ class NgMoConverter:
words[i - 1]) + ',' + self.getUnitVal(w[0])
else:
stat = stat + \
- self.getUnitVal(
- words[i - 1]) + ',' + self.getUnitVal(words[i]) + ';'
+ self.getUnitVal(words[i - 1]) + ',' + \
+ self.getUnitVal(words[i]) + ';'
stat = stat + ']);'
modelicaCompInit.append(stat)
if typ[0] == words[3] and typ[0] != "dc":
# It is DC constant but no dc keyword
val_temp = typ[0].split('v')
- stat = self.mappingData["Sources"][sourceType]["dc"] + ' ' + \
+ stat = self.mappingData["Sources"][sourceType]["dc"] + \
+ ' ' + \
compName + \
'(V = ' + self.getUnitVal(val_temp[0]) + ');'
modelicaCompInit.append(stat)
elif typ[0] == words[3] and typ[0] == "dc":
- stat = self.mappingData["Sources"][sourceType][typ[0]] + ' ' + \
+ stat = self.mappingData["Sources"][sourceType][typ[0]] + \
+ ' ' + \
compName + \
'(V = ' + \
self.getUnitVal(words[4]) + ');' # check this
@@ -373,7 +394,7 @@ class NgMoConverter:
# Now empty the source list as it may be used by subcircuit
self.sourceDetail[:] = []
- #print "Source Detail after processing-------->",self.sourceDetail
+ # print "Source Detail after processing-------->",self.sourceDetail
# Lets start for device
for eachline in self.deviceDetail:
@@ -386,7 +407,11 @@ class NgMoConverter:
else:
n = 1.0
vt = str(float(0.025 * n))
- #stat = self.mappingData["Devices"][deviceName]["import"]+' '+ words[0] + '(Ids = ' + modelInfo[words[3]]['is'] + ', Vt = ' + vt + ', R = 1e12' +');'
+ '''
+ stat = self.mappingData["Devices"][deviceName]["import"]+\
+ ' '+words[0] + '(Ids = ' + modelInfo[words[3]]['is']+\
+ ', Vt = ' + vt + ', R = 1e12' +');'
+ '''
start = self.mappingData["Devices"][deviceName]["import"]
stat = start + " " + words[0] + "("
tempstatList = []
@@ -395,7 +420,12 @@ class NgMoConverter:
for key in modelInfo[refName]:
# If parameter is not mapped then it will just pass
try:
- actualModelicaParam = self.mappingData["Devices"][deviceName]["mapping"][key]
+ actualModelicaParam = (
+ self.mappingData["Devices"]
+ [deviceName]
+ ["mapping"]
+ [key]
+ )
tempstatList.append(
actualModelicaParam +
"=" +
@@ -410,27 +440,46 @@ class NgMoConverter:
userDeviceParamList.append("Vt")
tempstatList.append("Vt=" + vt)
# Running loop over default parameter of OpenModelica
- for default in self.mappingData["Devices"][deviceName]["default"]:
+ for default in (self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["default"]
+ ):
if default in userDeviceParamList:
continue
else:
- defaultValue = self.mappingData["Devices"][deviceName]["default"][default]
+ defaultValue = (self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["default"]
+ [default]
+ )
tempstatList.append(
- default + "=" + self.getUnitVal(defaultValue) + " ")
+ default + "=" +
+ self.getUnitVal(defaultValue) + " ")
stat += ",".join(str(item) for item in tempstatList) + ");"
else:
- stat = self.mappingData["Devices"][deviceName]["import"] + \
- " " + words[0] + ";"
+ stat = (self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["import"]
+ ) + " " + words[0] + ";"
modelicaCompInit.append(stat)
elif deviceName == 'q':
trans = transInfo[words[4]]
if trans == 'npn':
- start = self.mappingData["Devices"][deviceName]["import"] + ".NPN"
+ start = (
+ self.mappingData["Devices"][deviceName]["import"]
+ ) + ".NPN"
elif trans == 'pnp':
- start = self.mappingData["Devices"][deviceName]["import"] + ".PNP"
+ start = self.mappingData(
+ ["Devices"]
+ [deviceName]
+ ["import"]
+ ) + ".PNP"
else:
print("Transistor " + str(trans) + " Not found")
sys.exit(1)
@@ -451,7 +500,13 @@ class NgMoConverter:
tempstatList.append("Vak=" + vak + " ")
userDeviceParamList.append(str("Vak"))
else:
- actualModelicaParam = self.mappingData["Devices"][deviceName]["mapping"][key]
+ actualModelicaParam = (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["mapping"]
+ [key]
+ )
tempstatList.append(
actualModelicaParam +
"=" +
@@ -463,13 +518,25 @@ class NgMoConverter:
except BaseException:
pass
# Running loop over default parameter of OpenModelica
- for default in self.mappingData["Devices"][deviceName]["default"]:
+ for default in (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["default"]
+ ):
if default in userDeviceParamList:
continue
else:
- defaultValue = self.mappingData["Devices"][deviceName]["default"][default]
+ defaultValue = (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["default"]
+ [default]
+ )
tempstatList.append(
- default + "=" + self.getUnitVal(defaultValue) + " ")
+ default + "=" + self.getUnitVal(defaultValue) +
+ " ")
stat += ",".join(str(item) for item in tempstatList) + ");"
modelicaCompInit.append(stat)
@@ -478,8 +545,14 @@ class NgMoConverter:
eachline = eachline.split(words[5])
eachline = eachline[1]
eachline = eachline.strip()
- eachline = eachline.replace(' = ', '=').replace('= ', '=').replace(' =', '=').replace(
- ' * ', '*').replace(' + ', '+').replace(' { ', '').replace(' } ', '')
+ eachline = eachline.replace(
+ ' = ', '=').replace(
+ '= ', '=').replace(
+ ' =', '=').replace(
+ ' * ', '*').replace(
+ ' + ', '+').replace(
+ ' { ', '').replace(
+ ' } ', '')
eachline = eachline.split()
mosInfo[words[0]] = {}
for each in eachline:
@@ -489,9 +562,19 @@ class NgMoConverter:
trans = transInfo[words[5]]
if trans == 'nmos':
- start = self.mappingData["Devices"][deviceName]["import"] + ".Mn"
+ start = (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["import"]
+ ) + ".Mn"
elif trans == 'pmos':
- start = self.mappingData["Devices"][deviceName]["import"] + ".Mp"
+ start = (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["import"]
+ ) + ".Mp"
else:
print("MOSFET " + str(trans) + " not found")
sys.exit(1)
@@ -513,7 +596,13 @@ class NgMoConverter:
tempstatList.append("U0=" + U0 + " ")
userDeviceParamList.append(str("U0"))
else:
- actualModelicaParam = self.mappingData["Devices"][deviceName]["mapping"][key]
+ actualModelicaParam = (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["mapping"]
+ [key]
+ )
tempstatList.append(
actualModelicaParam +
"=" +
@@ -526,13 +615,25 @@ class NgMoConverter:
print(str(err))
# Running loop over default parameter of OpenModelica
- for default in self.mappingData["Devices"][deviceName]["default"]:
+ for default in (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["default"]
+ ):
if default in userDeviceParamList:
continue
else:
- defaultValue = self.mappingData["Devices"][deviceName]["default"][default]
+ defaultValue = (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["default"]
+ [default]
+ )
tempstatList.append(
- default + "=" + self.getUnitVal(defaultValue) + " ")
+ default + "=" + self.getUnitVal(defaultValue) + " "
+ )
# Adding LEVEL(This is constant not the device level)
tempstatList.append("Level=1" + " ")
@@ -571,9 +672,17 @@ class NgMoConverter:
trans = transInfo[words[4]]
"""
if trans == 'njf':
- start = self.mappingData["Devices"][deviceName]["import"]+".J_NJFJFET"
+ start = self.mappingData(
+ ["Devices"]
+ [deviceName]
+ ["import"]
+ )+".J_NJFJFET"
elif trans == 'pjf':
- start = self.mappingData["Devices"][deviceName]["import"]+".J_PJFJFET"
+ start = self.mappingData(
+ ["Devices"]
+ [deviceName]
+ ["import"]
+ )+".J_PJFJFET"
else:
print "JFET "+str(trans)+" Not found"
sys.exit(1)
@@ -587,7 +696,12 @@ class NgMoConverter:
for key in modelInfo[refName]:
# If parameter is not mapped then it will just pass
try:
- actualModelicaParam = self.mappingData["Devices"][deviceName]["mapping"][key]
+ actualModelicaParam = self.mappingData(
+ ["Devices"]
+ [deviceName]
+ ["mapping"]
+ [key]
+ )
tempstatList.append(
actualModelicaParam +
"=" +
@@ -598,13 +712,25 @@ class NgMoConverter:
except BaseException:
pass
# Running loop over default parameter of OpenModelica
- for default in self.mappingData["Devices"][deviceName]["default"]:
+ for default in (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["default"]
+ ):
if default in userDeviceParamList:
continue
else:
- defaultValue = self.mappingData["Devices"][deviceName]["default"][default]
+ defaultValue = (
+ self.mappingData
+ ["Devices"]
+ [deviceName]
+ ["default"]
+ [default]
+ )
tempstatList.append(
- default + "=" + self.getUnitVal(defaultValue) + " ")
+ default + "=" + self.getUnitVal(defaultValue) + " "
+ )
stat += ",".join(str(item) for item in tempstatList) + "));"
modelicaCompInit.append(stat)
@@ -652,7 +778,13 @@ class NgMoConverter:
for key in modelInfo[refName]:
# If parameter is not mapped then it will just pass
try:
- actualModelicaParam = self.mappingData["Models"][actualModelName]["mapping"][key]
+ actualModelicaParam = (
+ self.mappingData
+ ["Models"]
+ [actualModelName]
+ ["mapping"]
+ [key]
+ )
tempstatList.append(
actualModelicaParam +
"=" +
@@ -664,13 +796,25 @@ class NgMoConverter:
pass
# Running loop over default parameter of OpenModelica
- for default in self.mappingData["Models"][actualModelName]["default"]:
+ for default in (
+ self.mappingData
+ ["Models"]
+ [actualModelName]
+ ["default"]
+ ):
if default in userModelParamList:
continue
else:
- defaultValue = self.mappingData["Models"][actualModelName]["default"][default]
+ defaultValue = (
+ self.mappingData
+ ["Models"]
+ [actualModelName]
+ ["default"]
+ [default]
+ )
tempstatList.append(
- default + "=" + self.getUnitVal(defaultValue) + " ")
+ default + "=" + self.getUnitVal(defaultValue) + " "
+ )
stat += ",".join(str(item) for item in tempstatList) + ");"
modelicaCompInit.append(stat)
@@ -731,9 +875,10 @@ class NgMoConverter:
def getSubParamLine(self, subname, numNodesSub, subParamInfo, dir_name):
"""
- Take subcircuit name and give the info related to parameters in the first line and initialize it in
+ Take subcircuit name and give the info related
+ to parameters in the first line and initialize it in
"""
- #nodeSubInterface = []
+ # nodeSubInterface = []
subOptionInfo_p = []
subSchemInfo_p = []
filename_t = subname + '.sub'
@@ -756,7 +901,8 @@ class NgMoConverter:
def nodeSeparate(self, compInfo, ifSub, subname, subcktName, numNodesSub):
"""
separate the node numbers and create nodes in modelica file;
- the nodes in the subckt line should not be inside protected keyword. pinInit is the one that goes under protected keyword.
+ the nodes in the subckt line should not be inside protected keyword.
+ pinInit is the one that goes under protected keyword.
"""
node = []
nodeTemp = []
@@ -764,7 +910,7 @@ class NgMoConverter:
pinInit = 'Modelica.Electrical.Analog.Interfaces.Pin '
pinProtectedInit = 'Modelica.Electrical.Analog.Interfaces.Pin '
protectedNode = []
- #print "CompInfo coming to nodeSeparate function: compInfo",compInfo
+ # print "CompInfo coming to nodeSeparate function: compInfo",compInfo
# Removing '[' and ']' from compInfo for Digital node
for i in range(0, len(compInfo), 1):
@@ -787,7 +933,7 @@ class NgMoConverter:
for i in range(0, len(templine), 1):
if templine[i] in subcktName:
point = i
- #print "Added in node----->",words[1:point]
+ # print "Added in node----->",words[1:point]
nodeTemp.extend(words[1:point])
else:
nodeTemp.append(words[1])
@@ -829,10 +975,10 @@ class NgMoConverter:
pinInit = pinInit + nodeDic[protectedNode[i]]
pinInit = pinInit + ';'
pinProtectedInit = pinProtectedInit + ';'
- #print "Node---->",node
- #print "nodeDic----->",nodeDic
- #print "PinInit----->",pinInit
- #print "pinProtectedinit--->",pinProtectedInit
+ # print "Node---->",node
+ # print "nodeDic----->",nodeDic
+ # print "PinInit----->",pinInit
+ # print "pinProtectedinit--->",pinProtectedInit
return node, nodeDic, pinInit, pinProtectedInit
def connectInfo(self, compInfo, node, nodeDic, numNodesSub, subcktName):
@@ -848,8 +994,20 @@ class NgMoConverter:
for i in range(0, len(words), 1):
words[i] = words[i].replace("-", "")
- if eachline[0] == 'r' or eachline[0] == 'R' or eachline[0] == 'c' or eachline[0] == 'C' or eachline[0] == 'd' or eachline[0] == 'D' \
- or eachline[0] == 'l' or eachline[0] == 'L' or eachline[0] == 'v' or eachline[0] == 'V' or eachline[0] == 'i' or eachline[0] == 'I':
+ if(
+ eachline[0] == 'r' or
+ eachline[0] == 'R' or
+ eachline[0] == 'c' or
+ eachline[0] == 'C' or
+ eachline[0] == 'd' or
+ eachline[0] == 'D' or
+ eachline[0] == 'l' or
+ eachline[0] == 'L' or
+ eachline[0] == 'v' or
+ eachline[0] == 'V' or
+ eachline[0] == 'i' or
+ eachline[0] == 'I'
+ ):
conn = 'connect(' + words[0] + '.p,' + nodeDic[words[1]] + ');'
connInfo.append(conn)
conn = 'connect(' + words[0] + '.n,' + nodeDic[words[2]] + ');'
@@ -880,8 +1038,8 @@ class NgMoConverter:
elif eachline[0] in ['f', 'h', 'F', 'H']:
vsource = words[3]
sourceNodes = sourcesInfo[vsource]
- #print "Source Nodes------>",sourceNodes
- #print "Source Info------->",sourcesInfo
+ # print "Source Nodes------>",sourceNodes
+ # print "Source Info------->",sourcesInfo
# sourceNodes = sourceNodes.split() #No need to split as it is
# in the form of list
conn = 'connect(' + words[0] + '.p1,' + \
@@ -937,7 +1095,7 @@ class NgMoConverter:
# Process the subcircuit file .sub in the project folder
- #subcktDic = {}
+ # subcktDic = {}
subOptionInfo = []
subSchemInfo = []
subModel = []
@@ -947,7 +1105,7 @@ class NgMoConverter:
nodeSubInterface = []
nodeSub = []
nodeDicSub = {}
- pinInitsub = []
+ # pinInitsub = []
connSubInfo = []
if len(subcktName) > 0:
for eachsub in subcktName:
@@ -955,70 +1113,90 @@ class NgMoConverter:
basename = filename
filename = os.path.join(dir_name, filename)
data = self.readNetlist(filename)
- #print "Data-------------------->",data
+ # print "Data-------------------->",data
subOptionInfo, subSchemInfo = self.separateNetlistInfo(data)
- #print "SubOptionInfo------------------->",subOptionInfo
- #print "SubSchemInfo-------------------->",subSchemInfo
+ # print "SubOptionInfo------------------->",subOptionInfo
+ # print "SubSchemInfo-------------------->",subSchemInfo
if len(subOptionInfo) > 0:
newline = subOptionInfo[0]
- subInitLine = newline
+ # subInitLine = newline
newline = newline.split('.subckt')
intLine = newline[1].split()
for i in range(0, len(intLine), 1):
nodeSubInterface.append(intLine[i])
- subModel, subModelInfo, subsubName, subParamInfo, subtransInfo, subInbuiltModelDict = self.addModel(
- subOptionInfo)
- #print "Sub Model------------------------------------>",subModel
- #print "SubModelInfo---------------------------------->",subModelInfo
- #print "subsubName------------------------------------->",subsubName
- #print "subParamInfo----------------------------------->",subParamInfo
- #print "subtransInfo----------------------------------->",subtransInfo
- #print "subInbuiltModel----------------------------------->",subInbuiltModelDict
+ subModel, subModelInfo,\
+ subsubName, subParamInfo,\
+ subtransInfo, subInbuiltModelDict = (
+ self.addModel(subOptionInfo)
+ )
+ # print "Sub Model------------------------------->",subModel
+ # print "SubModelInfo------------------------>",subModelInfo
+ # print "subsubName---------------------------->",subsubName
+ # print "subParamInfo------------------------>",subParamInfo
+ # print "subtransInfo------------------------>",subtransInfo
+ # print "subInbuiltModel-------------->",subInbuiltModelDict
IfMOSsub = '0'
for eachline in subSchemInfo:
- #words = eachline.split()
+ # words = eachline.split()
if eachline[0] == 'm':
IfMOSsub = '1'
break
subsubOptionInfo = []
subsubSchemInfo = []
if len(subsubName) > 0:
- #subsubOptionInfo = []
- #subsubSchemInfo = []
+ # subsubOptionInfo = []
+ # subsubSchemInfo = []
for eachsub in subsubName:
filename_st = eachsub + '.sub'
filename_stemp = os.path.join(dir_name, filename_st)
data = self.readNetlist(filename_stemp)
- subsubOptionInfo, subsubSchemInfo = self.separateNetlistInfo(
- data)
+ subsubOptionInfo, subsubSchemInfo = (
+ self.separateNetlistInfo(data)
+ )
for eachline in subsubSchemInfo:
- #words = eachline.split()
+ # words = eachline.split()
if eachline[0] == 'm':
IfMOSsub = '1'
break
- #print "subsubOptionInfo-------------------------->",subsubOptionInfo
- #print "subsubSchemInfo-------------------------->",subsubSchemInfo
+ # print "subsubOptionInfo------------------>",subsubOptionInfo
+ # print "subsubSchemInfo-------------------->",subsubSchemInfo
modelicaSubParam = self.processParam(subParamInfo)
- #print "modelicaSubParam------------------->",modelicaSubParam
- nodeSub, nodeDicSub, pinInitSub, pinProtectedInitSub = self.nodeSeparate(
- subSchemInfo, '1', eachsub, subsubName, numNodesSub)
- #print "NodeSub------------------------->",nodeSub
- #print "NodeDicSub-------------------------->",nodeDicSub
- #print "PinInitSub-------------------------->",pinInitSub
- #print "PinProtectedInitSub------------------->",pinProtectedInitSub
+ # print "modelicaSubParam------------------>",modelicaSubParam
+ nodeSub, nodeDicSub, pinInitSub,\
+ pinProtectedInitSub = self.nodeSeparate(
+ subSchemInfo, '1', eachsub, subsubName, numNodesSub)
+ # print "NodeSub------------------------->",nodeSub
+ # print "NodeDicSub-------------------------->",nodeDicSub
+ # print "PinInitSub-------------------------->",pinInitSub
+ # print "PinProtectedInitSub----------->",pinProtectedInitSub
modelicaSubCompInit, numNodesSubsub = self.compInit(
- subSchemInfo, nodeSub, subModelInfo, subsubName, dir_name, subtransInfo, subInbuiltModelDict)
- #print "modelicaSubCompInit--------------------->",modelicaSubCompInit
- #print "numNodesSubsub-------------------------->",numNodesSubsub
+ subSchemInfo,
+ nodeSub,
+ subModelInfo,
+ subsubName,
+ dir_name,
+ subtransInfo,
+ subInbuiltModelDict
+ )
+ # print "modelicaSubCompInit------------>",modelicaSubCompInit
+ # print "numNodesSubsub---------------------->",numNodesSubsub
modelicaSubParamNew = self.getSubParamLine(
- eachsub, numNodesSub, modelicaSubParam, dir_name) # Ask Manas
- #print "modelicaSubParamNew----------------->",modelicaSubParamNew
+ eachsub,
+ numNodesSub,
+ modelicaSubParam,
+ dir_name) # Ask Manas
+ # print "modelicaSubParamNew------------>",modelicaSubParamNew
connSubInfo = self.connectInfo(
- subSchemInfo, nodeSub, nodeDicSub, numNodesSubsub, subcktName)
- #print "connSubInfo----------------->",connSubInfo
+ subSchemInfo,
+ nodeSub,
+ nodeDicSub,
+ numNodesSubsub,
+ subcktName
+ )
+ # print "connSubInfo----------------->",connSubInfo
newname = basename.split('.')
newfilename = newname[0]
outfilename = newfilename + ".mo"
@@ -1063,8 +1241,22 @@ class NgMoConverter:
out.writelines('\n')
out.close()
- return data, subOptionInfo, subSchemInfo, subModel, subModelInfo, subsubName, \
- subParamInfo, modelicaSubCompInit, modelicaSubParam, nodeSubInterface, nodeSub, nodeDicSub, pinInitSub, connSubInfo
+ return (
+ data,
+ subOptionInfo,
+ subSchemInfo,
+ subModel,
+ subModelInfo,
+ subsubName,
+ subParamInfo,
+ modelicaSubCompInit,
+ modelicaSubParam,
+ nodeSubInterface,
+ nodeSub,
+ nodeDicSub,
+ pinInitSub,
+ connSubInfo
+ )
def main(args):
@@ -1080,7 +1272,7 @@ def main(args):
sys.exit()
dir_name = os.path.dirname(os.path.realpath(filename))
- file_basename = os.path.basename(filename)
+ # file_basename = os.path.basename(filename)
cwd = os.getcwd()
os.chdir(dir_name)
@@ -1089,26 +1281,30 @@ def main(args):
# Getting all the require information
lines = obj_NgMoConverter.readNetlist(filename)
- #print "Complete Lines of Ngspice netlist :lines ---------------->",lines
+ # print "Complete Lines of Ngspice netlist :lines ---------------->",lines
optionInfo, schematicInfo = obj_NgMoConverter.separateNetlistInfo(lines)
- #print "All option details like analysis,subckt,.ic,.model : OptionInfo------------------->",optionInfo
- #print "Schematic connection info :schematicInfo",schematicInfo
- modelName, modelInfo, subcktName, paramInfo, transInfo, inbuiltModelDict = obj_NgMoConverter.addModel(
- optionInfo)
- #print "Name of Model : modelName-------------------->",modelName
- #print "Model Information :modelInfo--------------------->",modelInfo
- #print "Subcircuit Name :subcktName------------------------>",subcktName
- #print "Parameter Information :paramInfo---------------------->",paramInfo
- #print "InBuilt Model ---------------------->",inbuiltModelDict
+ # print "All option details like analysis,subckt,.ic,.model :
+ # OptionInfo------------------->",optionInfo
+ # print "Schematic connection info :schematicInfo",schematicInfo
+ modelName, modelInfo, subcktName, paramInfo, transInfo,\
+ inbuiltModelDict = (
+ obj_NgMoConverter.addModel(optionInfo)
+ )
+ # print "Name of Model : modelName-------------------->",modelName
+ # print "Model Information :modelInfo--------------------->",modelInfo
+ # print "Subcircuit Name :subcktName------------------------>",subcktName
+ # print "Parameter Information :paramInfo---------------------->",paramInfo
+ # print "InBuilt Model ---------------------->",inbuiltModelDict
modelicaParamInit = obj_NgMoConverter.processParam(paramInfo)
- #print "Make modelicaParamInit from paramInfo : processParamInit------------->",modelicaParamInit
+ # print "Make modelicaParamInit from paramInfo
+ # : processParamInit------------->",modelicaParamInit
compInfo, plotInfo = obj_NgMoConverter.separatePlot(schematicInfo)
- #print "Plot info like plot,print etc :plotInfo",plotInfo
+ # print "Plot info like plot,print etc :plotInfo",plotInfo
IfMOS = '0'
for eachline in compInfo:
- words = eachline.split()
+ # words = eachline.split()
if eachline[0] == 'm':
IfMOS = '1'
break
@@ -1116,44 +1312,61 @@ def main(args):
subOptionInfo = []
subSchemInfo = []
if len(subcktName) > 0:
- #subOptionInfo = []
- #subSchemInfo = []
+ # subOptionInfo = []
+ # subSchemInfo = []
for eachsub in subcktName:
filename_temp = eachsub + '.sub'
data = obj_NgMoConverter.readNetlist(filename_temp)
- #print "Data---------->",data
- subOptionInfo, subSchemInfo = obj_NgMoConverter.separateNetlistInfo(
- data)
+ # print "Data---------->",data
+ subOptionInfo, subSchemInfo = (
+ obj_NgMoConverter.separateNetlistInfo(data)
+ )
for eachline in subSchemInfo:
- words = eachline.split()
+ # words = eachline.split()
if eachline[0] == 'm':
IfMOS = '1'
break
- #print "Subcircuit OptionInfo : subOptionInfo------------------->",subOptionInfo
- #print "Subcircuit Schematic Info :subSchemInfo-------------------->",subSchemInfo
+ # print "Subcircuit OptionInfo
+ # : subOptionInfo------------------->",subOptionInfo
+ # print "Subcircuit Schematic Info
+ # : subSchemInfo-------------------->",subSchemInfo
node, nodeDic, pinInit, pinProtectedInit = obj_NgMoConverter.nodeSeparate(
compInfo, '0', [], subcktName, [])
- #print "All nodes in the netlist :node---------------->",node
- #print "NodeDic which will be used for modelica : nodeDic------------->",nodeDic
- #print "PinInit-------------->",pinInit
- #print "pinProtectedInit----------->",pinProtectedInit
+ # print "All nodes in the netlist :node---------------->",node
+ # print "NodeDic which will be used for modelica
+ # : nodeDic------------->",nodeDic
+ # print "PinInit-------------->",pinInit
+ # print "pinProtectedInit----------->",pinProtectedInit
modelicaCompInit, numNodesSub = obj_NgMoConverter.compInit(
- compInfo, node, modelInfo, subcktName, dir_name, transInfo, inbuiltModelDict)
- #print "ModelicaComponents : modelicaCompInit----------->",modelicaCompInit
- #print "SubcktNumNodes : numNodesSub---------------->",numNodesSub
+ compInfo,
+ node,
+ modelInfo,
+ subcktName,
+ dir_name,
+ transInfo,
+ inbuiltModelDict
+ )
+ # print "ModelicaComponents
+ # : modelicaCompInit----------->",modelicaCompInit
+ # print "SubcktNumNodes
+ # : numNodesSub---------------->",numNodesSub
connInfo = obj_NgMoConverter.connectInfo(
compInfo, node, nodeDic, numNodesSub, subcktName)
- #print "ConnInfo------------------>",connInfo
+ # print "ConnInfo------------------>",connInfo
# After Sub Ckt Func
if len(subcktName) > 0:
- data, subOptionInfo, subSchemInfo, subModel, subModelInfo, subsubName, subParamInfo, modelicaSubCompInit, modelicaSubParam,\
- nodeSubInterface, nodeSub, nodeDicSub, pinInitSub, connSubInfo = obj_NgMoConverter.procesSubckt(
- subcktName, numNodesSub, dir_name) # Adding 'numNodesSub' by Fahim
+ data, subOptionInfo, subSchemInfo, subModel, subModelInfo,\
+ subsubName, subParamInfo, modelicaSubCompInit, modelicaSubParam,\
+ nodeSubInterface, nodeSub, nodeDicSub, pinInitSub, connSubInfo = (
+ obj_NgMoConverter.procesSubckt(
+ subcktName, numNodesSub, dir_name
+ )
+ ) # Adding 'numNodesSub' by Fahim
# Creating Final Output file
newfile = filename.split('.')
@@ -1166,7 +1379,7 @@ def main(args):
out.writelines('import Modelica.Electrical.*;')
elif IfMOS == '1':
out.writelines('import BondLib.Electrical.*;')
- #out.writelines('import Modelica.Electrical.*;')
+ # out.writelines('import Modelica.Electrical.*;')
out.writelines('\n')
for eachline in modelicaParamInit:
diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py
index 2fc17615..2eaef643 100644
--- a/src/projManagement/Kicad.py
+++ b/src/projManagement/Kicad.py
@@ -1,4 +1,4 @@
-#=========================================================================
+# =========================================================================
#
# FILE: openKicad.py
#
@@ -14,7 +14,7 @@
# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
# CREATED: Tuesday 17 Feb 2015
# REVISION: ---
-#=========================================================================
+# =========================================================================
import os
from . import Validation
@@ -25,7 +25,8 @@ from PyQt4 import QtGui
class Kicad:
"""
- This class called the Kicad Schematic,KicadtoNgspice Converter,Layout editor and Footprint Editor
+ This class called the Kicad Schematic,KicadtoNgspice Converter,Layout
+ editor and Footprint Editor
"""
def __init__(self, dockarea):
@@ -47,7 +48,7 @@ class Kicad:
# 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)
@@ -59,13 +60,16 @@ class Kicad:
else:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage(
- 'Please select the project first. You can either create new project or open existing project')
+ 'Please select the project first. You can either create'
+ + 'new project or open existing project')
self.obj_appconfig.print_warning(
- 'Please select the project first. You can either create new project or open existing project')
+ 'Please select the project first. You can either create'
+ + 'new project or open existing project')
self.msg.setWindowTitle("Error Message")
'''
- #Commenting as it is no longer needed as PBC and Layout will open from eeschema
+ # Commenting as it is no longer needed as PBC and Layout will open from
+ # eeschema
def openFootprint(self):
"""
This function create command to open Footprint editor
@@ -73,7 +77,8 @@ class Kicad:
print "Kicad Foot print Editor called"
self.projDir = self.obj_appconfig.current_project["ProjectName"]
try:
- self.obj_appconfig.print_info('Kicad Footprint Editor is called for project : ' + self.projDir)
+ self.obj_appconfig.print_info('Kicad Footprint Editor is called'
+ + 'for project : ' + self.projDir)
except:
pass
#Validating if current project is available or not
@@ -90,8 +95,11 @@ class Kicad:
else:
self.msg = QtGui.QErrorMessage(None)
- self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
- self.obj_appconfig.print_warning('Please select the project first. You can either create new project or open existing project')
+ self.msg.showMessage('Please select the project first. You can'
+ + 'either create new project or open existing project')
+ self.obj_appconfig.print_warning('Please select the project'
+ + 'first. You can either create new project or open existing'
+ + 'project')
self.msg.setWindowTitle("Error Message")
def openLayout(self):
@@ -101,7 +109,8 @@ class Kicad:
print "Kicad Layout is called"
self.projDir = self.obj_appconfig.current_project["ProjectName"]
try:
- self.obj_appconfig.print_info('PCB Layout is called for project : ' + self.projDir)
+ self.obj_appconfig.print_info('PCB Layout is called for project : '
+ + self.projDir)
except:
pass
#Validating if current project is available or not
@@ -117,8 +126,11 @@ class Kicad:
else:
self.msg = QtGui.QErrorMessage(None)
- self.msg.showMessage('Please select the project first. You can either create new project or open existing project')
- self.obj_appconfig.print_warning('Please select the project first. You can either create new project or open existing project')
+ self.msg.showMessage('Please select the project first. You can'
+ + 'either create new project or open existing project')
+ self.obj_appconfig.print_warning('Please select the project'
+ + 'first. You can either create new project or open existing'
+ + 'project')
self.msg.setWindowTitle("Error Message")
'''
@@ -145,7 +157,8 @@ class Kicad:
# Creating a command to run
"""
- self.cmd = "python ../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()
"""
@@ -155,15 +168,19 @@ class Kicad:
else:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage(
- 'The project does not contain any Kicad netlist file for conversion.')
+ 'The project does not contain any Kicad netlist file for'
+ + 'conversion.')
self.obj_appconfig.print_error(
- 'The project does not contain any Kicad netlist file for conversion.')
+ 'The project does not contain any Kicad netlist file for'
+ + 'conversion.')
self.msg.setWindowTitle("Error Message")
else:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage(
- 'Please select the project first. You can either create new project or open existing project')
+ 'Please select the project first. You can either create'
+ + 'new project or open existing project')
self.obj_appconfig.print_warning(
- 'Please select the project first. You can either create new project or open existing project')
+ 'Please select the project first. You can either create'
+ + 'new project or open existing project')
self.msg.setWindowTitle("Error Message")
diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py
index 38d45495..11cdcaf9 100644
--- a/src/projManagement/Validation.py
+++ b/src/projManagement/Validation.py
@@ -1,11 +1,12 @@
-#=========================================================================
+# =========================================================================
#
# FILE: Validation.py
#
# USAGE: ---
#
-# DESCRIPTION: This module is use to create validation for openProject,newProject and other activity.
+# DESCRIPTION: This module is use to create validation for openProject,
+# newProject and other activity.
#
# OPTIONS: ---
# REQUIREMENTS: ---
@@ -15,7 +16,7 @@
# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
# CREATED: Wednesday 12 February 2015
# REVISION: ---
-#=========================================================================
+# =========================================================================
import os
import re
import distutils.spawn
diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py
index fe884ef3..65c67dde 100644
--- a/src/projManagement/Worker.py
+++ b/src/projManagement/Worker.py
@@ -1,4 +1,4 @@
-#=========================================================================
+# =========================================================================
#
# FILE: WorkerThread.py
#
@@ -14,7 +14,7 @@
# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
# CREATED: Tuesday 24 Feb 2015
# REVISION: ---
-#=========================================================================
+# =========================================================================
from PyQt4 import QtCore
import subprocess
from configuration.Appconfig import Appconfig
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index f01d2f53..40d66003 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -1,5 +1,5 @@
-#=========================================================================
+# =========================================================================
#
# FILE: newProject.py
#
@@ -15,7 +15,7 @@
# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
# CREATED: Wednesday 12 February 2015
# REVISION: ---
-#=========================================================================
+# =========================================================================
from PyQt4 import QtGui
from .Validation import Validation
from configuration.Appconfig import Appconfig
@@ -37,10 +37,10 @@ class NewProjectInfo(QtGui.QWidget):
"""
This function create Project related directories and files
"""
- #print "Create Project Called"
+ # print "Create Project Called"
self.projName = projName
self.workspace = self.obj_appconfig.default_workspace['workspace']
- #self.projName = self.projEdit.text()
+ # self.projName = self.projEdit.text()
# Remove leading and trailing space
self.projName = str(self.projName).rstrip().lstrip()
@@ -62,18 +62,19 @@ class NewProjectInfo(QtGui.QWidget):
self.projDir, self.projName + ".proj")
f = open(self.projFile, "w")
except BaseException:
- #print "Some Thing Went 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)
+ 'Unable to create project. Please make sure you have'
+ + 'write permission on '
+ + self.workspace)
self.msg.setWindowTitle("Error Message")
f.write("schematicFile " + self.projName + ".sch\n")
f.close()
# Now Change the current working project
newprojlist = []
- #self.obj_appconfig = Appconfig()
+ # self.obj_appconfig = Appconfig()
self.obj_appconfig.current_project['ProjectName'] = self.projDir
newprojlist.append(self.projName + '.proj')
self.obj_appconfig.project_explorer[self.projDir] = newprojlist
@@ -89,23 +90,24 @@ class NewProjectInfo(QtGui.QWidget):
return self.projDir, newprojlist
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')
+ '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 "Empty 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/openProject.py b/src/projManagement/openProject.py
index 58a6be0a..6cdcbb38 100644
--- a/src/projManagement/openProject.py
+++ b/src/projManagement/openProject.py
@@ -1,5 +1,5 @@
-#=========================================================================
+# =========================================================================
#
# FILE: openProject.py
#
@@ -15,7 +15,7 @@
# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
# CREATED: Wednesday 12 February 2015
# REVISION: ---
-#=========================================================================
+# =========================================================================
from PyQt4 import QtGui
from .Validation import Validation
@@ -39,7 +39,7 @@ class OpenProjectInfo(QtGui.QWidget):
self.projDir = QtGui.QFileDialog.getExistingDirectory(
self, "open", self.openDir)
- if self.obj_validation.validateOpenproj(self.projDir) == True:
+ if self.obj_validation.validateOpenproj(self.projDir):
self.obj_Appconfig.current_project['ProjectName'] = str(
self.projDir)
if os.path.isdir(self.projDir):
@@ -47,8 +47,10 @@ class OpenProjectInfo(QtGui.QWidget):
for dirs, subdirs, filelist in os.walk(
self.obj_Appconfig.current_project["ProjectName"]):
- directory = dirs
- files = filelist
+ # directory = dirs
+ # files = filelist
+ # above 'directory' and 'files' variable never used
+ pass
self.obj_Appconfig.project_explorer[dirs] = filelist
json.dump(
self.obj_Appconfig.project_explorer, open(
@@ -59,9 +61,15 @@ class OpenProjectInfo(QtGui.QWidget):
else:
self.obj_Appconfig.print_error(
- "The project doesn't contain .proj file. Please select the proper directory else you won't be able to perform any operation")
- 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)
+ "The project doesn't contain .proj file. Please select the"
+ + "proper directory else you won't be able to perform any"
+ + "operation")
+ 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:
self.body()
diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py
index 23e6d52b..31ae3022 100644
--- a/src/subcircuit/convertSub.py
+++ b/src/subcircuit/convertSub.py
@@ -25,7 +25,7 @@ class convertSub(QtGui.QWidget):
if self.obj_validation.validateKicad(self.projDir):
# Checking 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)
@@ -35,10 +35,12 @@ class convertSub(QtGui.QWidget):
else:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage(
- 'The subcircuit does not contain any Kicad netlist file for conversion.')
+ 'The subcircuit does not contain any Kicad netlist\
+ file for conversion.')
self.msg.setWindowTitle("Error Message")
else:
self.msg = QtGui.QErrorMessage(None)
self.msg.showMessage(
- 'Please select the subcircuit first. You can either create new subcircuit or open existing subcircuit')
+ 'Please select the subcircuit first. You can either create \
+ new subcircuit or open existing subcircuit')
self.msg.setWindowTitle("Error Message")
diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py
index 6e0c7e63..79080e55 100644
--- a/src/subcircuit/newSub.py
+++ b/src/subcircuit/newSub.py
@@ -1,4 +1,4 @@
-from PyQt4 import QtGui, QtCore
+from PyQt4 import QtGui, QtCore # noqa
from projManagement.Validation import Validation
from configuration.Appconfig import Appconfig
from projManagement import Worker
@@ -46,26 +46,29 @@ class NewSub(QtGui.QWidget):
self.obj_workThread.start()
self.close()
except BaseException:
- #print "Some Thing Went Wrong"
+ # print "Some Thing Went Wrong"
self.msg = QtGui.QErrorMessage(self)
self.msg.showMessage(
- 'Unable to create subcircuit. Please make sure you have write permission on ' +
+ 'Unable to create subcircuit. Please make sure\
+ you have write permission on ' +
self.schematic_path)
self.msg.setWindowTitle("Error Message")
- self.obj_appconfig.current_subcircuit['SubcircuitName'] = self.schematic_path
+ self.obj_appconfig.current_subcircuit['SubcircuitName'] \
+ = self.schematic_path
elif self.reply == "CHECKEXIST":
- #print "Project already exist"
+ # print "Project already exist"
self.msg = QtGui.QErrorMessage(self)
self.msg.showMessage(
'The subcircuit "' +
self.create_schematic +
- '" already exist.Please select the different name or delete existing subcircuit')
+ '" already exist.Please select the different name or delete'
+ + 'existing subcircuit')
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 subcircuit name should not contain space between them')
diff --git a/src/subcircuit/openSub.py b/src/subcircuit/openSub.py
index 32ad5d39..ba6d0617 100644
--- a/src/subcircuit/openSub.py
+++ b/src/subcircuit/openSub.py
@@ -19,7 +19,9 @@ class openSub(QtGui.QWidget):
None, "Open File", "../SubcircuitLibrary"))
if self.editfile:
self.obj_Appconfig = Appconfig()
- self.obj_Appconfig.current_subcircuit['SubcircuitName'] = self.editfile
+ self.obj_Appconfig.current_subcircuit['SubcircuitName'] = (
+ self.editfile
+ )
self.schname = os.path.basename(self.editfile)
self.editfile = os.path.join(self.editfile, self.schname)
self.cmd = "eeschema " + self.editfile + ".sch "