diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/frontEnd/ProjectExplorer.py | 2 | ||||
-rw-r--r-- | src/kicadtoNgspice/Analysis.py | 47 | ||||
-rw-r--r-- | src/kicadtoNgspice/Convert.py | 18 | ||||
-rw-r--r-- | src/kicadtoNgspice/DeviceModel.py | 2 | ||||
-rw-r--r-- | src/kicadtoNgspice/KicadtoNgspice.py | 1 | ||||
-rw-r--r-- | src/kicadtoNgspice/Model.py | 4 | ||||
-rw-r--r-- | src/kicadtoNgspice/Processing.py | 6 | ||||
-rw-r--r-- | src/kicadtoNgspice/Source.py | 9 | ||||
-rw-r--r-- | src/modelEditor/ModelEditor.py | 267 | ||||
-rw-r--r-- | src/projManagement/Kicad.py | 47 | ||||
-rw-r--r-- | src/projManagement/Validation.py | 118 | ||||
-rw-r--r-- | src/projManagement/Worker.py | 72 | ||||
-rw-r--r-- | src/projManagement/newProject.py | 33 | ||||
-rw-r--r-- | src/projManagement/openProject.py | 25 |
14 files changed, 339 insertions, 312 deletions
diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 8d0ef4ec..ca525f87 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -55,7 +55,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)]) 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..d59708de 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -10,6 +10,14 @@ class 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..f4bd3f55 100644 --- a/src/kicadtoNgspice/Source.py +++ b/src/kicadtoNgspice/Source.py @@ -29,8 +29,13 @@ class Source(QtGui.QWidget): """ - 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 + - 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 diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py index 1dce456e..3bfdcfac 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/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..70ff5789 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -22,33 +22,36 @@ 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 - - @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 + Before creating also validates using the `Validation` class + Validation codes - + - 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 + """ # 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( |