From 22254c4024c72f71de4d4fc0b71bbb22fac8a747 Mon Sep 17 00:00:00 2001 From: fahim Date: Thu, 19 Feb 2015 17:55:15 +0530 Subject: Subject: Modiefied newProject.py and added few icons Description: Moddiefied newProject.py with few validation check and icons for newProject ,CloseProject and openProject --- src/frontEnd/Application.py | 6 +- src/frontEnd/Workspace.py | 1 - src/frontEnd/Workspace.pyc | Bin 3466 -> 3466 bytes src/images/closeProject.svg | 135 ++++++++++++++++++++++++ src/images/newProject.svg | 209 ++++++++++++++++++++++++++++++++++++++ src/images/openProject.svg | 157 ++++++++++++++++++++++++++++ src/projManagement/Validation.py | 25 ++++- src/projManagement/newProject.py | 29 +++++- src/projManagement/openProject.py | 9 +- 9 files changed, 558 insertions(+), 13 deletions(-) create mode 100644 src/images/closeProject.svg create mode 100644 src/images/newProject.svg create mode 100644 src/images/openProject.svg diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 0ef5b8b4..c454f6cc 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -58,15 +58,15 @@ class Application(QtGui.QMainWindow): def initActions(self): - self.newproj = QtGui.QAction(QtGui.QIcon('../images/default.png'),'New Project',self) + self.newproj = QtGui.QAction(QtGui.QIcon('../images/newProject.svg'),'New Project',self) self.newproj.setShortcut('Ctrl+N') self.newproj.triggered.connect(self.new_project) - self.openproj = QtGui.QAction(QtGui.QIcon('../images/default.png'),'Open Project',self) + self.openproj = QtGui.QAction(QtGui.QIcon('../images/openProject.svg'),'Open Project',self) self.openproj.setShortcut('Ctrl+O') self.openproj.triggered.connect(self.open_project) - self.exitproj = QtGui.QAction(QtGui.QIcon('../images/default.png'),'Exit',self) + self.exitproj = QtGui.QAction(QtGui.QIcon('../images/closeProject.svg'),'Exit',self) self.exitproj.setShortcut('Ctrl+X') self.exitproj.triggered.connect(self.exit_project) diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index 921e0a56..e52801e7 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -96,7 +96,6 @@ class Workspace(QtGui.QWidget): self.create_workspace = str(self.worspace_loc.text()) if os.path.isdir(self.create_workspace): - pass print "Already present" self.obj.default_workspace["workspace"] = self.create_workspace diff --git a/src/frontEnd/Workspace.pyc b/src/frontEnd/Workspace.pyc index d2010c9f..a1d59398 100644 Binary files a/src/frontEnd/Workspace.pyc and b/src/frontEnd/Workspace.pyc differ diff --git a/src/images/closeProject.svg b/src/images/closeProject.svg new file mode 100644 index 00000000..bbb88abd --- /dev/null +++ b/src/images/closeProject.svg @@ -0,0 +1,135 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/images/newProject.svg b/src/images/newProject.svg new file mode 100644 index 00000000..74b69c40 --- /dev/null +++ b/src/images/newProject.svg @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/images/openProject.svg b/src/images/openProject.svg new file mode 100644 index 00000000..f36ee982 --- /dev/null +++ b/src/images/openProject.svg @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + 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() -- cgit