diff options
author | nilshah98 | 2019-05-28 12:47:00 +0530 |
---|---|---|
committer | nilshah98 | 2019-06-13 12:15:09 +0530 |
commit | 7c47d9e2e0458d084ffea649c788a4c2b41520ef (patch) | |
tree | c3aeadda1eaa628ca38229241f76eb962ac281b7 /src/projManagement | |
parent | 25c6eddcea3c8a62d9750a78435454544d8c7b14 (diff) | |
download | eSim-7c47d9e2e0458d084ffea649c788a4c2b41520ef.tar.gz eSim-7c47d9e2e0458d084ffea649c788a4c2b41520ef.tar.bz2 eSim-7c47d9e2e0458d084ffea649c788a4c2b41520ef.zip |
projectManagement documentation added
Diffstat (limited to 'src/projManagement')
-rw-r--r-- | src/projManagement/Kicad.py | 33 | ||||
-rw-r--r-- | src/projManagement/Validation.py | 55 | ||||
-rw-r--r-- | src/projManagement/Worker.py | 46 | ||||
-rw-r--r-- | src/projManagement/newProject.py | 18 | ||||
-rw-r--r-- | src/projManagement/openProject.py | 18 |
5 files changed, 153 insertions, 17 deletions
diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py index 2eaef643..d8c413c3 100644 --- a/src/projManagement/Kicad.py +++ b/src/projManagement/Kicad.py @@ -22,11 +22,22 @@ 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: + """ - 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 + + @return """ def __init__(self, dockarea): @@ -34,10 +45,15 @@ 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 - """ print("Function : Open Kicad Schematic") self.projDir = self.obj_appconfig.current_project["ProjectName"] try: @@ -134,7 +150,14 @@ 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. diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py index 11cdcaf9..b0cfb5a1 100644 --- a/src/projManagement/Validation.py +++ b/src/projManagement/Validation.py @@ -21,14 +21,27 @@ 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: + """ - 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 - """ + 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 + """ def __init__(self): pass @@ -45,6 +58,17 @@ 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 @@ -61,6 +85,18 @@ 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 @@ -71,6 +107,17 @@ 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. diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py index 65c67dde..4cfeefe9 100644 --- a/src/projManagement/Worker.py +++ b/src/projManagement/Worker.py @@ -19,23 +19,67 @@ 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): """ - This is Thread class use to run the command + Initialise a QThread with the passed arguments + + @params + :args => takes a space separated string of comamnds to be execute + in different child processes (see subproces.Popen()) + + @return + None """ def __init__(self, args): 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() + """ + 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 + + @return + None + """ def run(self): print("Worker Thread Calling Command :", self.args) self.call_system(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 + :command => (self.args) takes space separated string of comamnds to + be executed in different child processes + (see subproces.Popen()) + """ def call_system(self, command): procThread = Appconfig() proc = subprocess.Popen(command.split()) diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py index 40d66003..ef2440d7 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -22,17 +22,29 @@ 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 diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py index 6cdcbb38..d12f4d8a 100644 --- a/src/projManagement/openProject.py +++ b/src/projManagement/openProject.py @@ -23,16 +23,26 @@ 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 - """ +class OpenProjectInfo(QtGui.QWidget): 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 + + @return + :dirs => The directories inside the project folder + :filelist => The files inside the project folder + """ def body(self): self.obj_Appconfig = Appconfig() self.openDir = self.obj_Appconfig.default_workspace["workspace"] |