当前位置: 首页>>代码示例>>Python>>正文


Python QCoreApplication.processEvents方法代码示例

本文整理汇总了Python中PyQt.QtCore.QCoreApplication.processEvents方法的典型用法代码示例。如果您正苦于以下问题:Python QCoreApplication.processEvents方法的具体用法?Python QCoreApplication.processEvents怎么用?Python QCoreApplication.processEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt.QtCore.QCoreApplication的用法示例。


在下文中一共展示了QCoreApplication.processEvents方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: grabHTTP

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
    def grabHTTP(self, url, loadFunction, arguments=None):
        """Grab distant content via QGIS internal classes and QtNetwork."""
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        request = QUrl(url)
        reply = self.manager.get(QNetworkRequest(request))
        if arguments:
            reply.finished.connect(partial(loadFunction, reply, arguments))
        else:
            reply.finished.connect(partial(loadFunction, reply))

        while not reply.isFinished():
            QCoreApplication.processEvents()
开发者ID:MrBenjaminLeb,项目名称:QGIS,代码行数:14,代码来源:GetScriptsAndModels.py

示例2: write

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
    def write(self, m):
        if self.style == "_traceback":
            # Show errors in red
            stderrColor = QColor(self.sO.settings.value("pythonConsole/stderrFontColor", QColor(Qt.red)))
            self.sO.SendScintilla(QsciScintilla.SCI_STYLESETFORE, 0o01, stderrColor)
            self.sO.SendScintilla(QsciScintilla.SCI_STYLESETITALIC, 0o01, True)
            self.sO.SendScintilla(QsciScintilla.SCI_STYLESETBOLD, 0o01, True)
            pos = self.sO.SendScintilla(QsciScintilla.SCI_GETCURRENTPOS)
            self.sO.SendScintilla(QsciScintilla.SCI_STARTSTYLING, pos, 31)
            self.sO.append(m)
            self.sO.SendScintilla(QsciScintilla.SCI_SETSTYLING, len(m), 0o01)
        else:
            self.sO.append(m)

        if self.out:
            self.out.write(m)

        self.move_cursor_to_end()

        if self.style != "_traceback":
            QCoreApplication.processEvents()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:23,代码来源:console_output.py

示例3: okPressed

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
    def okPressed(self):
        toDownload = []
        for i in xrange(self.toupdateItem.childCount()):
            item = self.toupdateItem.child(i)
            if item.checkState(0) == Qt.Checked:
                toDownload.append(item.filename)
        for i in xrange(self.notinstalledItem.childCount()):
            item = self.notinstalledItem.child(i)
            if item.checkState(0) == Qt.Checked:
                toDownload.append(item.filename)

        if toDownload:
            self.progressBar.setMaximum(len(toDownload) * 2)
            for i, filename in enumerate(toDownload):
                QCoreApplication.processEvents()
                url = self.urlBase + filename.replace(' ', '%20')
                self.grabHTTP(url, self.storeFile, filename)

                url += '.help'
                self.grabHTTP(url, self.storeFile, filename + '.help')

        toDelete = []
        for i in xrange(self.uptodateItem.childCount()):
            item = self.uptodateItem.child(i)
            if item.checkState(0) == Qt.Unchecked:
                toDelete.append(item.filename)

        # Remove py and help files if they exist
        for filename in toDelete:
            for pathname in (filename, filename + u".help"):
                path = os.path.join(self.folder, pathname)
                if os.path.exists(path):
                    os.remove(path)

        self.updateToolbox = len(toDownload) + len(toDelete) > 0
        super(GetScriptsAndModelsDialog, self).accept()
开发者ID:MrBenjaminLeb,项目名称:QGIS,代码行数:38,代码来源:GetScriptsAndModels.py

示例4: setText

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
 def setText(self, text):
     self.lblProgress.setText(text)
     self.setInfo(text, False)
     QCoreApplication.processEvents()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:6,代码来源:AlgorithmDialogBase.py

示例5: setPercentage

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
 def setPercentage(self, value):
     if self.progressBar.maximum() == 0:
         self.progressBar.setMaximum(100)
     self.progressBar.setValue(value)
     QCoreApplication.processEvents()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:7,代码来源:AlgorithmDialogBase.py

示例6: setConsoleInfo

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
 def setConsoleInfo(self, msg):
     if self.showDebug:
         self.setCommand('<span style="color:darkgray">%s</span>' % msg)
     QCoreApplication.processEvents()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:6,代码来源:AlgorithmDialogBase.py

