summaryrefslogtreecommitdiff
path: root/src/projManagement
diff options
context:
space:
mode:
Diffstat (limited to 'src/projManagement')
-rw-r--r--src/projManagement/Validation.py25
-rw-r--r--src/projManagement/newProject.py29
-rw-r--r--src/projManagement/openProject.py9
3 files changed, 54 insertions, 9 deletions
diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py
index 70b29ab5..864ac448 100644
--- a/src/projManagement/Validation.py
+++ b/src/projManagement/Validation.py
@@ -17,6 +17,7 @@
# REVISION: ---
#===============================================================================
import os
+import re
class Validation:
@@ -24,17 +25,35 @@ class Validation:
pass
def validateOpenproj(self,proj_directory):
- print "Valid open Proj called"
+ print "Validate openProj called"
projName = os.path.basename(str(proj_directory))
lookProj = os.path.join(str(proj_directory),projName+".proj")
+ #Check existence of project
if os.path.exists(lookProj):
return True
else:
return False
+
+
- def validateNewproj(self):
- print "Valid new Proj called"
+ def validateNewproj(self,project_dir):
+ print "Validate newProj called"
+ print "Project Directory : ",project_dir
+ #Checking existence of project with same name
+
+ if os.path.exists(project_dir):
+ return "CHECKEXIST" #Project with name already exist
+ else:
+
+ #Check Proper name for project. It should not have space
+
+ if re.search(r"\s",project_dir ):
+ return "CHECKNAME"
+ else:
+ return "VALID"
+
+
\ No newline at end of file
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py
index f7670033..146b0080 100644
--- a/src/projManagement/newProject.py
+++ b/src/projManagement/newProject.py
@@ -17,7 +17,9 @@
# REVISION: ---
#===============================================================================
from PyQt4 import QtGui,QtCore
-
+from Validation import Validation
+from configuration.Appconfig import Appconfig
+import os
class NewProjectInfo(QtGui.QWidget):
"""
@@ -26,6 +28,8 @@ class NewProjectInfo(QtGui.QWidget):
def __init__(self):
super(NewProjectInfo, self).__init__()
+ self.obj_validation = Validation()
+ self.obj_appconfig = Appconfig()
def body(self):
@@ -79,6 +83,29 @@ class NewProjectInfo(QtGui.QWidget):
def createProject(self):
print "Create Project Called"
+ self.workspace = self.obj_appconfig.default_workspace['workspace']
+ self.projName = self.projEdit.text()
+ self.projName = str(self.projName).rstrip().lstrip() #Remove leading and trailing space
+
+ self.project_dir = os.path.join(self.workspace,str(self.projName))
+
+ self.reply = self.obj_validation.validateNewproj(str(self.project_dir))
+
+ if self.reply == "VALID":
+ print "Validated : Creating project directory"
+ #create project directory
+ print "Check : ",self.project_dir
+ try:
+ os.mkdir(self.project_dir)
+ self.close()
+ except:
+ print "Some Thing Wrong"
+
+ elif self.reply == "CHECKEXIST":
+ print "Project already exist"
+
+ elif self.reply == "CHECKNAME":
+ print "Name is not proper"
def cancelProject(self):
self.close()
diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py
index 6972b1ed..3bbdfc37 100644
--- a/src/projManagement/openProject.py
+++ b/src/projManagement/openProject.py
@@ -23,19 +23,18 @@ from configuration.Appconfig import Appconfig
-class ProjectInfo:
+class ProjectInfo(QtGui.QWidget):
"""
Class ProjectInfo accept model information from user
"""
def __init__(self):
- pass
+ super(ProjectInfo, self).__init__()
+ self.obj_validation = Validation()
def body(self):
self.proj_directory = QtGui.QFileDialog.getExistingDirectory()
- self.obj_validation = Validation()
-
-
+
if self.obj_validation.validateOpenproj(self.proj_directory) == True:
print "Pass open project test"
self.obj_Appconfig = Appconfig()