summaryrefslogtreecommitdiff
path: root/src/projManagement/Validation.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/projManagement/Validation.py')
-rw-r--r--src/projManagement/Validation.py118
1 files changed, 64 insertions, 54 deletions
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