QStackedWidget

#!/sur/bin/python

import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *

class harts_tool(QDialog):
    def __init__(self,parent =  None):
        super(harts_tool,self).__init__(parent)

        self.setWindowTitle('Harts_Push_Tool')
        self.setWindowIcon(QIcon(r'C:\project\\tools\test.png'))
        self.resize(500,600)

        frame = QFrame(self)
        stack = QStackedWidget()
        stack.setFrameStyle(QFrame.Panel|QFrame.Raised)

        base_push = push_tool()
        stack.addWidget(base_push)

        layout=QVBoxLayout(self)
        layout.addWidget(stack)
        self.setLayout(layout)

class push_tool(QFrame):
    def __init__(self,parent =  None):
        super(push_tool,self).__init__(parent)
        script_bt = QPushButton('Script Name:')
        script_el = QLineEdit()
        build_name = QLabel('Build Name:')
        build_name_el = QLineEdit()
        release_name = QLabel('Release Name:')
        release_name_el = QLineEdit()

        av_pl = QLabel('XMM7162 Product Lines:')
        product_line = QComboBox()
        product_line.addItems(['sohu','baidu','google'])

        fdd_job = QPushButton('FDD Job XML:')
        fdd_job_le = QLineEdit()
        tdd_job = QPushButton('TDD Job XML:')
        tdd_job_le = QLineEdit()

        fdd_text = QTextEdit()
        fdd_text.setAlignment(Qt.AlignCenter)

        xgridlayout = QGridLayout()
        xgridlayout.setMargin(10)
        xgridlayout.setSpacing(20)
        xgridlayout.addWidget(script_bt,0,0)
        xgridlayout.addWidget(script_el,0,1)
        xgridlayout.addWidget(build_name,1,0)
        xgridlayout.addWidget(build_name_el,1,1)
        xgridlayout.addWidget(release_name,2,0)
        xgridlayout.addWidget(release_name_el,2,1)
        xgridlayout.addWidget(av_pl,3,0)
        xgridlayout.addWidget(product_line,3,1)
        xgridlayout.addWidget(fdd_job,4,0)
        xgridlayout.addWidget(fdd_job_le,4,1)
        xgridlayout.addWidget(tdd_job,5,0)
        xgridlayout.addWidget(tdd_job_le,5,1)

        vlayout = QVBoxLayout()
        vlayout.addLayout(xgridlayout)
        #vlayout.addWidget(fdd_job)
        #vlayout.addWidget(fdd_text)
        vlayout.addStretch(1)
        self.setLayout(vlayout)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    harts = harts_tool()
    harts.show()
    app.exec_()

你可能感兴趣的:(widget)