diff options
Diffstat (limited to 'src')
26 files changed, 509 insertions, 428 deletions
diff --git a/src/browser/UserManual.py b/src/browser/UserManual.py index 3bcfbace..6f09190b 100644 --- a/src/browser/UserManual.py +++ b/src/browser/UserManual.py @@ -4,7 +4,8 @@ import webbrowser class UserManual(QtGui.QWidget): """ - This class creates Welcome page of eSim. + This class opens User-Manual page in new tab of web browser + when help button is clicked. """ def __init__(self): diff --git a/src/browser/Welcome.py b/src/browser/Welcome.py index 2ae8fce1..f9f273df 100644 --- a/src/browser/Welcome.py +++ b/src/browser/Welcome.py @@ -2,10 +2,9 @@ from PyQt4 import QtGui, QtCore class Welcome(QtGui.QWidget): - """This class creates Welcome page of eSim.""" + """This class contains content of dock area part of initial esim Window.""" def __init__(self): - """Sdf.""" QtGui.QWidget.__init__(self) self.vlayout = QtGui.QVBoxLayout() diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index 0b34e3fc..38a55595 100644 --- a/src/configuration/Appconfig.py +++ b/src/configuration/Appconfig.py @@ -27,6 +27,11 @@ class Appconfig(QtGui.QWidget): """ All configuration goes here. May change in future for code optimization. + + This class also contains function for + - Printing error. + - Showing warnings. + - Dispalying information. """ # Home directory diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index c2790a80..97f895ad 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -31,15 +31,15 @@ from PyQt4.Qt import QSize import sys import os - # Its our main window of application. + + class Application(QtGui.QMainWindow): """This class initializes all objects used in this file(Application.py).""" global project_name def __init__(self, *args): """Initialize main Application window.""" - # Calling __init__ of super class QtGui.QMainWindow.__init__(self, *args) @@ -69,12 +69,11 @@ class Application(QtGui.QMainWindow): def initToolBar(self): """ In this function we are setting icons, short-cuts,and - defining functonality for:. - a)Top-tool-bar (New project, Open project, Close - project, Help option ) - b)Left-tool-bar (Open Schematic, Convert KiCad to - NgSpice, Simuation, Model Editor, Subcircuit, NGHDL, - Modelica Converter, OM Optimisation ) + defining functonality for: + + - Top-tool-bar (New project, Open project, Close project, Help option ) + - Left-tool-bar (Open Schematic, Convert KiCad to NgSpice, Simuation, + Model Editor, Subcircuit, NGHDL, Modelica Converter, OM Optimisation ) """ # Top Tool bar self.newproj = QtGui.QAction( @@ -199,16 +198,17 @@ class Application(QtGui.QMainWindow): When exit button is pressed a Message box pops out with exit message and buttons 'Yes', 'No'. - 1. If 'Yes' is pressed:. - a)it checks that program(process) in procThread_list - (list made in Appconfig.py): - a.1) if available it terminates that program - a.2) if the program(process) is not available, - it checks for it in process_obj (list made in - Appconfig.py) if found it closes the program. + 1. If 'Yes' is pressed: + - it checks that program(process) in procThread_list (list made in + Appconfig.py): + + - if available it terminates that program + - if the program(process) is not available, it checks for it + in process_obj (list made in Appconfig.py) if found it + closes the program. - 2. If 'No' is pressed: - a)the program just continues as it was doing earlier. + 2. If 'No' is pressed: + - the program just continues as it was doing earlier. ''' exit_msg = "Are you sure you want to exit the program\ ? All unsaved data will be lost." @@ -246,11 +246,13 @@ class Application(QtGui.QMainWindow): def close_project(self): """ This function first checks whether project(file) is present in list. - a)If present: - :-it first kills that process-id. - :-closes that file. - :-Shows message "Current project <path of file> is closed" - b)If not present:- pass + + - If present: + - it first kills that process-id. + - closes that file. + - Shows message "Current project <path of file> is closed" + + - If not present: pass """ print("Function : Close Project") current_project = self.obj_appconfig.current_project['ProjectName'] @@ -308,10 +310,10 @@ class Application(QtGui.QMainWindow): # This page opens usermanual in dockarea. def help_project(self): """ - 1)It prints the message ""Function : Help"" - 2)Uses print_info() method of class Appconfig - form Configuration/Appconfig.py file. - 3)Call method usermanual() from ./DockArea.py. + - It prints the message ""Function : Help"" + - Uses print_info() method of class Appconfig + from Configuration/Appconfig.py file. + - Call method usermanual() from ./DockArea.py. """ print("Function : Help") self.obj_appconfig.print_info('Help is called') @@ -324,9 +326,24 @@ class Application(QtGui.QMainWindow): if self.projDir is not None: self.obj_Mainview.obj_dockarea.ngspiceEditor(self.projDir) - time.sleep(2) # Need permanent solution - # Calling Python Plotting + currTime = time.time() + count = 0 + while True: + try: + st = os.stat(os.path.join(self.projDir, "plot_data_i.txt")) + if st.st_mtime >= currTime: + break + except Exception: + pass + time.sleep(0.2) + + # Fail Safe ===> + count += 1 + if count >= 100: + raise Exception("ngspice taking too long, check netlist file") + + # Calling Python Plotting try: self.obj_Mainview.obj_dockarea.plottingEditor() except Exception as e: @@ -348,9 +365,10 @@ class Application(QtGui.QMainWindow): """ When 'subcircuit' icon is clicked wich is present in left-tool-bar of main page: - a) Meassge shown on screen "Subcircuit editor is called". - b) 'subcircuiteditor()'' function is called using object - 'obj_dockarea' of class 'Mainview'. + + - Meassge shown on screen "Subcircuit editor is called". + - 'subcircuiteditor()' function is called using object + 'obj_dockarea' of class 'Mainview'. """ print("Function : Subcircuit editor") self.obj_appconfig.print_info('Subcircuit editor is called') @@ -361,10 +379,11 @@ class Application(QtGui.QMainWindow): """ This function uses validateTool() method from Validation.py: - a) If 'nghdl' is present in executables list then - it adds passes command 'nghdl -e' to WorkerThread class of - Worker.py. - b) If 'nghdl' not present then it shows error message. + + - If 'nghdl' is present in executables list then + it adds passes command 'nghdl -e' to WorkerThread class of + Worker.py. + - If 'nghdl' not present then it shows error message. """ print("Function : Nghdl") self.obj_appconfig.print_info('Nghdl is called') @@ -385,11 +404,12 @@ class Application(QtGui.QMainWindow): # This function opens model editor option in left-tool-bar. def open_modelEditor(self): """ - When model editor icon is clicked wich is present in + When model editor icon is clicked which is present in left-tool-bar of main page: - a) Meassge shown on screen "Model editor is called". - b) 'modeleditor()'' function is called using object - 'obj_dockarea' of class 'Mainview'. + + - Meassge shown on screen "Model editor is called". + - 'modeleditor()' function is called using object + 'obj_dockarea' of class 'Mainview'. """ print("Function : Model editor") self.obj_appconfig.print_info('Model editor is called') @@ -475,11 +495,12 @@ class Application(QtGui.QMainWindow): """ This function uses validateTool() method from Validation.py: - a) If 'OMOptim' is present in executables list then - it adds passes command 'OMOptim' to WorkerThread class of - Worker.py. - b) If 'OMOptim' not present then it shows error message with - link to download it on Linux and Windows. + + - If 'OMOptim' is present in executables list then + it adds passes command 'OMOptim' to WorkerThread class of + Worker.py. + - If 'OMOptim' not present then it shows error message with + link to download it on Linux and Windows. """ print("Function : OM Optim") self.obj_appconfig.print_info('OM Optim is called') @@ -510,12 +531,15 @@ class Application(QtGui.QMainWindow): class MainView(QtGui.QWidget): """ This class defines whole view and style of main page: - a)Position of tool bars: - :-Top tool bar. - :-Left tool bar. - b) Project explorer Area. - c) Dock area. - d)Console area. + + - Position of tool bars: + + - Top tool bar. + - Left tool bar. + + - Project explorer Area. + - Dock area. + - Console area. """ diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py index 8b8e975b..99270366 100644 --- a/src/frontEnd/DockArea.py +++ b/src/frontEnd/DockArea.py @@ -17,10 +17,21 @@ dock = {} # class DockArea(QtGui.QMainWindow): - """Sdf.""" + """ + This class contains function for designing UI of all the editors + in dock area part: + + - Test Editor. + - Model Editor. + - Python Plotting. + - NgSpice Editor. + - Kicad to NgSpice Editor. + - Subcircuit Editor. + - Modelica editor. + """ def __init__(self): - """Sdf.""" + """This act as constructor for class DockArea.""" QtGui.QMainWindow.__init__(self) self.obj_appconfig = Appconfig() @@ -43,9 +54,8 @@ class DockArea(QtGui.QMainWindow): # self.tabifyDockWidget(dock['Notes'],dock['Blank']) self.show() - # This function create widget for Library Editor def createTestEditor(self): - """Sdf.""" + """This function create widget for Library Editor.""" global count self.testWidget = QtGui.QWidget() self.testArea = QtGui.QTextEdit() @@ -71,9 +81,8 @@ class DockArea(QtGui.QMainWindow): dock['Tips-' + str(count)]) count = count + 1 - # This function create widget for interactive PythonPlotting def plottingEditor(self): - """Sdf.""" + """This function create widget for interactive PythonPlotting""" self.projDir = self.obj_appconfig.current_project["ProjectName"] self.projName = os.path.basename(self.projDir) # self.project = os.path.join(self.projDir,self.projName) @@ -102,7 +111,6 @@ class DockArea(QtGui.QMainWindow): dock['Plotting-' + str(count)]) count = count + 1 - # This function creates widget for NgSpice window. def ngspiceEditor(self, projDir): """Sdf.""" self.projDir = projDir @@ -142,9 +150,8 @@ class DockArea(QtGui.QMainWindow): dock['NgSpice-' + str(count)]) count = count + 1 - # This function defines UI for model editor. def modelEditor(self): - """Sdf.""" + """This function defines UI for model editor.""" print("in model editor") global count self.modelwidget = QtGui.QWidget() @@ -178,9 +185,8 @@ class DockArea(QtGui.QMainWindow): dock['Model Editor-' + str(count)]) count = count + 1 - # This function is creating Editor UI for Kicad to Ngspice conversion. def kicadToNgspiceEditor(self, clarg1, clarg2=None): - """Sdf.""" + """This function is creating Editor UI for Kicad to Ngspice conversion.""" global count self.kicadToNgspiceWidget = QtGui.QWidget() self.kicadToNgspiceLayout = QtGui.QVBoxLayout() @@ -211,9 +217,8 @@ class DockArea(QtGui.QMainWindow): dock['kicadToNgspice-' + str(count)]) count = count + 1 - # This function creates a widget for different subcircuit options. def subcircuiteditor(self): - """Sdf.""" + """This function creates a widget for different subcircuit options.""" global count self.subcktWidget = QtGui.QWidget() self.subcktLayout = QtGui.QVBoxLayout() @@ -243,9 +248,7 @@ class DockArea(QtGui.QMainWindow): dock['Subcircuit-' + str(count)]) count = count + 1 - # This function creates a widget for different subcircuit options. def usermanual(self): - """Sdf.""" global count self.usermanualWidget = QtGui.QWidget() self.usermanualLayout = QtGui.QVBoxLayout() @@ -272,7 +275,6 @@ class DockArea(QtGui.QMainWindow): count = count + 1 - # This function sets up the UI for ngspice to modelica conversion. def modelicaEditor(self, projDir): """Dfg.""" global count @@ -303,9 +305,11 @@ class DockArea(QtGui.QMainWindow): count = count + 1 - # This function when called closes the opened file. def closeDock(self): - """Sdf.""" + """ + This function checks for the project in **dock_dict** + and closes it. + """ self.temp = self.obj_appconfig.current_project['ProjectName'] for dockwidget in self.obj_appconfig.dock_dict[self.temp]: dockwidget.close() diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 8d0ef4ec..e1e3ddad 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -8,19 +8,20 @@ from configuration.Appconfig import Appconfig class ProjectExplorer(QtGui.QWidget): """ This class contains function: - a)One work as a constructor(__init__). - b)For saving data. - c)for renaming project. - d)for refreshing project. - e)for removing project. - f) for saving data. + + - One work as a constructor(__init__). + - For saving data. + - for renaming project. + - for refreshing project. + - for removing project. + - for saving data. """ def __init__(self): """ This method is doing following tasks: - a)Working as a constructor for class ProjectExplorer. - b)view of project explorer area. + - Working as a constructor for class ProjectExplorer. + - view of project explorer area. """ QtGui.QWidget.__init__(self) self.obj_appconfig = Appconfig() @@ -55,7 +56,7 @@ class ProjectExplorer(QtGui.QWidget): pathlist = parents.split(os.sep) parentnode = QtGui.QTreeWidgetItem( self.treewidget, [pathlist[-1], parents] - ) + ) for files in children: QtGui.QTreeWidgetItem( parentnode, [files, os.path.join(parents, files)]) @@ -172,7 +173,7 @@ class ProjectExplorer(QtGui.QWidget): def save_data(self): """ This function first opens file in write-mode, when write - operation is performed it closes that file and then window. + operation is performed it closes that file and then it closes window. """ self.fopen = open(self.filePath, 'w') self.fopen.write(self.text.toPlainText()) @@ -225,8 +226,7 @@ class ProjectExplorer(QtGui.QWidget): json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath, 'w')) - # """ - def renameProject(self): + '''def renameProject(self): indexItem = self.treewidget.currentIndex() baseFileName = str(indexItem.data()) newBaseFileName, ok = QtGui.QInputDialog.getText( @@ -273,4 +273,4 @@ class ProjectExplorer(QtGui.QWidget): self.obj_appconfig.project_explorer.items() ): self.addTreeNode(parent, children) - # """ + ''' diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index 30d0607b..55a8c95e 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -20,11 +20,18 @@ from configuration.Appconfig import Appconfig import time import os -# This class creates Workspace GUI. - +# This class creates Workspace GUI. class Workspace(QtGui.QWidget): """ + This class creates UI for WorkSpace selection window. + + This window contains text area to select location of your choice + or browse location for workspace area. + + By default workspace is set in ~/eSim-Workspace. + + This workspace area contains all the projects made by user. """ diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index c5981f4d..eaa46390 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -8,17 +8,22 @@ import json class Analysis(QtGui.QWidget): """ - - 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 + - This class create Analysis Tab in KicadtoNgspice Window. 4 sections - + - - Select Analysis Type + - - AC Analysis + - - DC Analysis + - - Transient Analysis + - Set various track widget options here, for tracking purposes across\ + different functions and modules - + - - 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): @@ -39,10 +44,11 @@ class Analysis(QtGui.QWidget): """ - Create the main anaylsis widget overwiew - - Checkbox for analysis type - - - Respective analysis type group, AC, DC, TRAN... + - - Place, `AC`, `DC` and `TRANSIENT` analysis tab + - - `self.acbox`, `self.dcbox`,`self.trbox`... - 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 + - Accordingly set state for track widget options, as `TRAN`, `AC` ... """ self.grid = QtGui.QGridLayout() self.grid.addWidget(self.createCheckBox(), 0, 0) @@ -138,7 +144,7 @@ class Analysis(QtGui.QWidget): def enableBox(self): """ - - Activate deactive analysis areas according to type + - Activate analysis areas according to checkBox marked - Add analysis data to track_obj from TrackWidget """ if self.checkAC.isChecked(): @@ -336,7 +342,7 @@ class Analysis(QtGui.QWidget): self.ac_parameter[1] = str(text) def set_ac_type(self): - """S + """ - Set track object for AC, according to the type of radio box selected """ self.parameter_cnt = 0 @@ -634,21 +640,27 @@ class Analysis(QtGui.QWidget): # Below 6 functions to handle combo boxes for the DC group def start_changecombo(self, text): + """Handle start combo box, ie. units, as mV, V...""" self.dc_parameter[0] = str(text) def increment_changecombo(self, text): + """Handle increment combo box, ie. units, as mV, V...""" self.dc_parameter[1] = str(text) def stop_changecombo(self, text): + """Handle stop combo box, ie. units, as mV, V...""" self.dc_parameter[2] = str(text) def start_changecombo2(self, text): + """Handle second start combo box, ie. units, as mV, V...""" self.dc_parameter[3] = str(text) def increment_changecombo2(self, text): + """Handle second increment combo box, ie. units, as mV, V...""" self.dc_parameter[4] = str(text) def stop_changecombo2(self, text): + """Handle second stop combo box, ie. units, as mV, V...""" self.dc_parameter[5] = str(text) def setflag(self): @@ -668,7 +680,7 @@ class Analysis(QtGui.QWidget): - - Step time - - Stop time - Input boxes for values, combo boxes for unit - - Accordingly also event handleres for combo boxes, creates 3 functions + - Accordingly also event handlers for combo boxes, creates 3 functions """ kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) @@ -803,10 +815,13 @@ class Analysis(QtGui.QWidget): ''' def start_combo_change(self, text): + """Handle start combo box, ie. units, as second, ms""" self.tran_parameter[0] = str(text) def step_combo_change(self, text): + """Handle step combo box, ie. units, as second, ms...""" self.tran_parameter[1] = str(text) def stop_combo_change(self, text): + """Handle stop combo box, ie. units, as second, ms...""" self.tran_parameter[2] = str(text) diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 8280f9e7..883ba534 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -8,8 +8,16 @@ from xml.etree import ElementTree as ET class Convert: """ - - This class has all the necessary function required to convert + - This class has all the necessary function required to convert \ kicad netlist to ngspice netlist. + - Method List + - - addDeviceLibrary + - - addModelParameter + - - addSourceParameter + - - addSubcircuit + - - analysisInsertor + - - converttosciform + - - defaultvalue """ def __init__(self, sourcelisttrack, source_entry_var, @@ -22,7 +30,15 @@ class Convert: def addSourceParameter(self): """ - - This function add the source details to schematicInfo + - This function extracts the source details to schematicInfo + - keywords recognised and parsed - + - - sine + - - pulse + - - pwl + - - ac + - - dc + - - exp + - Return updated schematic """ self.start = 0 diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index e1367181..7f63a43b 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -7,7 +7,7 @@ from . import TrackWidget class DeviceModel(QtGui.QWidget): """ - - This class creates Device Library Tab in KicadtoNgspice Window + - This class creates Device Library Tab in KicadtoNgspice Window It dynamically creates the widget for device like diode,mosfet, transistor and jfet. - Same function as the subCircuit file, except for diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index ef9201cb..f760bce2 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -41,7 +41,6 @@ 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("==================================") diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py index a182dd4e..6ebfcb52 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 216383e6..ebbd3429 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -16,7 +16,6 @@ class PrcocessNetlist: """ - Read the circuit file and return splitted lines """ - def readNetlist(self, filename): f = open(filename) data = f.read() @@ -32,7 +31,6 @@ class PrcocessNetlist: - Read Parameter information and store it into dictionary - kicadNetlis is the .cir file content """ - def readParamInfo(self, kicadNetlis): param = {} print("=========================KICADNETLIST========================") @@ -57,7 +55,6 @@ 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: @@ -128,7 +125,6 @@ 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("=============================================================") @@ -466,7 +462,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/Source.py b/src/kicadtoNgspice/Source.py index c9d50a26..26555197 100644 --- a/src/kicadtoNgspice/Source.py +++ b/src/kicadtoNgspice/Source.py @@ -27,16 +27,21 @@ class Source(QtGui.QWidget): def createSourceWidget(self, sourcelist, sourcelisttrack): """ - - This function dynamically create source widget in the + - This function dynamically create source widget in the \ Source tab of KicadtoNgSpice window - - Depending on the type of source, ac, dc, sine, pwl, etc... - source tab is created - - All the entry fields, are kept into the entry_var + - Depending on the type of source, sourcetab is created + - - ac + - - dc + - - sine + - - pulse + - - pwl + - - exp + - All the entry fields, are kept into the entry_var \ tracked by self.count - - Finally after each of the sourcelist is mapped to its input component - we move to adding these to the track widget - - Also check if any default values present from previous analysis & add - them by default + - Finally after each of the sourcelist is mapped to its input \ + component we move to adding these to the track widget + - Also check if any default values present from previous analysis \ + & add them by default - Each line in sourcelist corresponds to a source - According to the source type modify the source and add it to the tab """ diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py index c22cee5c..9378ae25 100644 --- a/src/modelEditor/ModelEditor.py +++ b/src/modelEditor/ModelEditor.py @@ -109,13 +109,12 @@ class ModelEditorclass(QtGui.QWidget): self.setLayout(self.grid) self.show() - ''' - - To create New Model file - - Change state of other buttons accordingly, ex. enable diode, bjt, ... - - Validate filename created, to check if one already exists - ''' - def opennew(self): + ''' + - To create New Model file + - Change state of other buttons accordingly, ex. enable diode, bjt, ... + - Validate filename created, to check if one already exists + ''' self.addbtn.setHidden(True) try: self.removebtn.setHidden(True) @@ -142,26 +141,25 @@ class ModelEditorclass(QtGui.QWidget): # Show error accordingly self.validation(text) - ''' - - Call function, openfiletype, which opens the table view for Diode specs - - Set states for other elements - - Diode has no types, so hide that - ''' - def diode_click(self): + ''' + - Call function, openfiletype, which opens the table view for Diode specs + - Set states for other elements + - Diode has no types, so hide that + ''' self.openfiletype('Diode') self.types.setHidden(True) - ''' - - Set states for other elements - - Initialise types combo box elements - - - NPN - - - PNP - - Open the default type in the table - - Add an event listener for type-selection event - ''' def bjt_click(self): + ''' + - Set states for other elements + - Initialise types combo box elements + - - NPN + - - PNP + - Open the default type in the table + - Add an event listener for type-selection event + ''' self.types.setHidden(False) self.types.clear() self.types.addItem('NPN') @@ -172,17 +170,17 @@ class ModelEditorclass(QtGui.QWidget): # When element selected from combo box, call setfiletype self.types.activated[str].connect(self.setfiletype) - ''' - - Set states for other elements - - Initialise types combo box elements - - - NMOS(Level-1 5um) - - - NMOS(Level-3 0.5um) - - - ... - - Open the default type in the table - - Add an event listener for type-selection event - ''' def mos_click(self): + ''' + - Set states for other elements + - Initialise types combo box elements + - - NMOS(Level-1 5um) + - - NMOS(Level-3 0.5um) + - - ... + - Open the default type in the table + - Add an event listener for type-selection event + ''' self.types.setHidden(False) self.types.clear() self.types.addItem('NMOS(Level-1 5um)') @@ -195,16 +193,16 @@ class ModelEditorclass(QtGui.QWidget): self.openfiletype(filetype) self.types.activated[str].connect(self.setfiletype) - ''' - - Set states for other elements - - Initialise types combo box elements - - - N-JFET - - - P-JFET - - Open the default type in the table - - Add an event listener for type-selection event - ''' def jfet_click(self): + ''' + - Set states for other elements + - Initialise types combo box elements + - - N-JFET + - - P-JFET + - Open the default type in the table + - Add an event listener for type-selection event + ''' self.types.setHidden(False) self.types.clear() self.types.addItem('N-JFET') @@ -212,17 +210,17 @@ class ModelEditorclass(QtGui.QWidget): filetype = str(self.types.currentText()) self.openfiletype(filetype) self.types.activated[str].connect(self.setfiletype) - - ''' - - Set states for other elements - - Initialise types combo box elements - - - N-IGBT - - - P-IGBT - - Open the default type in the table - - Add an event listener for type-selection event - ''' + def igbt_click(self): + ''' + - Set states for other elements + - Initialise types combo box elements + - - N-IGBT + - - P-IGBT + - Open the default type in the table + - Add an event listener for type-selection event + ''' self.types.setHidden(False) self.types.clear() self.types.addItem('N-IGBT') @@ -231,35 +229,32 @@ class ModelEditorclass(QtGui.QWidget): self.openfiletype(filetype) self.types.activated[str].connect(self.setfiletype) - ''' - - Set states for other elements - - Initialise types combo box elements - - Open the default type in the table - - Add an event listener for type-selection event - - No types here, only one view - ''' - def magnetic_click(self): + ''' + - Set states for other elements + - Initialise types combo box elements + - Open the default type in the table + - Add an event listener for type-selection event + - No types here, only one view + ''' self.openfiletype('Magnetic Core') self.types.setHidden(True) - ''' - - Triggered when each type selected - - Get the type clicked, from text - - Open appropriate table using openfiletype(filetype) - ''' - def setfiletype(self, text): + ''' + - Triggered when each type selected + - Get the type clicked, from text + - Open appropriate table using openfiletype(filetype) + ''' self.filetype = str(text) self.openfiletype(self.filetype) - ''' - - Select path for the filetype passed - - Accordingly call `createtable(path)` to draw tables usingg QTable - - Check for the state of button before rendering - ''' - def openfiletype(self, filetype): + ''' + - Select path for the filetype passed + - Accordingly call `createtable(path)` to draw tables usingg QTable + - Check for the state of button before rendering + ''' self.path = '../deviceModelLibrary/Templates' if self.diode.isChecked(): if filetype == 'Diode': @@ -312,16 +307,16 @@ class ModelEditorclass(QtGui.QWidget): else: pass - ''' - - When `Edit` button clicked, this function called - - Set states for other buttons accordingly - - Open the file selector box with path as deviceModelLibrary - and filetype set as .lib, save it in `self.editfile` - - Create table for the selected .lib file using `self.createtable(path)` - - Handle exception of no file selected - ''' def openedit(self): + ''' + - When `Edit` button clicked, this function called + - Set states for other buttons accordingly + - Open the file selector box with path as deviceModelLibrary + and filetype set as .lib, save it in `self.editfile` + - Create table for the selected .lib file using `self.createtable(path)` + - Handle exception of no file selected + ''' os.chdir(self.savepathtest) self.newflag = 0 self.addbtn.setHidden(True) @@ -344,19 +339,18 @@ class ModelEditorclass(QtGui.QWidget): print("No File selected for edit") pass - ''' - - Set states for other components - - Initialise QTable widget - - Set options for QTable widget - - Place QTable widget, using `self.grid.addWidget` - - Select the `.xml` file from the modelfile passed as `.lib` - - Use ET (xml.etree.ElementTree) to parse the xml file - - Extract data from the XML and store it in `modeldict` - - Show the extracted data in QTableWidget - - Can edit QTable inplace, connect `edit_modeltable` function for editing - ''' - def createtable(self, modelfile): + ''' + - Set states for other components + - Initialise QTable widget + - Set options for QTable widget + - Place QTable widget, using `self.grid.addWidget` + - Select the `.xml` file from the modelfile passed as `.lib` + - Use ET (xml.etree.ElementTree) to parse the xml file + - Extract data from the XML and store it in `modeldict` + - Show the extracted data in QTableWidget + - Can edit QTable inplace, connect `edit_modeltable` function for editing + ''' self.savebtn.setDisabled(False) self.addbtn.setHidden(False) self.removebtn.setHidden(False) @@ -401,15 +395,15 @@ class ModelEditorclass(QtGui.QWidget): self.modeltable.show() self.modeltable.itemChanged.connect(self.edit_modeltable) - ''' - - Called when editing model inplace in QTableWidget - - Set states of other components - - Get data from the modeltable of the selected row - - Edit name and value as per needed - - Add the val name pair in the modeldict - ''' - def edit_modeltable(self): + ''' + - Called when editing model inplace in QTableWidget + - Set states of other components + - Get data from the modeltable of the selected row + - Edit name and value as per needed + - Add the val name pair in the modeldict + ''' + self.savebtn.setDisabled(False) try: indexitem = self.modeltable.currentItem() @@ -421,15 +415,14 @@ class ModelEditorclass(QtGui.QWidget): except BaseException: pass - ''' - - Called when `Add` button clicked beside QTableWidget - - Open up dialog box to enter parameter and value accordingly - - Validate if parameter already in list of parameters - - Accordingly add parameter and value in modeldict as well as table - - text1 => parameter, text2 => value - ''' - def addparameters(self): + ''' + - Called when `Add` button clicked beside QTableWidget + - Open up dialog box to enter parameter and value accordingly + - Validate if parameter already in list of parameters + - Accordingly add parameter and value in modeldict as well as table + - text1 => parameter, text2 => value + ''' text1, ok = QtGui.QInputDialog.getText( self, 'Parameter', 'Enter Parameter') if ok: @@ -454,26 +447,25 @@ class ModelEditorclass(QtGui.QWidget): else: pass - ''' - - Called when save functon clicked - - If new file created, call `createXML` file - - Else call `savethefile` - ''' - def savemodelfile(self): + ''' + - Called when save functon clicked + - If new file created, call `createXML` file + - Else call `savethefile` + ''' if self.newflag == 1: self.createXML(self.model_name) else: self.savethefile(self.editfile) - ''' - - Create .xml and .lib file if new model is being created - - Save it in the corresponding compoenent directory, example Diode, IGBT.. - - For each component, separate folder is there - - Check the contents of .lib and .xml file to understand their structure - ''' def createXML(self, model_name): + ''' + - Create .xml and .lib file if new model is being created + - Save it in the corresponding compoenent directory, example Diode, IGBT.. + - For each component, separate folder is there + - Check the contents of .lib and .xml file to understand their structure + ''' root = ET.Element("library") ET.SubElement(root, "model_name").text = model_name ET.SubElement(root, "ref_model").text = self.modelname @@ -612,12 +604,12 @@ class ModelEditorclass(QtGui.QWidget): txtfile.close() os.chdir(defaultcwd) - ''' - - This function checks if the file (xml type) with the name already exists - - Accordingly show error message - ''' def validation(self, text): + ''' + - This function checks if the file (xml type) with the name already exists + - Accordingly show error message + ''' newfilename = text + '.xml' all_dir = [x[0] for x in os.walk(self.savepathtest)] @@ -629,13 +621,13 @@ class ModelEditorclass(QtGui.QWidget): 'The file with name ' + text + ' already exists.') self.msg.setWindowTitle("Error Message") - ''' - - This function save the editing in the model table - - Create .lib and .xml file for the editfile path and replace them - - Also print Updated Library with libpath in the command window - ''' def savethefile(self, editfile): + ''' + - This function save the editing in the model table + - Create .lib and .xml file for the editfile path and replace them + - Also print Updated Library with libpath in the command window + ''' xmlpath, file = os.path.split(editfile) filename = os.path.splitext(file)[0] libpath = os.path.join(xmlpath, filename + '.lib') @@ -663,30 +655,29 @@ class ModelEditorclass(QtGui.QWidget): self.obj_appconfig.print_info('Updated library ' + libpath) - ''' - - Get the index of the current selected item - - Remove the whole row from QTable Widget - - Remove the param,value pair from modeldict - ''' - def removeparameter(self): + ''' + - Get the index of the current selected item + - Remove the whole row from QTable Widget + - Remove the param,value pair from modeldict + ''' self.savebtn.setDisabled(False) index = self.modeltable.currentIndex() remove_item = self.modeltable.item(index.row(), 0).text() self.modeltable.removeRow(index.row()) del self.modeldict[str(remove_item)] - ''' - - Called when upload button clicked - - Used to read file form a certain location for .lib extension - - Accordingly parse it and extract modelname and modelref - - Also extract param value pairs - - Take input the name of the library you want to save it as - - Save it in `User Libraries` with the given name, - and input from uploaded file - ''' def converttoxml(self): + ''' + - Called when upload button clicked + - Used to read file form a certain location for .lib extension + - Accordingly parse it and extract modelname and modelref + - Also extract param value pairs + - Take input the name of the library you want to save it as + - Save it in `User Libraries` with the given name, + and input from uploaded file + ''' os.chdir(self.savepathtest) self.addbtn.setHidden(True) self.removebtn.setHidden(True) diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py index 3bf8fe59..de6d958a 100644 --- a/src/ngspiceSimulation/pythonPlotting.py +++ b/src/ngspiceSimulation/pythonPlotting.py @@ -585,11 +585,11 @@ class DataExtraction: # Initializing variable # 'p' gives no. of lines of data for each node/branch - # 'l' gives the no of partitions for a single voltage node + # 'npv' gives the no of partitions for a single voltage node # 'vnumber' gives total number of voltage # 'inumber' gives total number of current - p = l = vnumber = inumber = 0 + p = npv = vnumber = inumber = 0 # print "VoltsData : ",self.voltData # Finding totla number of voltage node @@ -625,9 +625,9 @@ class DataExtraction: for i in self.voltData[3:]: p += 1 # 'p' gives no. of lines of data for each node/branch if "Index" in i: - l += 1 - # 'l' gives the no of partitions for a single voltage node - # print "l:",l + npv += 1 + # 'npv' gives the no of partitions for a single voltage node + # print("npv:", npv) if "AC" in i: # DC for dc files and AC for ac ones break @@ -636,9 +636,9 @@ class DataExtraction: for i in self.voltData[3:]: p += 1 if "Index" in i: - l += 1 - # 'l' gives the no of partitions for a single voltage node - # print "l:",l + npv += 1 + # 'npv' gives the no of partitions for a single voltage node + # print("npv:", npv) if "Transient" in i: # DC for dc files and AC for ac ones break @@ -648,16 +648,16 @@ class DataExtraction: for i in self.voltData[3:]: p += 1 if "Index" in i: - l += 1 - # 'l' gives the no of partitions for a single voltage node - # print "l:",l + npv += 1 + # 'npv' gives the no of partitions for a single voltage node + # print("npv:", npv) if "DC" in i: # DC for dc files and AC for ac ones break # print "VoltNumber",vnumber # print "CurrentNumber",inumber - vnumber = vnumber // l # vnumber gives the no of voltage nodes - inumber = inumber // l # inumber gives the no of branches + vnumber = vnumber // npv # vnumber gives the no of voltage nodes + inumber = inumber // npv # inumber gives the no of branches # print "VoltNumber",vnumber # print "CurrentNumber",inumber diff --git a/src/ngspicetoModelica/NgspicetoModelica.py b/src/ngspicetoModelica/NgspicetoModelica.py index 1c5e754c..bdbd6ac2 100644 --- a/src/ngspicetoModelica/NgspicetoModelica.py +++ b/src/ngspicetoModelica/NgspicetoModelica.py @@ -639,8 +639,8 @@ class NgMoConverter: tempstatList.append("Level=1" + " ") try: - l = mosInfo[words[0]]['l'] - tempstatList.append("L=" + self.getUnitVal(l) + " ") + mwl = mosInfo[words[0]]['l'] + tempstatList.append("L=" + self.getUnitVal(mwl) + " ") except KeyError: tempstatList.append("L=1e-6" + " ") try: diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py index 9aaac46d..b75c0cf6 100644 --- a/src/projManagement/Kicad.py +++ b/src/projManagement/Kicad.py @@ -22,22 +22,19 @@ from configuration.Appconfig import Appconfig from . import Worker from PyQt4 import QtGui -""" -This class called the Kicad Schematic,KicadtoNgspice Converter,Layout -editor and Footprint Editor -""" - class Kicad: """ - Initialise validation, appconfig and dockarea + This class called the Kicad Schematic,KicadtoNgspice Converter,Layout + editor and Footprint Editor + Initialise validation, appconfig and dockarea - @params - :dockarea => passed from DockArea in frontEnd folder, consists - of all functions for dockarea + @params + :dockarea => passed from DockArea in frontEnd folder, consists + of all functions for dockarea - @return + @return """ def __init__(self, dockarea): @@ -45,16 +42,17 @@ class Kicad: self.obj_appconfig = Appconfig() self.obj_dockarea = dockarea - """ - This function create command to open Kicad schematic after - appropriate validation checks - @params - - @return - """ def openSchematic(self): + """ + This function create command to open Kicad schematic after + appropriate validation checks + + @params + + @return + """ print("Function : Open Kicad Schematic") self.projDir = self.obj_appconfig.current_project["ProjectName"] try: @@ -151,18 +149,15 @@ class Kicad: self.msg.setWindowTitle("Error Message") ''' - """ - This function create command to validate and then call - KicadToNgSPice converter from DockArea file - - @params - - @return - """ def openKicadToNgspice(self): """ - This function create command to call kicad to Ngspice converter. + This function create command to validate and then call + KicadToNgSPice converter from DockArea file + + @params + + @return """ print("Function: Open Kicad to Ngspice Converter") diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py index 9fcac9a2..79e458d8 100644 --- a/src/projManagement/Validation.py +++ b/src/projManagement/Validation.py @@ -21,26 +21,14 @@ import os import re import distutils.spawn -""" -This is Validation class use for validating Project. -e.g if .proj is present in project directory -or if new project name is already exist in workspace etc -""" -class Validation: +class Validation: """ - Takes as input the path of the project and checks if - projName.proj file exists - projName is same as the folder selected - - @params - :projDir => contains the path of the project folder selected to open - - @return - True => If the folder contains the projName.proj file - False => If the folder doesn't contain projName.proj file + This is Validation class use for validating Project. + e.g if .proj is present in project directory + or if new project name is already exist in workspace etc """ def __init__(self): @@ -48,8 +36,17 @@ class Validation: def validateOpenproj(self, projDir): """ - This function validate Open Project Information. - """ + Takes as input the path of the project and checks if + projName.proj file exists + projName is same as the folder selected + + @params + :projDir => contains the path of the project folder selected to open + + @return + True => If the folder contains the projName.proj file + False => If the folder doesn't contain projName.proj file + """ print("Function: Validating Open Project Information") projName = os.path.basename(str(projDir)) lookProj = os.path.join(str(projDir), projName + ".proj") @@ -59,22 +56,20 @@ class Validation: else: return False - """ - Validate new project created - - @params - :projDir => Contains path of the new projDir created - @return - :"CHECKEXIST" => If smae project name folder exists - :"CHECKNAME" => If space is there in name - :"VALID" => If valid project name given - """ def validateNewproj(self, projDir): """ - This Project Validate New Project Information - """ + Validate new project created + + @params + :projDir => Contains path of the new projDir created + + @return + :"CHECKEXIST" => If smae project name folder exists + :"CHECKNAME" => If space is there in name + :"VALID" => If valid project name given + """ print("Function: Validating New Project Information") # Checking existence of project with same name @@ -87,22 +82,20 @@ class Validation: else: return "VALID" - """ - Validate if projDir is set appropriately in the function calling file - and if Kicad components are present - @params - :projDir => the path of the project directory, passed from - the calling function - - @return - True - False - """ def validateKicad(self, projDir): """ - This function validate if Kicad components are present + Validate if projDir is set appropriately in the function calling file + and if Kicad components are present + + @params + :projDir => the path of the project directory, passed from + the calling function + + @return + True + False """ print("FUnction : Validating for Kicad components") if projDir is None: @@ -110,21 +103,19 @@ class Validation: else: return True - """ - Validate if cir file present in the directory with the appropriate .cir - file name, same as the project directory base - - @params - :projDir => the path to the project diretory - @return - True - False - """ def validateCir(self, projDir): """ - This function checks if ".cir" file is present. + Validate if cir file present in the directory with the appropriate .cir + file name, same as the project directory base + + @params + :projDir => the path to the project directory + + @return + True + False """ projName = os.path.basename(str(projDir)) lookCir = os.path.join(str(projDir), projName + ".cir") @@ -137,6 +128,16 @@ class Validation: def validateSub(self, subDir, givenNum): """ This function checks if ".sub" file is present. + Also, if subckt file is present check for ports and check if equal + + @params + :subDir => the path of the subcircuit directory + :giveNum => the number of port calculated and passed for validation + + @return + True + PORT + DIREC """ subName = os.path.basename(str(subDir)) lookSub = os.path.join(str(subDir), subName + ".sub") @@ -168,6 +169,14 @@ class Validation: def validateCirOut(self, projDir): """ This function checks if ".cir.out" file is present. + + @params + :projDir => the path of the project directory, passed from + the calling function + + @return + True + False """ projName = os.path.basename(str(projDir)) lookCirOut = os.path.join(str(projDir), projName + ".cir.out") @@ -179,6 +188,7 @@ class Validation: def validateTool(self, toolName): """ - This function check if tool is present in the system + This function check if tool is present in the system, + Example, nghdl, eeschema... """ return distutils.spawn.find_executable(toolName) is not None diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py index f40fd724..99d30ccc 100644 --- a/src/projManagement/Worker.py +++ b/src/projManagement/Worker.py @@ -19,16 +19,13 @@ from PyQt4 import QtCore import subprocess from configuration.Appconfig import Appconfig -""" -WorkerThread uses QThread to support threading operations for -other PyQT windows -This is a helper functions, used to create threads for various commands -""" - - class WorkerThread(QtCore.QThread): """ Initialise a QThread with the passed arguments + WorkerThread uses QThread to support threading operations for + other PyQT windows + This is a helper functions, used to create threads for various commands + @params :args => takes a space separated string of comamnds to be execute @@ -42,48 +39,49 @@ class WorkerThread(QtCore.QThread): QtCore.QThread.__init__(self) self.args = args - """ - __del__ is a called whenever garbage collection is initialised - Here, it waits (self.wait()) for the thread to finish executing - before garbage collecting it - - @params - @return - None - """ def __del__(self): - self.wait() + """ + __del__ is a called whenever garbage collection is initialised + Here, it waits (self.wait()) for the thread to finish executing + before garbage collecting it - """ - run is the function that is called, when we start the thread as - thisThread.start() - Here, it makes system calls for all args passed (self.args) + @params - @params + @return + None + """ + self.wait() - @return - None - """ def run(self): - print("Worker Thread Calling Command :", self.args) - self.call_system(self.args) + """ + run is the function that is called, when we start the thread as + thisThread.start() + Here, it makes system calls for all args passed (self.args) - """ - call_system is used to create childprocess for the passed arguments - (self.args) and also pass the process created and its id to config file - Apponfig() object contains procThread and proc_dist used to - track processes called + @params - @params - :command => (self.args) takes space separated string of comamnds to - be executed in different child processes - (see subproces.Popen()) - """ + @return + None + """ + print("Worker Thread Calling Command :", self.args) + self.call_system(self.args) def call_system(self, command): + """ + call_system is used to create childprocess for the passed arguments + (self.args) and also pass the process created and its id to config file + Apponfig() object contains procThread and proc_dist used to + track processes called + + @params + :command => (self.args) takes space separated string of comamnds to + be executed in different child processes + (see subproces.Popen()) + """ + procThread = Appconfig() proc = subprocess.Popen(command.split()) procThread.procThread_list.append(proc) diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py index c8cd4078..92e90742 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -22,33 +22,38 @@ from configuration.Appconfig import Appconfig import os import json -""" -This class is called when User create new Project. -""" class NewProjectInfo(QtGui.QWidget): + """ + This class is called when User create new Project. + """ def __init__(self): super(NewProjectInfo, self).__init__() self.obj_validation = Validation() self.obj_appconfig = Appconfig() - """ - This function create Project related directories and files + def createProject(self, projName): + """ + This function create Project related directories and files. + Before creating also validates using the `Validation` class - @params - :projName => name of the project created passed from - frontEnd/Application new_project() + Validation codes - @return - :dirs => The directories inside the project folder - :filelist => The files inside the project folder - """ + - VALID + - CHECKEXIST + - CHECKNAME + - NONE + + @params + :projName => name of the project created passed from + frontEnd/Application new_project() + + @return + :dirs => The directories inside the project folder + :filelist => The files inside the project folder - def createProject(self, projName): - """ - This function create Project related directories and files """ # print "Create Project Called" self.projName = projName diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py index 100cf12c..7c9e23d1 100644 --- a/src/projManagement/openProject.py +++ b/src/projManagement/openProject.py @@ -23,28 +23,27 @@ from configuration.Appconfig import Appconfig import os import json -""" -This class is called when User click on Open Project Button -""" - class OpenProjectInfo(QtGui.QWidget): + """ + This class is called when User click on Open Project Button + """ def __init__(self): super(OpenProjectInfo, self).__init__() self.obj_validation = Validation() - """ - Open a project directory using Qt GUI and validate - if .proj file present in it - @params + def body(self): + """ + Open a project directory using Qt GUI and validate + if .proj file present in it using `Validation` class - @return - :dirs => The directories inside the project folder - :filelist => The files inside the project folder - """ + @params - def body(self): + @return + :dirs => The directories inside the project folder + :filelist => The files inside the project folder + """ self.obj_Appconfig = Appconfig() self.openDir = self.obj_Appconfig.default_workspace["workspace"] self.projDir = QtGui.QFileDialog.getExistingDirectory( diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py index 39c0fe77..d2e7ec5a 100644 --- a/src/subcircuit/Subcircuit.py +++ b/src/subcircuit/Subcircuit.py @@ -10,7 +10,12 @@ from subcircuit.convertSub import convertSub class Subcircuit(QtGui.QWidget): """ Creates buttons for New project, Edit existing project and - Kicad Netlist to Ngspice Netlist converter. + Kicad Netlist to Ngspice Netlist converter and link them with the + methods defined for it in other files. + + - New Project(NewSub method of newSub). + - Open Project(openSub method of openSub). + - Kicad to Ngspice convertor(convertSub of convertSub). """ def __init__(self, parent=None): diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py index cce27476..49f5a54f 100644 --- a/src/subcircuit/convertSub.py +++ b/src/subcircuit/convertSub.py @@ -9,7 +9,7 @@ import os class convertSub(QtGui.QWidget): """ Contains functions that checks project present for conversion and - also function to convert Kicad to Ngspice. + also function to convert Kicad Netlist to Ngspice Netlist. """ def __init__(self, dockarea): @@ -20,7 +20,13 @@ class convertSub(QtGui.QWidget): def createSub(self): """ - This function create command to call kicad to Ngspice converter. + This function create command to call KiCad to Ngspice converter. + If the netlist is not generated for selected project it will show + error **The subcircuit does not contain any Kicad netlist file for + conversion.** + And if no project is selected for conversion, it again show error + message to select a file or create a file. + """ print("Openinig Kicad-to-Ngspice converter from Subcircuit Module") self.projDir = self.obj_appconfig.current_subcircuit["SubcircuitName"] diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py index 6b221b4c..678b023d 100644 --- a/src/subcircuit/newSub.py +++ b/src/subcircuit/newSub.py @@ -8,10 +8,7 @@ import os # This class is called when User create new Project. class NewSub(QtGui.QWidget): """ - Contains funstions to check : - - Name of project should not be blank. - - Name should not contain space between them. - - Name does not match with existing project. + Contains functions to create directory and validate file names. """ def __init__(self): @@ -21,7 +18,11 @@ class NewSub(QtGui.QWidget): def createSubcircuit(self, subName): """ - This function create Subcircuit related directories and files + - This function create workspace for subcircuit. + - It also validate file names for Subcircuits: + - File name should not contain space. + - Name can not be empty. + - File name already exists. """ self.create_schematic = subName # Checking if Workspace already exist or not diff --git a/src/subcircuit/openSub.py b/src/subcircuit/openSub.py index 4c1394eb..bebd28a1 100644 --- a/src/subcircuit/openSub.py +++ b/src/subcircuit/openSub.py @@ -8,7 +8,7 @@ import os class openSub(QtGui.QWidget): """ It opens the existing subcircuit projects that are present in - Subcircuit Library. + Subcircuit directory. """ def __init__(self): |