示例7: setDebugInfo

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
 def setDebugInfo(self, msg):
     if self.showDebug:
         self.setInfo('<span style="color:blue">%s</span>' % msg)
     QCoreApplication.processEvents()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:6,代码来源:AlgorithmDialogBase.py

示例8: setCommand

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
 def setCommand(self, cmd):
     if self.showDebug:
         self.setInfo('<code>%s<code>' % cmd)
     QCoreApplication.processEvents()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:6,代码来源:AlgorithmDialogBase.py

示例9: setInfo

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
 def setInfo(self, msg, error=False):
     if error:
         self.txtLog.append('<span style="color:red"><br>%s<br></span>' % msg)
     else:
         self.txtLog.append(msg)
     QCoreApplication.processEvents()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:8,代码来源:AlgorithmDialogBase.py

示例10: TestQgsNetworkContentFetcher

# 需要导入模块: from PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt.QtCore.QCoreApplication import processEvents [as 别名]
class TestQgsNetworkContentFetcher(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        # Bring up a simple HTTP server
        os.chdir(unitTestDataPath() + '')
        handler = SimpleHTTPServer.SimpleHTTPRequestHandler

        cls.httpd = SocketServer.TCPServer(('localhost', 0), handler)
        cls.port = cls.httpd.server_address[1]

        cls.httpd_thread = threading.Thread(target=cls.httpd.serve_forever)
        cls.httpd_thread.setDaemon(True)
        cls.httpd_thread.start()

    def __init__(self, methodName):
        """Run once on class initialization."""
        unittest.TestCase.__init__(self, methodName)

        self.loaded = False

        self.app = QCoreApplication([])

    def contentLoaded(self):
        self.loaded = True

    def testFetchEmptyUrl(self):
        fetcher = QgsNetworkContentFetcher()
        self.loaded = False
        fetcher.fetchContent(QUrl())
        fetcher.finished.connect(self.contentLoaded)
        while not self.loaded:
            self.app.processEvents()

        r = fetcher.reply()
        assert r.error() != QNetworkReply.NoError

    def testFetchBadUrl(self):
        fetcher = QgsNetworkContentFetcher()
        self.loaded = False
        fetcher.fetchContent(QUrl('http://x'))
        fetcher.finished.connect(self.contentLoaded)
        while not self.loaded:
            self.app.processEvents()

        r = fetcher.reply()
        assert r.error() != QNetworkReply.NoError

    def testFetchUrlContent(self):
        fetcher = QgsNetworkContentFetcher()
        self.loaded = False
        fetcher.fetchContent(QUrl('http://localhost:' + str(TestQgsNetworkContentFetcher.port) + '/qgis_local_server/index.html'))
        fetcher.finished.connect(self.contentLoaded)
        while not self.loaded:
            self.app.processEvents()

        r = fetcher.reply()
        assert r.error() == QNetworkReply.NoError, r.error()

        html = fetcher.contentAsString()
        assert 'QGIS' in html

    def testDoubleFetch(self):
        fetcher = QgsNetworkContentFetcher()
        self.loaded = False
        fetcher.fetchContent(QUrl('http://www.qgis.org/'))
        # double fetch - this should happen before previous request finishes
        fetcher.fetchContent(QUrl('http://localhost:' + str(TestQgsNetworkContentFetcher.port) + '/qgis_local_server/index.html'))
        fetcher.finished.connect(self.contentLoaded)
        while not self.loaded:
            self.app.processEvents()

        r = fetcher.reply()
        assert r.error() == QNetworkReply.NoError, r.error()

        html = fetcher.contentAsString()
        assert 'QGIS' in html

    def testFetchEncodedContent(self):
        fetcher = QgsNetworkContentFetcher()
        self.loaded = False
        fetcher.fetchContent(QUrl('http://localhost:' + str(TestQgsNetworkContentFetcher.port) + '/encoded_html.html'))
        fetcher.finished.connect(self.contentLoaded)
        while not self.loaded:
            self.app.processEvents()

        r = fetcher.reply()
        assert r.error() == QNetworkReply.NoError, r.error()

        html = fetcher.contentAsString()
        assert unichr(6040) in html
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:93,代码来源:test_qgsnetworkcontentfetcher.py


注:本文中的PyQt.QtCore.QCoreApplication.processEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。