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: kicadtoNgspice.py
#
# USAGE: ---
#
# DESCRIPTION: This define all configuration used in Application.
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Fahim Khan, fahim.elex@gmail.com
# ORGANIZATION: eSim team at FOSSEE, IIT Bombay.
# CREATED: Wednesday 04 March 2015
# REVISION: ---
#===============================================================================
import sys
import os
from PyQt4 import QtGui
import Analysis
import Source
class MainWindow(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
#self.kicadfile = sys.argv[1]
self.kicadfile = "/home/fahim/eSim-Workspace/BJT_amplifier/BJT_amplifier.cir"
print "Init Kicad to Ngspice"
#Creating GUI for kicadtoNgspice window
self.grid = QtGui.QGridLayout(self)
self.convertbtn = QtGui.QPushButton("Convert")
self.cancelbtn = QtGui.QPushButton("Cancel")
self.cancelbtn.clicked.connect(self.close)
self.grid.addWidget(self.createcreateConvertWidget(),0,0)
self.grid.addWidget(self.convertbtn,1,1)
self.grid.addWidget(self.cancelbtn,1,2)
self.setGeometry(500, 500, 600, 600)
self.setLayout(self.grid)
self.show()
def createcreateConvertWidget(self):
self.convertWindow = QtGui.QWidget()
self.analysisTab = QtGui.QScrollArea()
self.analysisTab.setWidget(Analysis.Analysis())
self.analysisTabLayout = QtGui.QVBoxLayout(self.analysisTab.widget())
self.analysisTab.setWidgetResizable(True)
self.sourceTab = QtGui.QScrollArea()
self.sourceTab.setWidget(Source.Source(self.kicadfile))
self.sourceTabLayout = QtGui.QVBoxLayout(self.sourceTab.widget())
self.sourceTab.setWidgetResizable(True)
self.modelTab = QtGui.QScrollArea()
self.modelTab.setWidget(QtGui.QWidget())
self.modelTabLayout = QtGui.QVBoxLayout(self.modelTab.widget())
self.modelTab.setWidgetResizable(True)
self.tabWidget = QtGui.QTabWidget()
self.tabWidget.addTab(self.analysisTab,"Analysis Tab")
self.tabWidget.addTab(self.sourceTab,"Source Tab")
self.tabWidget.addTab(self.modelTab,"Model Tab")
self.mainLayout = QtGui.QVBoxLayout()
self.mainLayout.addWidget(self.tabWidget)
#self.mainLayout.addStretch(1)
self.convertWindow.setLayout(self.mainLayout)
self.convertWindow.show()
return self.convertWindow
def main(args):
print "=================================="
print "Kicad to Ngspice netlist converter "
print "=================================="
#print "The passed netlist file is ",sys.argv[1]
app = QtGui.QApplication(args)
#app.setApplicationName("KicadToNgspice")
#app.setQuitOnLastWindowClosed(True)
kingWindow = MainWindow()
kingWindow.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main(sys.argv)
|