Python PyQt5.QtWidgets.QApplication 模块,processEvents() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用PyQt5.QtWidgets.QApplication.processEvents()

项目:RRPam-WDS    作者:asselapathirana    | 项目源码 | 文件源码
def create_a_new_project(self):
        import tempfile
        with mock.patch.object(self.aw.projectgui, '_getSaveFileName', autospec=True) as mock__getSaveFileName:
            with mock.patch.object(self.aw.projectgui, '_getSaveFileName2', autospec=True) as mock__getSaveFileName2:
                sf = os.path.join(tempfile.tempdir, "xxx3xp")
                mock__getSaveFileName.return_value = (sf, c.PROJECTEXTENSION)
                mock__getSaveFileName2.return_value = (networks[0], '*.inp')
                self.aw._new_project()
                time.sleep(.1)
                self.app.processEvents()

                # make sure the thread finishes
                self.aw.pm.wait_to_finish()
                self.app.processEvents()
                time.sleep(.1)
                return sf
项目:acbDecrypter    作者:Rieksee    | 项目源码 | 文件源码
def setval(self, barNo, val):
        if type(val) != int:
            return False
        if barNo == 0:
            self.ui.progress_all.setValue(val)
        elif barNo == 1:
            self.ui.progress_now.setValue(val)
        else:
            return False
        QApplication.processEvents()
        return True
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def process_events():
    if gui_get()==True:
        QApplication.processEvents()
项目:gpvdm    作者:roderickmackenzie    | 项目源码 | 文件源码
def save_image(self,file_name):
        file_ext="jpg"
        types=self.plot.fig.canvas.get_supported_filetypes()
        if "jpg" in types:
            file_ext="jpg"
        elif "png" in  types:
            file_ext="png"

        dir_name, ext = os.path.splitext(file_name)

        if (ext=="."+file_ext):
            self.plot.fig.savefig(file_name)
        elif ext==".avi":

            if os.path.isdir(dir_name)==False:
                os.mkdir(dir_name)

            jpgs=""
            for i in range(0,self.slider.slider_max):
                self.slider.slider0.setValue(i)
                QApplication.processEvents()
                self.update()
                self.plot.do_plot()
                image_name=os.path.join(dir_name,"image_"+str(i)+"."+file_ext)
                print(image_name)
                self.plot.fig.savefig(image_name)
                jpgs=jpgs+" mf://"+image_name

            os.system("mencoder "+jpgs+" -mf type="+file_ext+":fps=1.0 -o "+file_name+" -ovc lavc -lavcopts vcodec=mpeg1video:vbitrate=800")
            #msmpeg4v2
        else:
            print("Unknown file extension")
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def artisticSleep(sleepTime):
    time = QTime()
    time.restart()
    while time.elapsed() < sleepTime:
        QApplication.processEvents(QEventLoop.AllEvents, 50)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def artisticSleep(sleepTime):
    time = QTime()
    time.restart()
    while time.elapsed() < sleepTime:
        QApplication.processEvents(QEventLoop.AllEvents, 50)
项目:RRPam-WDS    作者:asselapathirana    | 项目源码 | 文件源码
def test_project_managers_new_project_will_cause_project_to_be_opend_in_main_window(
            self, other=None):
        ds = self.aw.pm.project_data
        # see run_in_a_thread
        if (other):
            self = other
        with mock.patch.object(self.aw, '_display_project', autospec=True) as mock__display_project:
            with mock.patch.object(ds, "get_epanetfile", autospect=True) as mock_get_epanetfile:
                mock_get_epanetfile.return_value = networks[0]
                self.aw.pm.new_project()
                self.aw.pm.wait_to_finish()
                QApplication.processEvents()  # this is very important before the assertion.
                # that is because we are not testing this within the Qt's main loop.
                time.sleep(0.1)
                mock__display_project.assert_called_with(self.aw.pm.workerthread.result)