summaryrefslogtreecommitdiff
path: root/src/kicadtoNgspice/Analysis.py
blob: 61af84b509664f0941f340f82026b8e50799dc99 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240

from PyQt4 import QtGui,QtCore
#import GroupBox

class Analysis(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.createAnalysisWidget()
         
    def createAnalysisWidget(self):
        self.grid = QtGui.QGridLayout()
        self.grid.addWidget(self.createCheckBobx(),0,0)
        self.grid.addWidget(self.createACgroup(),1,0)
        self.grid.addWidget(self.createDCgroup(),2,0)
        self.grid.addWidget(self.createTRANgroup(),3,0)
            
        '''
        self.grid.addWidget(self.createTRANgroup(),3,0)
        self.grid.addWidget(self.createTRANgroup(),4,0)
        self.grid.addWidget(self.createTRANgroup(),5,0)
        self.grid.addWidget(self.createTRANgroup(),6,0)
        self.grid.addWidget(self.createTRANgroup(),7,0)
        self.grid.addWidget(self.createTRANgroup(),8,0)
        self.grid.addWidget(self.createTRANgroup(),9,0)
        self.grid.addWidget(self.createTRANgroup(),10,0)
        self.grid.addWidget(self.createTRANgroup(),11,0)
        self.grid.addWidget(self.createTRANgroup(),12,0)
        self.grid.addWidget(self.createTRANgroup(),13,0)
        self.grid.addWidget(self.createTRANgroup(),14,0)
        self.grid.addWidget(self.createTRANgroup(),15,0)
        self.grid.addWidget(self.createTRANgroup(),16,0)
        self.grid.addWidget(self.createTRANgroup(),17,0)
        self.grid.addWidget(self.createTRANgroup(),18,0)
        self.grid.addWidget(self.createTRANgroup(),19,0)
        self.grid.addWidget(self.createTRANgroup(),20,0)
        '''
        
        self.setLayout(self.grid)
        self.show()
        
    
    def createCheckBobx(self):
        self.checkbox = QtGui.QGroupBox()
        self.checkbox.setTitle("Select Analysis Type")
        self.checkgrid = QtGui.QGridLayout()
        
        self.checkgroupbtn = QtGui.QButtonGroup()
        self.checkAC = QtGui.QCheckBox("AC")
        self.checkDC = QtGui.QCheckBox("DC")
        self.checkTRAN = QtGui.QCheckBox("TRANSIENT")
        self.checkgroupbtn.addButton(self.checkAC)
        self.checkgroupbtn.addButton(self.checkDC)
        self.checkgroupbtn.addButton(self.checkTRAN)
        self.checkgroupbtn.setExclusive(True)
        self.checkgroupbtn.buttonClicked.connect(self.enableBox)
        
        self.checkgrid.addWidget(self.checkAC,0,0)
        self.checkgrid.addWidget(self.checkDC,0,1)
        self.checkgrid.addWidget(self.checkTRAN,0,2)
        self.checkbox.setLayout(self.checkgrid)
        
        
        #CSS
        '''
        self.checkbox.setStyleSheet(" \
        QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \
        QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; } \
        ")
        '''
              
        return self.checkbox
        #return self.checkgroupbtn
    
    def enableBox(self):
        if self.checkAC.isChecked():
            self.acbox.setDisabled(False)
            self.dcbox.setDisabled(True)
            self.trbox.setDisabled(True)
        elif self.checkDC.isChecked():
            self.dcbox.setDisabled(False)
            self.acbox.setDisabled(True)
            self.trbox.setDisabled(True)
            
        elif self.checkTRAN.isChecked():
            self.trbox.setDisabled(False)
            self.acbox.setDisabled(True)
            self.dcbox.setDisabled(True)
        
                
    def createACgroup(self):
        self.acbox = QtGui.QGroupBox()
        self.acbox.setTitle("AC Analysis")
        self.acgrid = QtGui.QGridLayout()
        
        self.Lin = QtGui.QRadioButton("Lin")
        self.Dec = QtGui.QRadioButton("Dec")
        self.Oct = QtGui.QRadioButton("Oct")
        self.acgrid.addWidget(self.Lin,1,1)
        self.acgrid.addWidget(self.Dec,1,2)
        self.acgrid.addWidget(self.Oct,1,3)
        self.acbox.setDisabled(True)
        self.acbox.setLayout(self.acgrid)
        
        self.Scale = QtGui.QLabel("Scale")
        self.Start_Frequency = QtGui.QLabel("Start Frequency")
        self.Stop_Frequency = QtGui.QLabel("Stop Frequency")
        self.No_of_Points = QtGui.QLabel("No.of Points")
        #self.Scale.setMaximumWidth(150)
        #self.Start_Frequency.setMaximumWidth(150)
        #self.Stop_Frequency.setMaximumWidth(150)
        #self.No_of_Points.setMaximumWidth(150)
        self.acgrid.addWidget(self.Scale,1,0)
        self.acgrid.addWidget(self.Start_Frequency,2,0)
        self.acgrid.addWidget(self.Stop_Frequency,3,0)
        self.acgrid.addWidget(self.No_of_Points,4,0)
        
        self.Start_Frequency = QtGui.QLineEdit(self)
        self.Stop_Frequency = QtGui.QLineEdit()
        self.No_of_Points = QtGui.QLineEdit()
        self.acgrid.addWidget(self.Start_Frequency,2,1)
        self.acgrid.addWidget(self.Stop_Frequency,3,1)
        self.acgrid.addWidget(self.No_of_Points,4,1)
        self.Start_Frequency.setMaximumWidth(150)
        self.Stop_Frequency.setMaximumWidth(150)
        self.No_of_Points.setMaximumWidth(150)
        
        #self.lineEdit1.setGeometry()
        
        self.Start_Frequency = QtGui.QComboBox()
        self.Start_Frequency.addItem("Hz",)
        self.Start_Frequency.addItem("KHz")
        self.Start_Frequency.addItem("MHz")
        self.Start_Frequency.addItem("GHz")
        self.Start_Frequency.addItem("THz")
        #self.Start_Frequency.setMaximumWidth(150)
        self.acgrid.addWidget(self.Start_Frequency,2,2)
        self.Stop_Frequency = QtGui.QComboBox()
        self.Stop_Frequency.addItem("Hz")
        self.Stop_Frequency.addItem("KHz")
        self.Stop_Frequency.addItem("MHz")
        self.Stop_Frequency.addItem("GHz")
        self.Stop_Frequency.addItem("THz")
        self.Stop_Frequency.setMaximumWidth(150)
        self.acgrid.addWidget(self.Stop_Frequency,3,2)
        
        
        

        
        
        #CSS   
        self.acbox.setStyleSheet(" \
        QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \
        QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; } \
        ")
             
        return self.acbox
    
    def createDCgroup(self):
        self.dcbox = QtGui.QGroupBox()
        self.dcbox.setTitle("DC Analysis")
        self.dcgrid = QtGui.QGridLayout()
        
        self.btn3 = QtGui.QRadioButton("Radio button 3")
        self.btn4 = QtGui.QRadioButton("Radio button 4")
        self.dcgrid.addWidget(self.btn3,0,0)
        self.dcgrid.addWidget(self.btn4,0,1)
        self.dcbox.setDisabled(True)
        self.dcbox.setLayout(self.dcgrid)
        
        #CSS
        self.dcbox.setStyleSheet(" \
        QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \
        QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; } \
        ")
              
        
        return self.dcbox
    
    def createTRANgroup(self):
        self.trbox = QtGui.QGroupBox()
        self.trbox.setTitle("Transient Analysis")
        self.trgrid = QtGui.QGridLayout()
        
        #self.btn5 = QtGui.QRadioButton("Radio button 5")
        #self.btn6 = QtGui.QRadioButton("Radio button 6")
        #self.trgrid.addWidget(self.btn5,0,0)
        #self.trgrid.addWidget(self.btn6,0,1)
        self.trbox.setDisabled(True)
        self.trbox.setLayout(self.trgrid)
        
        self.Start_Time = QtGui.QLabel("Start Time")
        self.Step_Time = QtGui.QLabel("Step Time")
        self.Stop_Time = QtGui.QLabel("Stop Time")
        self.trgrid.addWidget(self.Start_Time,1,0)
        self.trgrid.addWidget(self.Step_Time,2,0)
        self.trgrid.addWidget(self.Stop_Time,3,0)
        
        self.Start_Time = QtGui.QLineEdit()
        self.Step_Time = QtGui.QLineEdit()
        self.Stop_Time = QtGui.QLineEdit()
        self.trgrid.addWidget(self.Start_Time,1,1)
        self.trgrid.addWidget(self.Step_Time,2,1)
        self.trgrid.addWidget(self.Stop_Time,3,1)
        
        self.Start_Time = QtGui.QComboBox()
        self.Start_Time.addItem("Sec")
        self.Start_Time.addItem("ms")
        self.Start_Time.addItem("us")
        self.Start_Time.addItem("ns")
        self.Start_Time.addItem("ps")
        self.trgrid.addWidget(self.Start_Time,1,2)
        
        self.Step_Time = QtGui.QComboBox()
        self.Step_Time.addItem("Sec")
        self.Step_Time.addItem("ms")
        self.Step_Time.addItem("us")
        self.Step_Time.addItem("ns")
        self.Step_Time.addItem("ps")
        self.trgrid.addWidget(self.Step_Time,2,2)
        
        self.Stop_Time = QtGui.QComboBox()
        self.Stop_Time.addItem("Sec")
        self.Stop_Time.addItem("ms")
        self.Stop_Time.addItem("us")
        self.Stop_Time.addItem("ns")
        self.Stop_Time.addItem("ps")
        self.trgrid.addWidget(self.Stop_Time,3,2)
        
        
        
        
        #CSS
        self.trbox.setStyleSheet(" \
        QGroupBox { border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; } \
        QGroupBox::title { subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px; } \
        ")
              
        
        return self.trbox