Example #1
0
 def BigWork(self):
     # 干一件大事... 耗时 10s
     #import 自己的进程类
     from threads import BigWorkThread
     #新建对象
     self.bwThread = BigWorkThread(self.callback)
     #开始执行run()函数里的内容
     self.bwThread.start()
Example #2
0
    def subprocess(self):
        file_path = str(self.lineEdit.text().toLocal8Bit())

        self.bwThread = BigWorkThread(file_path)
        self.connect(self.bwThread, QtCore.SIGNAL("where"), self.update)
        self.connect(self.bwThread, QtCore.SIGNAL("finish_show"),
                     self.finish_show)
        self.connect(self.bwThread, QtCore.SIGNAL("start_matlab"),
                     self.start_matlab)
        self.bwThread.start()
Example #3
0
    def subprocess(self):
        #from threads import BigWorkThread

        if self.radioButton.isChecked():
            line = [
                1,
                str(self.lineEdit.text().toLocal8Bit()),
                str(self.lineEdit_2.text().toLocal8Bit()),
                str(self.lineEdit_3.text().toLocal8Bit())
            ]
        elif self.radioButton_2.isChecked():
            line = [
                2,
                str(self.lineEdit.text().toLocal8Bit()),
                str(self.lineEdit_2.text().toLocal8Bit()),
                str(self.lineEdit_3.text().toLocal8Bit())
            ]
        elif self.radioButton_3.isChecked():
            line = [
                3,
                str(self.lineEdit.text().toLocal8Bit()),
                str(self.lineEdit_2.text().toLocal8Bit()),
                str(self.lineEdit_3.text().toLocal8Bit())
            ]
        elif self.radioButton_4.isChecked():
            line = [
                4,
                str(self.lineEdit.text().toLocal8Bit()),
                str(self.lineEdit_2.text().toLocal8Bit()),
                str(self.lineEdit_3.text().toLocal8Bit())
            ]
        elif self.radioButton_5.isChecked():
            line = [
                5,
                str(self.lineEdit.text().toLocal8Bit()),
                str(self.lineEdit_2.text().toLocal8Bit()),
                str(self.lineEdit_3.text().toLocal8Bit())
            ]
        else:
            line = []
        #创建子进程
        self.bwThread = BigWorkThread(line)

        self.connect(self.bwThread, QtCore.SIGNAL("where"), self.update)
        self.connect(self.bwThread, QtCore.SIGNAL("showtxt"), self.showtxt)
        self.connect(self.bwThread, QtCore.SIGNAL("finish_show"),
                     self.finish_show)
        self.connect(self.bwThread, QtCore.SIGNAL("finddocfile"),
                     self.finddocfile)
        #开始执行子进程run()函数里的内容
        self.bwThread.start()
 def validate_excel(self):
     try:
         #把按钮禁用掉
         self.pushButton.setDisabled(True)
         #import 自己的进程类
         from threads import BigWorkThread
         #新建对象,传入参数
         filePath = self.lineEdit.text()
         print(filePath)
         houzui = ""
         if len(filePath) > 0:
             list = filePath.split('/')
             zui = list[len(list) - 1]
             houzui = zui.split(".")
             if houzui[1] != "xlsx":
                 raise Exception("文件类型不正确!")
             result_name = houzui[0] + "_" + "校验结果" + "." + houzui[1]
             path = ""
             for i in range(len(list) - 1):
                 path += list[i] + "\\"
             inpath = path + zui
             exportFilePath = path + result_name
             print(inpath)
             print(exportFilePath)
             self.bwThread = BigWorkThread(int(1), inpath, exportFilePath,
                                           True)
             # 连接子进程的信号和槽函数
             self.bwThread.finishSignal.connect(self.callbacklog)
             # 开始执行 run() 函数里的内容
             self.bwThread.start()
         else:
             self.setTextBrowser("文件路径不能为空")
             self.pushButton.setDisabled(False)
     except Exception as err:
         self.pushButton.setDisabled(False)
         self.setTextBrowser("校验失败!错误描述:" + str(err))