diff options
author | maddy-2 | 2019-05-27 12:32:49 +0530 |
---|---|---|
committer | nilshah98 | 2019-06-07 11:03:14 +0530 |
commit | 28d8fd378bf717e8daba8a564708856769f24b98 (patch) | |
tree | ee8cc6592c690708d5f35cb5304feeae3d014c97 /src/projManagement/newProject.py | |
parent | 7e7b6d372aac718f857fcad5c49faf019ff83bb4 (diff) | |
download | eSim-28d8fd378bf717e8daba8a564708856769f24b98.tar.gz eSim-28d8fd378bf717e8daba8a564708856769f24b98.tar.bz2 eSim-28d8fd378bf717e8daba8a564708856769f24b98.zip |
initialise pep8 compliance, using autopep8
Diffstat (limited to 'src/projManagement/newProject.py')
-rw-r--r-- | src/projManagement/newProject.py | 99 |
1 files changed, 52 insertions, 47 deletions
diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py index e8c81d6f..f01d2f53 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -1,109 +1,114 @@ -#=============================================================================== +#========================================================================= # # FILE: newProject.py -# -# USAGE: --- -# -# DESCRIPTION: It is called whenever new project is being called. -# +# +# USAGE: --- +# +# DESCRIPTION: It is called whenever new project is being called. +# # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: Fahim Khan, fahim.elex@gmail.com # ORGANIZATION: eSim team at FOSSEE, IIT Bombay. -# CREATED: Wednesday 12 February 2015 +# CREATED: Wednesday 12 February 2015 # REVISION: --- -#=============================================================================== +#========================================================================= from PyQt4 import QtGui from .Validation import Validation from configuration.Appconfig import Appconfig import os import json + 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() - - def createProject(self,projName): + def createProject(self, projName): """ This function create Project related directories and files """ #print "Create Project Called" - self.projName= projName + self.projName = projName 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.projDir = os.path.join(self.workspace,str(self.projName)) - - - #Validation for newProject + # Remove leading and trailing space + self.projName = str(self.projName).rstrip().lstrip() + + self.projDir = os.path.join(self.workspace, str(self.projName)) + + # Validation for newProject if self.projName == "": self.reply = "NONE" else: self.reply = self.obj_validation.validateNewproj(str(self.projDir)) - - #Checking Validations Response + + # Checking Validations Response if self.reply == "VALID": - #create project directory + # create project directory try: os.mkdir(self.projDir) self.close() - self.projFile = os.path.join(self.projDir,self.projName+".proj") - f = open(self.projFile,"w") - except: + self.projFile = os.path.join( + self.projDir, self.projName + ".proj") + f = open(self.projFile, "w") + except BaseException: #print "Some Thing Went Wrong" self.msg = QtGui.QErrorMessage(self) - self.msg.showMessage('Unable to create project. Please make sure you have write permission on '+self.workspace) + self.msg.showMessage( + 'Unable to create project. Please make sure you have write permission on ' + + self.workspace) self.msg.setWindowTitle("Error Message") - f.write("schematicFile " + self.projName+".sch\n") + f.write("schematicFile " + self.projName + ".sch\n") f.close() - - #Now Change the current working project + + # Now Change the current working project newprojlist = [] #self.obj_appconfig = Appconfig() - self.obj_appconfig.current_project['ProjectName'] = self.projDir - newprojlist.append(self.projName+'.proj') + self.obj_appconfig.current_project['ProjectName'] = self.projDir + newprojlist.append(self.projName + '.proj') self.obj_appconfig.project_explorer[self.projDir] = newprojlist - - self.obj_appconfig.print_info('New project created : ' + self.projName) - self.obj_appconfig.print_info('Current project is : ' + self.projDir) - - json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w')) + + self.obj_appconfig.print_info( + 'New project created : ' + self.projName) + self.obj_appconfig.print_info( + 'Current project is : ' + self.projDir) + + json.dump( + self.obj_appconfig.project_explorer, open( + self.obj_appconfig.dictPath, 'w')) return self.projDir, newprojlist - + elif self.reply == "CHECKEXIST": #print "Project already exist" self.msg = QtGui.QErrorMessage(self) - self.msg.showMessage('The project "'+self.projName+'" already exist.Please select the different name or delete existing project') + self.msg.showMessage( + 'The project "' + + self.projName + + '" already exist.Please select the different name or delete existing project') self.msg.setWindowTitle("Error Message") - - + elif self.reply == "CHECKNAME": #print "Name is not proper" self.msg = QtGui.QErrorMessage(self) - self.msg.showMessage('The project name should not contain space between them') + self.msg.showMessage( + 'The project name should not contain space between them') self.msg.setWindowTitle("Error Message") - + elif self.reply == "NONE": #print "Empty Project Name" self.msg = QtGui.QErrorMessage(self) self.msg.showMessage('The project name cannot be empty') self.msg.setWindowTitle("Error Message") - + def cancelProject(self): self.close() - - - - -
\ No newline at end of file |