diff options
Diffstat (limited to 'src/projManagement')
-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 |
5 files changed, 150 insertions, 145 deletions
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( |