From 0b37af40b688ac0f68ab32fdefdf246b61dd1979 Mon Sep 17 00:00:00 2001 From: nilshah98 Date: Fri, 7 Jun 2019 12:40:35 +0530 Subject: treeWidget UI bug fixed --- src/kicadtoNgspice/DeviceModel.py | 11 +++++++---- src/kicadtoNgspice/SubcircuitTab.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src/kicadtoNgspice') diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index 57fd3f25..72d433de 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -65,6 +65,8 @@ class DeviceModel(QtGui.QWidget): print("Reading Device model details from Schematic") for eachline in schematicInfo: + print("=========================================") + print(eachline) words = eachline.split() if eachline[0] == 'q': print("Device Model Transistor: ", words[0]) @@ -82,7 +84,7 @@ class DeviceModel(QtGui.QWidget): try: for key in json_data["deviceModel"]: - if key[0] == eachline[0] and key[1] == eachline[1]: + if key[0] == words[0][0] and key[1:] == words[0][1:]: # print "DEVICE MODEL MATCHING---",child.tag[0],\ # child.tag[1],eachline[0],eachline[1] try: @@ -148,7 +150,7 @@ class DeviceModel(QtGui.QWidget): # global path_name try: for key in json_data["deviceModel"]: - if key[0] == eachline[0] and key[1] == eachline[1]: + if key[0] == words[0][0] and key[1:] == words[0][1:]: # print "DEVICE MODEL MATCHING---",child.tag[0],\ # child.tag[1],eachline[0],eachline[1] try: @@ -213,7 +215,7 @@ class DeviceModel(QtGui.QWidget): # global path_name try: for key in json_data["deviceModel"]: - if key[0] == eachline[0] and key[1] == eachline[1]: + if key[0] == words[0][0] and key[1:] == words[0][1:]: # print "DEVICE MODEL MATCHING---",child.tag[0],\ # child.tag[1],eachline[0],eachline[1] try: @@ -326,7 +328,7 @@ class DeviceModel(QtGui.QWidget): # global path_name try: for key in json_data["deviceModel"]: - if key[0] == eachline[0] and key[1] == eachline[1]: + if key[0] == words[0][0] and key[1:] == words[0][1:]: # print "DEVICE MODEL MATCHING---",child.tag[0],\ # child.tag[1],eachline[0],eachline[1] while i <= end: @@ -408,6 +410,7 @@ class DeviceModel(QtGui.QWidget): self.widgetObjCount = iter_value print("self.widgetObjCount-----", self.widgetObjCount) self.libfile = path_value + print("PATH VALUE", path_value) # print "Selected Library File :",self.libfile # Setting Library to Text Edit Line diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index 52a7a824..7b8001b1 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -73,7 +73,7 @@ class SubcircuitTab(QtGui.QWidget): global path_name try: for key in json_data["subcircuit"]: - if key[0] == eachline[0] and key[1] == eachline[1]: + if key[0] == words[0][0] and key[1:] == words[0][1:]: # print "Subcircuit MATCHING---",child.tag[0], \ # child.tag[1], eachline[0], eachline[1] try: -- cgit From 89c637c341a281d31ccd63be65a3504d6db79882 Mon Sep 17 00:00:00 2001 From: nilshah98 Date: Fri, 7 Jun 2019 19:15:54 +0530 Subject: made pep8 compliant using autopep8 tool --- src/kicadtoNgspice/KicadtoNgspice.py | 3 ++- src/kicadtoNgspice/Model.py | 4 ++-- src/kicadtoNgspice/Processing.py | 6 +++++- src/kicadtoNgspice/SubcircuitTab.py | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/kicadtoNgspice') diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index 9624fc82..19f3ffe2 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -41,6 +41,7 @@ class MainWindow(QtGui.QWidget): - clarg1 is the path to the .cir file - clarg2 is either None or "sub" depending on the analysis type """ + def __init__(self, clarg1, clarg2=None): QtGui.QWidget.__init__(self) print("==================================") @@ -107,7 +108,7 @@ class MainWindow(QtGui.QWidget): unknownModelList, multipleModelList, plotText - ) = obj_proc.convertICintoBasicBlocks( + ) = obj_proc.convertICintoBasicBlocks( schematicInfo, outputOption, modelList, plotText ) print("=======================================") diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py index eb1793f9..6647feb7 100644 --- a/src/kicadtoNgspice/Model.py +++ b/src/kicadtoNgspice/Model.py @@ -115,8 +115,8 @@ class Model(QtGui.QWidget): self.obj_trac.model_entry_var [self.nextcount].setText( str(list(json_data - ["model"][mod]["values"] - [i].values())[0])) + ["model"][mod]["values"] + [i].values())[0])) ) i = i + 1 except BaseException: diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py index ebbd3429..216383e6 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -16,6 +16,7 @@ class PrcocessNetlist: """ - Read the circuit file and return splitted lines """ + def readNetlist(self, filename): f = open(filename) data = f.read() @@ -31,6 +32,7 @@ class PrcocessNetlist: - Read Parameter information and store it into dictionary - kicadNetlis is the .cir file content """ + def readParamInfo(self, kicadNetlis): param = {} print("=========================KICADNETLIST========================") @@ -55,6 +57,7 @@ class PrcocessNetlist: - Preprocess netlist (replace parameters) - Separate infoline (first line) from the rest of netlist """ + def preprocessNetlist(self, kicadNetlis, param): netlist = [] for eachline in kicadNetlis: @@ -125,6 +128,7 @@ class PrcocessNetlist: - Then check for type whether ac, dc, sine, etc... - Handle starting with h and f as well """ + def insertSpecialSourceParam(self, schematicInfo, sourcelist): schematicInfo1 = [] print("=============================================================") @@ -462,7 +466,7 @@ class PrcocessNetlist: "a" + str(k) + " (" + words[1] + " " + words[2] + ") (interNode_" + str(interMediateNodeCount) + " " + words[3] + ") " - ) + ) modelLine += compName + "_primary" schematicInfo.append(modelLine) k = k + 1 diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index 7b8001b1..53a8eac9 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -203,4 +203,4 @@ class SubcircuitTab(QtGui.QWidget): "Please select a valid Subcircuit directory \ (Containing '.sub' file).") self.msg.setWindowTitle("Error Message") - self.msg.show() \ No newline at end of file + self.msg.show() -- cgit From 8d628dc33e1190dd1f8827bbd26f998d31d0827a Mon Sep 17 00:00:00 2001 From: nilshah98 Date: Fri, 7 Jun 2019 19:25:00 +0530 Subject: projectExplorer made pep8 compliant --- src/kicadtoNgspice/Convert.py | 2 +- src/kicadtoNgspice/DeviceModel.py | 2 +- src/kicadtoNgspice/KicadtoNgspice.py | 3 +-- src/kicadtoNgspice/Model.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/kicadtoNgspice') diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 76b6ba57..8280f9e7 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -443,7 +443,7 @@ class Convert: default = 0 # Cheking if value is iterable.its for vector if ( - type(value) is not str and + not isinstance(value, str) and hasattr(value, '__iter__') ): addmodelLine += param + "=[" diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index 72d433de..6a9ad9d9 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -339,7 +339,7 @@ class DeviceModel(QtGui.QWidget): json_data["deviceModel"][key][0]): path_name = ( json_data["deviceModel"][key][0] - ) + ) else: self.entry_var[i].setText("") i = i + 1 diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index 19f3ffe2..ef9201cb 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -484,8 +484,7 @@ class MainWindow(QtGui.QWidget): for key, value in line[7].items(): if( hasattr(value, '__iter__') and - i <= end and type(value) is not - str + i <= end and not isinstance(value, str) ): for item in value: fields = { diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py index 6647feb7..a182dd4e 100644 --- a/src/kicadtoNgspice/Model.py +++ b/src/kicadtoNgspice/Model.py @@ -62,7 +62,7 @@ class Model(QtGui.QWidget): # print "Key : ",key # print "Value : ",value # Check if value is iterable - if type(value) is not str and hasattr(value, '__iter__'): + if not isinstance(value, str) and hasattr(value, '__iter__'): # For tag having vector value temp_tag = [] for item in value: -- cgit From 1d4ee6b6c1254657c497673838922e746f339eca Mon Sep 17 00:00:00 2001 From: nilshah98 Date: Thu, 13 Jun 2019 18:52:12 +0530 Subject: model matching redundancy reduced --- src/kicadtoNgspice/DeviceModel.py | 8 ++++---- src/kicadtoNgspice/SubcircuitTab.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/kicadtoNgspice') diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index 6a9ad9d9..e1367181 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -84,7 +84,7 @@ class DeviceModel(QtGui.QWidget): try: for key in json_data["deviceModel"]: - if key[0] == words[0][0] and key[1:] == words[0][1:]: + if key == words[0]: # print "DEVICE MODEL MATCHING---",child.tag[0],\ # child.tag[1],eachline[0],eachline[1] try: @@ -150,7 +150,7 @@ class DeviceModel(QtGui.QWidget): # global path_name try: for key in json_data["deviceModel"]: - if key[0] == words[0][0] and key[1:] == words[0][1:]: + if key == words[0]: # print "DEVICE MODEL MATCHING---",child.tag[0],\ # child.tag[1],eachline[0],eachline[1] try: @@ -215,7 +215,7 @@ class DeviceModel(QtGui.QWidget): # global path_name try: for key in json_data["deviceModel"]: - if key[0] == words[0][0] and key[1:] == words[0][1:]: + if key == words[0]: # print "DEVICE MODEL MATCHING---",child.tag[0],\ # child.tag[1],eachline[0],eachline[1] try: @@ -328,7 +328,7 @@ class DeviceModel(QtGui.QWidget): # global path_name try: for key in json_data["deviceModel"]: - if key[0] == words[0][0] and key[1:] == words[0][1:]: + if key == words[0]: # print "DEVICE MODEL MATCHING---",child.tag[0],\ # child.tag[1],eachline[0],eachline[1] while i <= end: diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index 53a8eac9..d15407f7 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -73,7 +73,7 @@ class SubcircuitTab(QtGui.QWidget): global path_name try: for key in json_data["subcircuit"]: - if key[0] == words[0][0] and key[1:] == words[0][1:]: + if key == words[0]: # print "Subcircuit MATCHING---",child.tag[0], \ # child.tag[1], eachline[0], eachline[1] try: -- cgit