python类processEvents()的实例源码

test_rrpamwds_projects.py 文件源码 项目:RRPam-WDS 作者: asselapathirana 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
window_progress.py 文件源码 项目:acbDecrypter 作者: Rieksee 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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
gui_util.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def process_events():
    if gui_get()==True:
        QApplication.processEvents()
cmp_class.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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")
qtdemo.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def artisticSleep(sleepTime):
    time = QTime()
    time.restart()
    while time.elapsed() < sleepTime:
        QApplication.processEvents(QEventLoop.AllEvents, 50)
qtdemo.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def artisticSleep(sleepTime):
    time = QTime()
    time.restart()
    while time.elapsed() < sleepTime:
        QApplication.processEvents(QEventLoop.AllEvents, 50)
test_rrpamwds_projects.py 文件源码 项目:RRPam-WDS 作者: asselapathirana 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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)


问题


面经


文章

微信
公众号

扫码关注公众号