summaryrefslogtreecommitdiff
path: root/src/frontEnd/ViewManagement.py
blob: fac383bc7925a1a51ef09c487705b576eea18c47 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

#===============================================================================
#
#          FILE: ViewManagement.py
# 
#         USAGE: --- 
# 
#   DESCRIPTION: It contain all the view for main Application
# 
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Fahim Khan, fahim.elex@gmail.com
#  ORGANIZATION: ecSim team at FOSSEE, IIT Bombay.
#       CREATED: Wednesday 27 January 2015 
#      REVISION:  ---
#===============================================================================



from PyQt4 import QtCore
from PyQt4 import QtGui


class ViewManagement(QtGui.QSplitter):
    
    def __init__(self, *args):
        # call init method of superclass
        QtGui.QSplitter.__init__(self, *args)
        # Creating dictionary which hold all the views
        self.views = {}
        
        # define the basic framework of view areas for the
        # application
        self.createView()
        self.setupView()
        
    def createView(self):
        #Adding view into views dictionary
        self.addView(QtGui.QTextEdit, 'Project Explorer')
        self.addView(QtGui.QTextEdit, 'test2')
        self.addView(QtGui.QTextEdit, 'test3')
        
    def setupView(self):
        #setup views to define various areas, such as placement of individual views 
        # the right segment also is a splitter, but with vertical orientation
        self.right = QtGui.QSplitter()
        self.right.setOrientation(QtCore.Qt.Vertical)
        
        #Layout
        self.grid = QtGui.QGridLayout()
        
        
        #Button for QFrame
        self.kicad_btn = QtGui.QPushButton()
        self.kicad_btn.setIcon(QtGui.QIcon('../images/default.png'))
        self.kicad_btn.setIconSize(QtCore.QSize(50,50))
        self.grid.addWidget(self.kicad_btn,0,0)
        
        self.conversion_btn = QtGui.QPushButton()
        self.conversion_btn.setIcon(QtGui.QIcon('../images/default.png'))
        self.conversion_btn.setIconSize(QtCore.QSize(50,50))
        self.grid.addWidget(self.conversion_btn,0,1)
        
        
        self.ngspice_btn = QtGui.QPushButton()
        self.ngspice_btn.setIcon(QtGui.QIcon('../images/default.png'))
        self.ngspice_btn.setIconSize(QtCore.QSize(50,50))
        self.grid.addWidget(self.ngspice_btn,0,2)
    
        
             
        
        # bind the top level views into the framework
        self.views['Project Explorer'].setParent(self)
        
        self.views['test2'].setParent(self.right)
        self.views['test2'].setLayout(self.grid)
        self.views['test2'].setReadOnly(True)
        
        self.views['test3'].setParent(self.right)
        
        self.right.setParent(self)
        self.right.setSizes([20, 5])
        self.setSizes([5, 20])
        
    def addView(self, settype, name):
        
        #Adding views to dictionary
        #parameters:
        #settype             <class>     
        #name                <string>    
        
        self.views[name] = settype()