MyQMainWindowDemo

# coding=utf-8
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from MyQThread import *
import sys
from SocketFromServer import SocketFromServer
import img

class MyQMainWindowDemo(QMainWindow):
    def __init__(self, parent=None):
        super(MyQMainWindowDemo, self).__init__(parent)
        mycode = 'utf-8'
        code = QTextCodec.codecForName(mycode)
        QTextCodec.setCodecForLocale(code)
        QTextCodec.setCodecForTr(code)
        QTextCodec.setCodecForCStrings(code)
        title = ['     事件监控平台\n下面是相应未处理的事件', '事件ID   :', '责任人   :', 'eSpace已通知']
        label_0 = QLabel(title[0])

        ft = QFont()
        ft.setPointSize(20)
        ft.setBold(True)
        label_0.setFont(ft)

        input_box = QGridLayout()
        Title_Layout = QVBoxLayout()
        Content_Layout = QHBoxLayout()

        Title_Layout.addWidget(label_0, alignment=Qt.AlignCenter)

        input_box.setColumnStretch(0, 1)
        input_box.setColumnStretch(1, 2)
        input_box.setColumnStretch(2, 1)

        self.eSpaceTextEdit = QTextBrowser()
        input_box.addWidget(self.eSpaceTextEdit, 0, 0, 4, 7)
        self.initMenu()
        self.socket = SocketFromServer()

        a = QWidget()
        self.thread = MyQThread()
        self.MyThread_30 = MyQThread_30()

        self.btnStart = QPushButton('Start')
        h_box = QVBoxLayout()

        h_box.addLayout(Title_Layout, 1)
        h_box.addLayout(input_box, 5)

        a.setLayout(h_box)
        self.setCentralWidget(a)
        self.resize(QSize(550, 300))
        self.setWindowTitle(u'eSpace监控外呼工具')
        self.row = 1
        self.connect(self.thread, SIGNAL('output(QString)'), self.AutoRefreshData)  # 10S获取新的
        self.connect(self.MyThread_30, SIGNAL('output(QString)'), self.AutoRefreshAndSend)  # 1min更新界面

        self.thread.start()
        self.MyThread_30.start()
        self.warning_thread = MyQThread_Warning()
        self.warning_thread.start()
        self.delay_thread = MyQThreadDelay()
        self.setWindowIcon(QIcon(':img/background.ico'))
        self.music_warning_status = 0
        self.lock_delay_status = 0


        self.setAutoFillBackground(True)

    


if __name__ == "__main__":
    try:
        app = QApplication(sys.argv)
        myWindow = MyQMainWindowDemo()
        myWindow.show()
        sys.exit(app.exec_())
    except Exception, e:
        print e


posted @ 2017-06-02 19:18  我的大金金  阅读(177)  评论(0编辑  收藏  举报