From a0f738ba15264b69d9d51755569408bdd8e383b5 Mon Sep 17 00:00:00 2001 From: nilshah98 Date: Fri, 7 Jun 2019 18:54:35 +0530 Subject: pep8 fixes and list models bug fixed --- src/kicadtoNgspice/Analysis.py | 65 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) (limited to 'src/kicadtoNgspice/Analysis.py') diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index cde39f8f..a60a2286 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -8,7 +8,17 @@ import json class Analysis(QtGui.QWidget): """ - This class create Analysis Tab in KicadtoNgspice Window. + - This class create Analysis Tab in KicadtoNgspice Window. + - Set various track widget options here + - AC_entry_var + - AC_Parameter + - DC_entry_var + - DC_Parameter + - TRAN_entry_var + - TRAN_Parameter + - set_Checkbox + - AC_type + - op_check """ def __init__(self, clarg1): @@ -40,7 +50,9 @@ class Analysis(QtGui.QWidget): analysisfile = open(os.path.join(projpath, 'analysis')) content = analysisfile.readline() + print("=========================================================") print("Content of Analysis file :", content) + print("=========================================================") contentlist = content.split() if contentlist[0] == '.ac': @@ -88,6 +100,12 @@ class Analysis(QtGui.QWidget): self.setLayout(self.grid) self.show() + ''' + - Create the checkboxes for analysis type, under analysis tab + - checkbox > checkgrid > checkgroupbtn > checkAC | checkDC | checkTRAN + - Trigger enableBox on clicking + ''' + def createCheckBox(self): self.checkbox = QtGui.QGroupBox() self.checkbox.setTitle("Select Analysis Type") @@ -111,6 +129,11 @@ class Analysis(QtGui.QWidget): return self.checkbox + ''' + - Activate deactive analysis areas according to type + - Add analysis data to track_obj from TrackWidget + ''' + def enableBox(self): if self.checkAC.isChecked(): self.acbox.setDisabled(False) @@ -130,6 +153,14 @@ class Analysis(QtGui.QWidget): self.dcbox.setDisabled(True) self.track_obj.set_CheckBox["ITEMS"] = "TRAN" + ''' + - Designing of AC group in analysis tab + - 3 radio buttons - Lin | Dec | Oct + - 3 input boxes, with top 2 combos\ + - If previous values exist then fill default values from + previous value json file + ''' + def createACgroup(self): kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) @@ -202,12 +233,14 @@ class Analysis(QtGui.QWidget): self.acgrid.addWidget(self.start_fre_combo, 2, 2) self.ac_parameter[0] = "Hz" + # Try setting to default value from anaylsis file try: self.ac_parameter[self.parameter_cnt] = str( json_data["analysis"]["ac"]["Start Fre Combo"]) except BaseException: self.ac_parameter[self.parameter_cnt] = "Hz" + # Event listener for combo action self.start_fre_combo.activated[str].connect(self.start_combovalue) self.parameter_cnt = self.parameter_cnt + 1 @@ -274,12 +307,23 @@ class Analysis(QtGui.QWidget): return self.acbox + ''' + - Below 2 functions handle combo value event listeners for + - - start frequency for ac + - - stop frequency for ac + - And accordingly set the ac_parameters + ''' + def start_combovalue(self, text): self.ac_parameter[0] = str(text) def stop_combovalue(self, text): self.ac_parameter[1] = str(text) + ''' + - Set track object for AC, according to the type of radio box selected + ''' + def set_ac_type(self): self.parameter_cnt = 0 @@ -292,6 +336,10 @@ class Analysis(QtGui.QWidget): else: pass + ''' + - Create DC area under analysis tab + ''' + def createDCgroup(self): kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) @@ -564,6 +612,10 @@ class Analysis(QtGui.QWidget): return self.dcbox + ''' + - Below 6 functions to handle combo boxes for the DC group + ''' + def start_changecombo(self, text): self.dc_parameter[0] = str(text) @@ -582,12 +634,20 @@ class Analysis(QtGui.QWidget): def stop_changecombo2(self, text): self.dc_parameter[5] = str(text) + ''' + - Handles the Operating point analysis checkbox + ''' + def setflag(self): if self.check.isChecked(): self.track_obj.op_check.append(1) else: self.track_obj.op_check.append(0) + ''' + - Creating transient group under analysis and creating it's components + ''' + def createTRANgroup(self): kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) @@ -717,6 +777,9 @@ class Analysis(QtGui.QWidget): print("Transient Analysis JSON Parse Error") return self.trbox + ''' + - Below 3 functions handle event for the combo box in transient group + ''' def start_combo_change(self, text): self.tran_parameter[0] = str(text) -- cgit From fd8107b2f5662851dd5d3a7388e46d6be1eb5125 Mon Sep 17 00:00:00 2001 From: nilshah98 Date: Fri, 7 Jun 2019 19:01:08 +0530 Subject: kicadtoNgspice documentation added --- src/kicadtoNgspice/Analysis.py | 99 +++++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 39 deletions(-) (limited to 'src/kicadtoNgspice/Analysis.py') diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index a60a2286..c5981f4d 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -36,6 +36,14 @@ class Analysis(QtGui.QWidget): self.createAnalysisWidget() def createAnalysisWidget(self): + """ + - Create the main anaylsis widget overwiew + - - Checkbox for analysis type + - - Respective analysis type group, AC, DC, TRAN... + - Check for `analysis` file, if any in projDir, extract data from it + - Else set the default checkbox to `TRAN` + - Accordingly set state for track widget options + """ self.grid = QtGui.QGridLayout() self.grid.addWidget(self.createCheckBox(), 0, 0) self.grid.addWidget(self.createACgroup(), 1, 0) @@ -100,13 +108,12 @@ class Analysis(QtGui.QWidget): self.setLayout(self.grid) self.show() - ''' - - Create the checkboxes for analysis type, under analysis tab - - checkbox > checkgrid > checkgroupbtn > checkAC | checkDC | checkTRAN - - Trigger enableBox on clicking - ''' - def createCheckBox(self): + """ + - Create the checkboxes for analysis type, under analysis tab + - checkbox > checkgrid > checkgroupbtn > checkAC | checkDC | checkTRAN + - Trigger enableBox on clicking + """ self.checkbox = QtGui.QGroupBox() self.checkbox.setTitle("Select Analysis Type") self.checkgrid = QtGui.QGridLayout() @@ -129,12 +136,11 @@ class Analysis(QtGui.QWidget): return self.checkbox - ''' - - Activate deactive analysis areas according to type - - Add analysis data to track_obj from TrackWidget - ''' - def enableBox(self): + """ + - Activate deactive analysis areas according to type + - Add analysis data to track_obj from TrackWidget + """ if self.checkAC.isChecked(): self.acbox.setDisabled(False) self.dcbox.setDisabled(True) @@ -153,15 +159,14 @@ class Analysis(QtGui.QWidget): self.dcbox.setDisabled(True) self.track_obj.set_CheckBox["ITEMS"] = "TRAN" - ''' - - Designing of AC group in analysis tab - - 3 radio buttons - Lin | Dec | Oct - - 3 input boxes, with top 2 combos\ - - If previous values exist then fill default values from - previous value json file - ''' - def createACgroup(self): + """ + - Designing of AC group in analysis tab + - 3 radio buttons - Lin | Dec | Oct + - 3 input boxes, with top 2 combos\ + - If previous values exist then fill default values from + previous value json file + """ kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) project_name = os.path.basename(projpath) @@ -315,16 +320,25 @@ class Analysis(QtGui.QWidget): ''' def start_combovalue(self, text): + """ + - Handle start_fre_combo box event + - Check where it is Hz, MHz, etc. + - Accordingly set ac_parameter + """ self.ac_parameter[0] = str(text) def stop_combovalue(self, text): + """ + - Handle stop_fre_combo box event + - Check where it is Hz, MHz, etc. + - Accordingly set ac_parameter + """ self.ac_parameter[1] = str(text) - ''' - - Set track object for AC, according to the type of radio box selected - ''' - def set_ac_type(self): + """S + - Set track object for AC, according to the type of radio box selected + """ self.parameter_cnt = 0 if self.Lin.isChecked(): @@ -336,11 +350,17 @@ class Analysis(QtGui.QWidget): else: pass - ''' - - Create DC area under analysis tab - ''' - def createDCgroup(self): + """ + - Create DC area under analysis tab + - Source 1 and 2, each having 4 input boxes as follows + - - Source + - - Start + - - Increment + - - Stop + - The last 3 have combo box pertaining to their unit as well + - Also in the end a checkbox, for operating system point analysis + """ kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) project_name = os.path.basename(projpath) @@ -612,10 +632,7 @@ class Analysis(QtGui.QWidget): return self.dcbox - ''' - - Below 6 functions to handle combo boxes for the DC group - ''' - + # Below 6 functions to handle combo boxes for the DC group def start_changecombo(self, text): self.dc_parameter[0] = str(text) @@ -634,21 +651,25 @@ class Analysis(QtGui.QWidget): def stop_changecombo2(self, text): self.dc_parameter[5] = str(text) - ''' - - Handles the Operating point analysis checkbox - ''' - def setflag(self): + """ + - Handles the Operating point analysis checkbox + """ if self.check.isChecked(): self.track_obj.op_check.append(1) else: self.track_obj.op_check.append(0) - ''' - - Creating transient group under analysis and creating it's components - ''' - def createTRANgroup(self): + """ + - Creating transient group under analysis and creating it's components + - Contains 3 inout and combo boxes for - + - - Start time + - - Step time + - - Stop time + - Input boxes for values, combo boxes for unit + - Accordingly also event handleres for combo boxes, creates 3 functions + """ kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) project_name = os.path .basename(projpath) -- cgit