From 1eb70cebaa7c2bb2d351af9c7dddf7f7f670f5f5 Mon Sep 17 00:00:00 2001 From: fahim Date: Wed, 18 Mar 2015 17:25:08 +0530 Subject: Subject: Added checkbox in Analysis Tab Description: Added Checkbox in Analysis Tab --- src/kicadtoNgspice/Analysis.py | 105 ++++++++++++++++++++++++---------- src/kicadtoNgspice/Analysis.pyc | Bin 2965 -> 4527 bytes src/kicadtoNgspice/KicadtoNgspice.py | 32 +++++++---- src/kicadtoNgspice/KicadtoNgspice.pyc | Bin 3090 -> 2655 bytes 4 files changed, 96 insertions(+), 41 deletions(-) (limited to 'src/kicadtoNgspice') diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index 84c279c6..baccb669 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -5,28 +5,21 @@ from PyQt4 import QtGui,QtCore class Analysis(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) + self.createAnalysisWidget() + + + + def createAnalysisWidget(self): - ''' - self.scrolllayout = QtGui.QVBoxLayout() - self.scrollwidget = QtGui.QWidget() - self.scrollwidget.setLayout(self.scrolllayout) - - self.scroll = QtGui.QScrollArea() - self.scroll.setWidgetResizable(True) # Set to make the inner widget resize with scroll area - self.scroll.setWidget(self.scrollwidget) - - self.hlayout = QtGui.QHBoxLayout() - self.hlayout.addWidget(self.scroll) - self.hlayout.addWidget(self.createACgroup()) - self.hlayout.addWidget(self.createDCgroup()) - self.hlayout.addWidget(self.createTRANgroup()) - self.setLayout(self.hlayout) - ''' - self.grid = QtGui.QGridLayout() - self.grid.addWidget(self.createACgroup(),0,0) - self.grid.addWidget(self.createDCgroup(),1,0) - self.grid.addWidget(self.createTRANgroup(),2,0) + + + 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) @@ -52,6 +45,54 @@ class Analysis(QtGui.QWidget): 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): @@ -63,17 +104,15 @@ class Analysis(QtGui.QWidget): self.btn2 = QtGui.QRadioButton("Radio button 2") self.acgrid.addWidget(self.btn1,0,0) self.acgrid.addWidget(self.btn2,0,1) - - + self.acbox.setDisabled(True) + self.acbox.setLayout(self.acgrid) + + #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; } \ ") - - - - self.acbox.setLayout(self.acgrid) - + return self.acbox def createDCgroup(self): @@ -85,13 +124,15 @@ class Analysis(QtGui.QWidget): 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; } \ ") - - self.dcbox.setLayout(self.dcgrid) + return self.dcbox @@ -104,12 +145,14 @@ class Analysis(QtGui.QWidget): 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) + #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; } \ ") - - self.trbox.setLayout(self.trgrid) + return self.trbox \ No newline at end of file diff --git a/src/kicadtoNgspice/Analysis.pyc b/src/kicadtoNgspice/Analysis.pyc index 38e29695..3d962e13 100644 Binary files a/src/kicadtoNgspice/Analysis.pyc and b/src/kicadtoNgspice/Analysis.pyc differ diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index aeae1210..935f5bb2 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -20,20 +20,27 @@ from PyQt4 import QtGui import Analysis class MainWindow(QtGui.QWidget): + netList = [] def __init__(self): QtGui.QWidget.__init__(self) print "Init Kicad to Ngspice" + #Creating Objects for Analysis,Source and model + + #self.obj_analysis = Analysis.Analysis() + + #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() @@ -66,24 +73,29 @@ class MainWindow(QtGui.QWidget): return self.convertWindow + + -def main(): +def main(args): print "==================================" print "Kicad to Ngspice netlist converter " print "==================================" - #kicadNetlist = sys.argv[1] - - + #print "The passed netlist file is ",sys.argv[1] -if __name__ == '__main__': app = QtGui.QApplication(sys.argv) - app.setApplicationName("KicadToNgspice") - app.setQuitOnLastWindowClosed(True) - window = MainWindow() - main() + #app.setApplicationName("KicadToNgspice") + #app.setQuitOnLastWindowClosed(True) + kingWindow = MainWindow() + kingWindow.show() sys.exit(app.exec_()) +if __name__ == '__main__': + main(sys.argv) + + + + \ No newline at end of file diff --git a/src/kicadtoNgspice/KicadtoNgspice.pyc b/src/kicadtoNgspice/KicadtoNgspice.pyc index a5f370c5..f0da8737 100644 Binary files a/src/kicadtoNgspice/KicadtoNgspice.pyc and b/src/kicadtoNgspice/KicadtoNgspice.pyc differ -- cgit