summaryrefslogtreecommitdiff
path: root/src/projManagement/openProject.py
blob: 97e851e868b53b99f8df5df94784ea3933881b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

#===============================================================================
#
#          FILE: openProject.py
# 
#         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 
#      REVISION:  ---
#===============================================================================

from PyQt4 import QtGui
from Validation import Validation
from configuration.Appconfig import Appconfig



class OpenProjectInfo(QtGui.QWidget):
    """
    Class ProjectInfo accept model information from user
    
    """
    def __init__(self):
        super(OpenProjectInfo, self).__init__()
        self.obj_validation = Validation()
              
    def body(self):
        self.obj_Appconfig = Appconfig()
        self.openDir = self.obj_Appconfig.default_workspace["workspace"]
        #print "default workspace is now 1", self.openDir
        self.projDir=QtGui.QFileDialog.getExistingDirectory(self,"open",self.openDir)
        if self.obj_validation.validateOpenproj(self.projDir) == True:
            print "Pass open project test"
            self.obj_Appconfig = Appconfig()
            self.obj_Appconfig.current_project['ProjectName'] = str(self.projDir)
            
            
        else:
            print "Failed open project test"
            reply = QtGui.QMessageBox.critical(None, "Error Message",'''<b> Error: The project doesn't contain .proj file.</b><br/>
                    <b>Please select the proper project directory else you won't be able to perform any operation</b>''',QtGui.QMessageBox.Ok|QtGui.QMessageBox.Cancel)
            if reply == QtGui.QMessageBox.Ok:
                self.body()
            elif reply == QtGui.QMessageBox.Cancel:
                pass
            else:
                pass