summaryrefslogtreecommitdiff
path: root/src/kicadtoNgspice/Analysis.py
diff options
context:
space:
mode:
authormaddy-22019-05-27 12:32:49 +0530
committernilshah982019-06-07 11:03:14 +0530
commit28d8fd378bf717e8daba8a564708856769f24b98 (patch)
treeee8cc6592c690708d5f35cb5304feeae3d014c97 /src/kicadtoNgspice/Analysis.py
parent7e7b6d372aac718f857fcad5c49faf019ff83bb4 (diff)
downloadeSim-28d8fd378bf717e8daba8a564708856769f24b98.tar.gz
eSim-28d8fd378bf717e8daba8a564708856769f24b98.tar.bz2
eSim-28d8fd378bf717e8daba8a564708856769f24b98.zip
initialise pep8 compliance, using autopep8
Diffstat (limited to 'src/kicadtoNgspice/Analysis.py')
-rw-r--r--src/kicadtoNgspice/Analysis.py364
1 files changed, 209 insertions, 155 deletions
diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py
index 6aa167d6..fde9a3e3 100644
--- a/src/kicadtoNgspice/Analysis.py
+++ b/src/kicadtoNgspice/Analysis.py
@@ -5,11 +5,13 @@ import os
#from xml.etree import ElementTree as ET
import json
+
class Analysis(QtGui.QWidget):
"""
This class create Analysis Tab in KicadtoNgspice Window.
"""
- def __init__(self,clarg1):
+
+ def __init__(self, clarg1):
self.clarg1 = clarg1
QtGui.QWidget.__init__(self)
self.track_obj = TrackWidget.TrackWidget()
@@ -22,24 +24,24 @@ class Analysis(QtGui.QWidget):
self.dc_parameter = {}
self.tran_parameter = {}
self.createAnalysisWidget()
-
+
def createAnalysisWidget(self):
self.grid = QtGui.QGridLayout()
self.grid.addWidget(self.createCheckBox(), 0, 0)
self.grid.addWidget(self.createACgroup(), 1, 0)
self.grid.addWidget(self.createDCgroup(), 2, 0)
self.grid.addWidget(self.createTRANgroup(), 3, 0)
-
+
try:
kicadFile = self.clarg1
- (projpath,filename) = os.path.split(kicadFile)
+ (projpath, filename) = os.path.split(kicadFile)
if os.path.isfile(os.path.join(projpath, 'analysis')):
print("Analysis file is present")
-
- analysisfile = open(os.path.join(projpath,'analysis'))
+
+ analysisfile = open(os.path.join(projpath, 'analysis'))
content = analysisfile.readline()
print("Content of Analysis file :", content)
- contentlist= content.split()
+ contentlist = content.split()
if contentlist[0] == '.ac':
self.checkAC.setChecked(True)
@@ -56,21 +58,21 @@ class Analysis(QtGui.QWidget):
elif contentlist[1] == 'oct':
self.Oct.setChecked(True)
self.track_obj.AC_type["ITEMS"] = "oct"
-
+
elif contentlist[0] == '.dc':
self.checkDC.setChecked(True)
self.dcbox.setDisabled(False)
self.acbox.setDisabled(True)
self.trbox.setDisabled(True)
- self.track_obj.set_CheckBox["ITEMS"] ="DC"
-
+ self.track_obj.set_CheckBox["ITEMS"] = "DC"
+
elif contentlist[0] == '.tran':
self.checkTRAN.setChecked(True)
self.trbox.setDisabled(False)
self.acbox.setDisabled(True)
self.dcbox.setDisabled(True)
self.track_obj.set_CheckBox["ITEMS"] = "TRAN"
-
+
elif contentlist[0] == '.op':
self.checkDC.setChecked(True)
self.dcbox.setDisabled(False)
@@ -79,18 +81,18 @@ class Analysis(QtGui.QWidget):
self.check.setChecked(True)
self.track_obj.set_CheckBox["ITEMS"] = "DC"
- except:
+ except BaseException:
self.checkTRAN.setChecked(True)
- self.track_obj.set_CheckBox["ITEMS"]="TRAN"
-
+ self.track_obj.set_CheckBox["ITEMS"] = "TRAN"
+
self.setLayout(self.grid)
self.show()
-
+
def createCheckBox(self):
self.checkbox = QtGui.QGroupBox()
self.checkbox.setTitle("Select Analysis Type")
self.checkgrid = QtGui.QGridLayout()
-
+
self.checkgroupbtn = QtGui.QButtonGroup()
self.checkAC = QtGui.QCheckBox("AC")
self.checkDC = QtGui.QCheckBox("DC")
@@ -101,52 +103,57 @@ class Analysis(QtGui.QWidget):
self.checkgroupbtn.addButton(self.checkTRAN)
self.checkgroupbtn.setExclusive(True)
self.checkgroupbtn.buttonClicked.connect(self.enableBox)
-
+
self.checkgrid.addWidget(self.checkAC, 0, 0)
self.checkgrid.addWidget(self.checkDC, 0, 1)
self.checkgrid.addWidget(self.checkTRAN, 0, 2)
self.checkbox.setLayout(self.checkgrid)
-
+
return self.checkbox
-
+
def enableBox(self):
if self.checkAC.isChecked():
self.acbox.setDisabled(False)
self.dcbox.setDisabled(True)
self.trbox.setDisabled(True)
self.track_obj.set_CheckBox["ITEMS"] = "AC"
-
+
elif self.checkDC.isChecked():
self.dcbox.setDisabled(False)
self.acbox.setDisabled(True)
self.trbox.setDisabled(True)
self.track_obj.set_CheckBox["ITEMS"] = "DC"
-
+
elif self.checkTRAN.isChecked():
self.trbox.setDisabled(False)
self.acbox.setDisabled(True)
self.dcbox.setDisabled(True)
self.track_obj.set_CheckBox["ITEMS"] = "TRAN"
-
+
def createACgroup(self):
kicadFile = self.clarg1
- (projpath,filename) = os.path.split(kicadFile)
+ (projpath, filename) = os.path.split(kicadFile)
project_name = os.path.basename(projpath)
check = 1
try:
- f = open(os.path.join(projpath,project_name+"_Previous_Values.json"),'r')
+ f = open(
+ os.path.join(
+ projpath,
+ project_name +
+ "_Previous_Values.json"),
+ 'r')
data = f.read()
json_data = json.loads(data)
- except:
+ except BaseException:
check = 0
print("AC Previous Values JSON is Empty")
-
+
self.acbox = QtGui.QGroupBox()
self.acbox.setTitle("AC Analysis")
self.acbox.setDisabled(True)
self.acgrid = QtGui.QGridLayout()
- self.radiobuttongroup= QtGui.QButtonGroup()
+ self.radiobuttongroup = QtGui.QButtonGroup()
self.Lin = QtGui.QRadioButton("Lin")
self.Dec = QtGui.QRadioButton("Dec")
self.Oct = QtGui.QRadioButton("Oct")
@@ -155,13 +162,13 @@ class Analysis(QtGui.QWidget):
self.radiobuttongroup.addButton(self.Oct)
self.radiobuttongroup.setExclusive(True)
self.Lin.setChecked(True)
- self.track_obj.AC_type["ITEMS"]="lin"
+ self.track_obj.AC_type["ITEMS"] = "lin"
self.radiobuttongroup.buttonClicked.connect(self.set_ac_type)
self.acgrid.addWidget(self.Lin, 1, 1)
self.acgrid.addWidget(self.Dec, 1, 2)
self.acgrid.addWidget(self.Oct, 1, 3)
self.acbox.setLayout(self.acgrid)
-
+
self.scale = QtGui.QLabel("Scale")
self.start_fre_lable = QtGui.QLabel("Start Frequency")
self.stop_fre_lable = QtGui.QLabel("Stop Frequency")
@@ -170,20 +177,20 @@ class Analysis(QtGui.QWidget):
self.acgrid.addWidget(self.start_fre_lable, 2, 0)
self.acgrid.addWidget(self.stop_fre_lable, 3, 0)
self.acgrid.addWidget(self.no_of_points, 4, 0)
-
+
self.count = 0
- self.ac_entry_var[self.count] = QtGui.QLineEdit()#start
+ self.ac_entry_var[self.count] = QtGui.QLineEdit() # start
self.acgrid.addWidget(self.ac_entry_var[self.count], 2, 1)
self.ac_entry_var[self.count].setMaximumWidth(150)
- self.count = self.count+1
- self.ac_entry_var[self.count] = QtGui.QLineEdit()#stop
+ self.count = self.count + 1
+ self.ac_entry_var[self.count] = QtGui.QLineEdit() # stop
self.acgrid.addWidget(self.ac_entry_var[self.count], 3, 1)
self.ac_entry_var[self.count].setMaximumWidth(150)
- self.count = self.count+1
- self.ac_entry_var[self.count] = QtGui.QLineEdit()#no of pts
+ self.count = self.count + 1
+ self.ac_entry_var[self.count] = QtGui.QLineEdit() # no of pts
self.acgrid.addWidget(self.ac_entry_var[self.count], 4, 1)
self.ac_entry_var[self.count].setMaximumWidth(150)
-
+
self.parameter_cnt = 0
self.start_fre_combo = QtGui.QComboBox()
self.start_fre_combo.addItem("Hz",)
@@ -196,12 +203,13 @@ class Analysis(QtGui.QWidget):
self.ac_parameter[0] = "Hz"
try:
- self.ac_parameter[self.parameter_cnt] = str(json_data["analysis"]["ac"]["Start Fre Combo"])
- except:
+ self.ac_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["ac"]["Start Fre Combo"])
+ except BaseException:
self.ac_parameter[self.parameter_cnt] = "Hz"
self.start_fre_combo.activated[str].connect(self.start_combovalue)
-
+
self.parameter_cnt = self.parameter_cnt + 1
self.stop_fre_combo = QtGui.QComboBox()
self.stop_fre_combo.addItem("Hz")
@@ -214,16 +222,17 @@ class Analysis(QtGui.QWidget):
self.ac_parameter[1] = "Hz"
try:
- self.ac_parameter[self.parameter_cnt] = str(json_data["analysis"]["ac"]["Stop Fre Combo"])
- except:
+ self.ac_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["ac"]["Stop Fre Combo"])
+ except BaseException:
self.ac_parameter[self.parameter_cnt] = "Hz"
self.stop_fre_combo.activated[str].connect(self.stop_combovalue)
-
+
self.track_obj.AC_entry_var["ITEMS"] = self.ac_entry_var
self.track_obj.AC_Parameter["ITEMS"] = self.ac_parameter
-
- #CSS
+
+ # CSS
self.acbox.setStyleSheet(" \
QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \
QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; } \
@@ -245,48 +254,58 @@ class Analysis(QtGui.QWidget):
else:
pass
- self.ac_entry_var[0].setText(json_data["analysis"]["ac"]["Start Frequency"])
- self.ac_entry_var[1].setText(json_data["analysis"]["ac"]["Stop Frequency"])
- self.ac_entry_var[2].setText(json_data["analysis"]["ac"]["No. of points"])
- index = self.start_fre_combo.findText(json_data["analysis"]["ac"]["Start Fre Combo"])
+ self.ac_entry_var[0].setText(
+ json_data["analysis"]["ac"]["Start Frequency"])
+ self.ac_entry_var[1].setText(
+ json_data["analysis"]["ac"]["Stop Frequency"])
+ self.ac_entry_var[2].setText(
+ json_data["analysis"]["ac"]["No. of points"])
+ index = self.start_fre_combo.findText(
+ json_data["analysis"]["ac"]["Start Fre Combo"])
self.start_fre_combo.setCurrentIndex(index)
- index = self.stop_fre_combo.findText(json_data["analysis"]["ac"]["Stop Fre Combo"])
+ index = self.stop_fre_combo.findText(
+ json_data["analysis"]["ac"]["Stop Fre Combo"])
self.stop_fre_combo.setCurrentIndex(index)
- except:
+ except BaseException:
print("AC Analysis JSON Parse Error")
-
+
return self.acbox
-
+
def start_combovalue(self, text):
self.ac_parameter[0] = str(text)
-
+
def stop_combovalue(self, text):
self.ac_parameter[1] = str(text)
-
+
def set_ac_type(self):
self.parameter_cnt = 0
if self.Lin.isChecked():
self.track_obj.AC_type["ITEMS"] = "lin"
elif self.Dec.isChecked():
- self.track_obj.AC_type["ITEMS"] = "dec"
+ self.track_obj.AC_type["ITEMS"] = "dec"
elif self.Oct.isChecked():
self.track_obj.AC_type["ITEMS"] = "oct"
else:
- pass
-
+ pass
+
def createDCgroup(self):
kicadFile = self.clarg1
- (projpath,filename) = os.path.split(kicadFile)
+ (projpath, filename) = os.path.split(kicadFile)
project_name = os.path.basename(projpath)
check = 1
try:
- f = open(os.path.join(projpath,project_name+"_Previous_Values.json"),'r')
+ f = open(
+ os.path.join(
+ projpath,
+ project_name +
+ "_Previous_Values.json"),
+ 'r')
data = f.read()
json_data = json.loads(data)
- except:
+ except BaseException:
check = 0
print("DC Previous Values JSON is empty")
@@ -295,16 +314,16 @@ class Analysis(QtGui.QWidget):
self.dcbox.setDisabled(True)
self.dcgrid = QtGui.QGridLayout()
self.dcbox.setLayout(self.dcgrid)
-
+
self.source_name = QtGui.QLabel('Enter Source 1', self)
self.source_name.setMaximumWidth(150)
self.start = QtGui.QLabel('Start', self)
self.start.setMaximumWidth(150)
self.increment = QtGui.QLabel('Increment', self)
self.increment.setMaximumWidth(150)
- self.stop = QtGui.QLabel('Stop',self)
+ self.stop = QtGui.QLabel('Stop', self)
self.stop.setMaximumWidth(150)
-
+
self.source_name2 = QtGui.QLabel('Enter Source 2', self)
self.source_name2.setMaximumWidth(150)
self.start2 = QtGui.QLabel('Start', self)
@@ -313,55 +332,55 @@ class Analysis(QtGui.QWidget):
self.increment2.setMaximumWidth(150)
self.stop2 = QtGui.QLabel('Stop', self)
self.stop2.setMaximumWidth(150)
-
- self.dcgrid.addWidget(self.source_name, 1, 0)
+
+ self.dcgrid.addWidget(self.source_name, 1, 0)
self.dcgrid.addWidget(self.start, 2, 0)
self.dcgrid.addWidget(self.increment, 3, 0)
- self.dcgrid.addWidget(self.stop, 4, 0)
+ self.dcgrid.addWidget(self.stop, 4, 0)
- self.dcgrid.addWidget(self.source_name2, 5, 0)
+ self.dcgrid.addWidget(self.source_name2, 5, 0)
self.dcgrid.addWidget(self.start2, 6, 0)
self.dcgrid.addWidget(self.increment2, 7, 0)
self.dcgrid.addWidget(self.stop2, 8, 0)
-
+
self.count = 0
- self.dc_entry_var[self.count] = QtGui.QLineEdit()#source
+ self.dc_entry_var[self.count] = QtGui.QLineEdit() # source
self.dcgrid.addWidget(self.dc_entry_var[self.count], 1, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit()#start
+ self.dc_entry_var[self.count] = QtGui.QLineEdit() # start
self.dcgrid.addWidget(self.dc_entry_var[self.count], 2, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit()#increment
+ self.dc_entry_var[self.count] = QtGui.QLineEdit() # increment
self.dcgrid.addWidget(self.dc_entry_var[self.count], 3, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit()#stop
+ self.dc_entry_var[self.count] = QtGui.QLineEdit() # stop
self.dcgrid.addWidget(self.dc_entry_var[self.count], 4, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit()#source
+ self.dc_entry_var[self.count] = QtGui.QLineEdit() # source
self.dcgrid.addWidget(self.dc_entry_var[self.count], 5, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit()#start
+ self.dc_entry_var[self.count] = QtGui.QLineEdit() # start
self.dcgrid.addWidget(self.dc_entry_var[self.count], 6, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit()#increment
+ self.dc_entry_var[self.count] = QtGui.QLineEdit() # increment
self.dcgrid.addWidget(self.dc_entry_var[self.count], 7, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
self.count += 1
- self.dc_entry_var[self.count] = QtGui.QLineEdit()#stop
+ self.dc_entry_var[self.count] = QtGui.QLineEdit() # stop
self.dcgrid.addWidget(self.dc_entry_var[self.count], 8, 1)
self.dc_entry_var[self.count].setMaximumWidth(150)
@@ -376,14 +395,15 @@ class Analysis(QtGui.QWidget):
self.dcgrid.addWidget(self.start_combo, 2, 2)
try:
- self.dc_parameter[self.parameter_cnt] = str(json_data["analysis"]["dc"]["Start Combo"])
- except:
+ self.dc_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["dc"]["Start Combo"])
+ except BaseException:
self.dc_parameter[self.parameter_cnt] = "Volts or Amperes"
self.start_combo.activated[str].connect(self.start_changecombo)
self.parameter_cnt += 1
-
- self.increment_combo=QtGui.QComboBox(self)
+
+ self.increment_combo = QtGui.QComboBox(self)
self.increment_combo.setMaximumWidth(150)
self.increment_combo.addItem("Volts or Amperes")
self.increment_combo.addItem("mV or mA")
@@ -393,30 +413,32 @@ class Analysis(QtGui.QWidget):
self.dcgrid.addWidget(self.increment_combo, 3, 2)
try:
- self.dc_parameter[self.parameter_cnt] = str(json_data["analysis"]["dc"]["Increment Combo"])
- except:
+ self.dc_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["dc"]["Increment Combo"])
+ except BaseException:
self.dc_parameter[self.parameter_cnt] = "Volts or Amperes"
self.increment_combo.activated[str].connect(self.increment_changecombo)
self.parameter_cnt += 1
-
+
self.stop_combo = QtGui.QComboBox(self)
self.stop_combo.setMaximumWidth(150)
self.stop_combo.addItem("Volts or Amperes")
self.stop_combo.addItem("mV or mA")
self.stop_combo.addItem("uV or uA")
self.stop_combo.addItem("nV or nA")
- self.stop_combo.addItem("pV or pA")
+ self.stop_combo.addItem("pV or pA")
self.dcgrid.addWidget(self.stop_combo, 4, 2)
try:
- self.dc_parameter[self.parameter_cnt] = str(json_data["analysis"]["dc"]["Stop Combo"])
- except:
+ self.dc_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["dc"]["Stop Combo"])
+ except BaseException:
self.dc_parameter[self.parameter_cnt] = "Volts or Amperes"
self.stop_combo.activated[str].connect(self.stop_changecombo)
self.parameter_cnt += 1
-
+
self.start_combo2 = QtGui.QComboBox(self)
self.start_combo2.setMaximumWidth(150)
self.start_combo2.addItem('Volts or Amperes')
@@ -427,8 +449,9 @@ class Analysis(QtGui.QWidget):
self.dcgrid.addWidget(self.start_combo2, 6, 2)
try:
- self.dc_parameter[self.parameter_cnt] = str(json_data["analysis"]["dc"]["Start Combo2"])
- except:
+ self.dc_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["dc"]["Start Combo2"])
+ except BaseException:
self.dc_parameter[self.parameter_cnt] = "Volts or Amperes"
self.start_combo2.activated[str].connect(self.start_changecombo2)
@@ -444,11 +467,13 @@ class Analysis(QtGui.QWidget):
self.dcgrid.addWidget(self.increment_combo2, 7, 2)
try:
- self.dc_parameter[self.parameter_cnt] = str(json_data["analysis"]["dc"]["Increment Combo2"])
- except:
+ self.dc_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["dc"]["Increment Combo2"])
+ except BaseException:
self.dc_parameter[self.parameter_cnt] = "Volts or Amperes"
- self.increment_combo2.activated[str].connect(self.increment_changecombo2)
+ self.increment_combo2.activated[str].connect(
+ self.increment_changecombo2)
self.parameter_cnt += 1
self.stop_combo2 = QtGui.QComboBox(self)
@@ -461,73 +486,89 @@ class Analysis(QtGui.QWidget):
self.dcgrid.addWidget(self.stop_combo2, 8, 2)
try:
- self.dc_parameter[self.parameter_cnt] = str(json_data["analysis"]["dc"]["Stop Combo2"])
- except:
+ self.dc_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["dc"]["Stop Combo2"])
+ except BaseException:
self.dc_parameter[self.parameter_cnt] = "Volts or Amperes"
self.stop_combo2.activated[str].connect(self.stop_changecombo2)
self.parameter_cnt += 1
- self.check = QtGui.QCheckBox('Operating Point Analysis',self)
+ self.check = QtGui.QCheckBox('Operating Point Analysis', self)
try:
- self.track_obj.op_check.append(str(json_data["analysis"]["dc"]["Operating Point"]))
- except:
+ self.track_obj.op_check.append(
+ str(json_data["analysis"]["dc"]["Operating Point"]))
+ except BaseException:
self.track_obj.op_check.append('0')
-
- #QtCore.QObject.connect(check,SIGNAL("stateChanged()"),check,SLOT("checkedSlot"))
+
+ # QtCore.QObject.connect(check,SIGNAL("stateChanged()"),check,SLOT("checkedSlot"))
self.check.stateChanged.connect(self.setflag)
#self.flagcheck = 1
#self.flagcheck= 2
self.dcgrid.addWidget(self.check, 9, 1, 9, 2)
self.track_obj.DC_entry_var["ITEMS"] = self.dc_entry_var
self.track_obj.DC_Parameter["ITEMS"] = self.dc_parameter
-
- #CSS
+
+ # CSS
self.dcbox.setStyleSheet(" \
QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \
QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; } \
")
if check:
try:
- self.dc_entry_var[0].setText(json_data["analysis"]["dc"]["Source 1"])
- self.dc_entry_var[1].setText(json_data["analysis"]["dc"]["Start"])
- self.dc_entry_var[2].setText(json_data["analysis"]["dc"]["Increment"])
- self.dc_entry_var[3].setText(json_data["analysis"]["dc"]["Stop"])
- index = self.start_combo.findText(json_data["analysis"]["dc"]["Start Combo"])
+ self.dc_entry_var[0].setText(
+ json_data["analysis"]["dc"]["Source 1"])
+ self.dc_entry_var[1].setText(
+ json_data["analysis"]["dc"]["Start"])
+ self.dc_entry_var[2].setText(
+ json_data["analysis"]["dc"]["Increment"])
+ self.dc_entry_var[3].setText(
+ json_data["analysis"]["dc"]["Stop"])
+ index = self.start_combo.findText(
+ json_data["analysis"]["dc"]["Start Combo"])
self.start_combo.setCurrentIndex(index)
- index = self.increment_combo.findText(json_data["analysis"]["dc"]["Increment Combo"])
+ index = self.increment_combo.findText(
+ json_data["analysis"]["dc"]["Increment Combo"])
self.increment_combo.setCurrentIndex(index)
- index = self.stop_combo.findText(json_data["analysis"]["dc"]["Stop Combo"])
+ index = self.stop_combo.findText(
+ json_data["analysis"]["dc"]["Stop Combo"])
self.stop_combo.setCurrentIndex(index)
- self.dc_entry_var[4].setText(json_data["analysis"]["dc"]["Source 2"])
- self.dc_entry_var[5].setText(json_data["analysis"]["dc"]["Start2"])
- self.dc_entry_var[6].setText(json_data["analysis"]["dc"]["Increment2"])
- self.dc_entry_var[7].setText(json_data["analysis"]["dc"]["Stop2"])
- index = self.start_combo2.findText(json_data["analysis"]["dc"]["Start Combo2"])
+ self.dc_entry_var[4].setText(
+ json_data["analysis"]["dc"]["Source 2"])
+ self.dc_entry_var[5].setText(
+ json_data["analysis"]["dc"]["Start2"])
+ self.dc_entry_var[6].setText(
+ json_data["analysis"]["dc"]["Increment2"])
+ self.dc_entry_var[7].setText(
+ json_data["analysis"]["dc"]["Stop2"])
+ index = self.start_combo2.findText(
+ json_data["analysis"]["dc"]["Start Combo2"])
self.start_combo2.setCurrentIndex(index)
- index = self.increment_combo2.findText(json_data["analysis"]["dc"]["Increment Combo2"])
+ index = self.increment_combo2.findText(
+ json_data["analysis"]["dc"]["Increment Combo2"])
self.increment_combo2.setCurrentIndex(index)
- index = self.stop_combo2.findText(json_data["analysis"]["dc"]["Stop Combo2"])
+ index = self.stop_combo2.findText(
+ json_data["analysis"]["dc"]["Stop Combo2"])
self.stop_combo2.setCurrentIndex(index)
if json_data["analysis"]["dc"]["Operating Point"] == 1:
self.check.setChecked(True)
else:
self.check.setChecked(False)
- except:
+ except BaseException:
print("DC Analysis JSON Parse Error")
-
+
return self.dcbox
-
+
def start_changecombo(self, text):
self.dc_parameter[0] = str(text)
-
+
def increment_changecombo(self, text):
self.dc_parameter[1] = str(text)
-
+
def stop_changecombo(self, text):
self.dc_parameter[2] = str(text)
-
+
def start_changecombo2(self, text):
self.dc_parameter[3] = str(text)
@@ -535,34 +576,39 @@ class Analysis(QtGui.QWidget):
self.dc_parameter[4] = str(text)
def stop_changecombo2(self, text):
- self.dc_parameter[5] = str(text)
+ self.dc_parameter[5] = str(text)
def setflag(self):
if self.check.isChecked():
self.track_obj.op_check.append(1)
else:
- self.track_obj.op_check.append(0)
-
+ self.track_obj.op_check.append(0)
+
def createTRANgroup(self):
kicadFile = self.clarg1
- (projpath,filename) = os.path.split(kicadFile)
+ (projpath, filename) = os.path.split(kicadFile)
project_name = os.path .basename(projpath)
check = 1
try:
- f = open(os.path.join(projpath,project_name+"_Previous_Values.json"),'r')
+ f = open(
+ os.path.join(
+ projpath,
+ project_name +
+ "_Previous_Values.json"),
+ 'r')
data = f.read()
json_data = json.loads(data)
- except:
+ except BaseException:
check = 0
print("Transient Previous Values JSON is Empty")
-
+
self.trbox = QtGui.QGroupBox()
self.trbox.setTitle("Transient Analysis")
- #self.trbox.setDisabled(True)
- self.trgrid = QtGui.QGridLayout()
+ # self.trbox.setDisabled(True)
+ self.trgrid = QtGui.QGridLayout()
self.trbox.setLayout(self.trgrid)
-
+
self.start = QtGui.QLabel("Start Time")
self.step = QtGui.QLabel("Step Time")
self.stop = QtGui.QLabel("Stop Time")
@@ -570,7 +616,7 @@ class Analysis(QtGui.QWidget):
self.trgrid.addWidget(self.step, 2, 0)
self.trgrid.addWidget(self.stop, 3, 0)
self.count = 0
-
+
self.tran_entry_var[self.count] = QtGui.QLineEdit()
self.trgrid.addWidget(self.tran_entry_var[self.count], 1, 1)
self.tran_entry_var[self.count].setMaximumWidth(150)
@@ -585,7 +631,7 @@ class Analysis(QtGui.QWidget):
self.trgrid.addWidget(self.tran_entry_var[self.count], 3, 1)
self.tran_entry_var[self.count].setMaximumWidth(150)
self.count += 1
-
+
self.parameter_cnt = 0
self.start_combobox = QtGui.QComboBox()
self.start_combobox.addItem("Sec")
@@ -596,13 +642,14 @@ class Analysis(QtGui.QWidget):
self.trgrid.addWidget(self.start_combobox, 1, 3)
try:
- self.tran_parameter[self.parameter_cnt] = str(json_data["analysis"]["tran"]["Start Combo"])
- except:
+ self.tran_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["tran"]["Start Combo"])
+ except BaseException:
self.tran_parameter[self.parameter_cnt] = "Sec"
self.start_combobox.activated[str].connect(self.start_combo_change)
self.parameter_cnt += 1
-
+
self.step_combobox = QtGui.QComboBox()
self.step_combobox.addItem("Sec")
self.step_combobox.addItem("ms")
@@ -611,13 +658,14 @@ class Analysis(QtGui.QWidget):
self.step_combobox.addItem("ps")
self.trgrid.addWidget(self.step_combobox, 2, 3)
try:
- self.tran_parameter[self.parameter_cnt] = str(json_data["analysis"]["tran"]["Step Combo"])
- except:
+ self.tran_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["tran"]["Step Combo"])
+ except BaseException:
self.tran_parameter[self.parameter_cnt] = "Sec"
self.step_combobox.activated[str].connect(self.step_combo_change)
self.parameter_cnt += 1
-
+
self.stop_combobox = QtGui.QComboBox()
self.stop_combobox.addItem("Sec")
self.stop_combobox.addItem("ms")
@@ -626,43 +674,49 @@ class Analysis(QtGui.QWidget):
self.stop_combobox.addItem("ps")
self.trgrid.addWidget(self.stop_combobox, 3, 3)
try:
- self.tran_parameter[self.parameter_cnt] = str(json_data["analysis"]["tran"]["Stop Combo"])
- except:
+ self.tran_parameter[self.parameter_cnt] = str(
+ json_data["analysis"]["tran"]["Stop Combo"])
+ except BaseException:
self.tran_parameter[self.parameter_cnt] = "Sec"
self.stop_combobox.activated[str].connect(self.stop_combo_change)
self.parameter_cnt += 1
-
+
self.track_obj.TRAN_entry_var["ITEMS"] = self.tran_entry_var
self.track_obj.TRAN_Parameter["ITEMS"] = self.tran_parameter
-
- #CSS
+
+ # CSS
self.trbox.setStyleSheet(" \
QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \
QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; } \
")
if check:
try:
- self.tran_entry_var[0].setText(json_data["analysis"]["tran"]["Start Time"])
- self.tran_entry_var[1].setText(json_data["analysis"]["tran"]["Step Time"])
- self.tran_entry_var[2].setText(json_data["analysis"]["tran"]["Stop Time"])
- index = self.start_combobox.findText(json_data["analysis"]["tran"]["Start Combo"])
+ self.tran_entry_var[0].setText(
+ json_data["analysis"]["tran"]["Start Time"])
+ self.tran_entry_var[1].setText(
+ json_data["analysis"]["tran"]["Step Time"])
+ self.tran_entry_var[2].setText(
+ json_data["analysis"]["tran"]["Stop Time"])
+ index = self.start_combobox.findText(
+ json_data["analysis"]["tran"]["Start Combo"])
self.start_combobox.setCurrentIndex(index)
- index = self.step_combobox.findText(json_data["analysis"]["tran"]["Step Combo"])
+ index = self.step_combobox.findText(
+ json_data["analysis"]["tran"]["Step Combo"])
self.step_combobox.setCurrentIndex(index)
- index = self.stop_combobox.findText(json_data["analysis"]["tran"]["Stop Combo"])
+ index = self.stop_combobox.findText(
+ json_data["analysis"]["tran"]["Stop Combo"])
self.stop_combobox.setCurrentIndex(index)
- except:
+ except BaseException:
print("Transient Analysis JSON Parse Error")
+ return self.trbox
- return self.trbox
-
def start_combo_change(self, text):
self.tran_parameter[0] = str(text)
-
+
def step_combo_change(self, text):
self.tran_parameter[1] = str(text)
-
+
def stop_combo_change(self, text):
self.tran_parameter[2] = str(text)