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


Python QtCore.qDebug函数代码示例

本文整理汇总了Python中qgis.PyQt.QtCore.qDebug函数的典型用法代码示例。如果您正苦于以下问题:Python qDebug函数的具体用法?Python qDebug怎么用?Python qDebug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _unloadPluginModules

def _unloadPluginModules(packageName):
    """ unload plugin package with all its modules (files) """
    global _plugin_modules
    mods = _plugin_modules[packageName]

    for mod in mods:
        if not mod in sys.modules:
            continue

        # if it looks like a Qt resource file, try to do a cleanup
        # otherwise we might experience a segfault next time the plugin is loaded
        # because Qt will try to access invalid plugin resource data
        try:
            if hasattr(sys.modules[mod], 'qCleanupResources'):
                sys.modules[mod].qCleanupResources()
        except:
            # Print stack trace for debug
            qDebug("qCleanupResources error:\n%s" % traceback.format_exc())

        # try removing path
        if hasattr(sys.modules[mod], '__path__'):
            for path in sys.modules[mod].__path__:
                try:
                    sys.path.remove(path)
                except ValueError:
                    # Discard if path is not there
                    pass

        # try to remove the module from python
        try:
            del sys.modules[mod]
        except:
            qDebug("Error when removing module:\n%s" % traceback.format_exc())
    # remove the plugin entry
    del _plugin_modules[packageName]
开发者ID:m-kuhn,项目名称:QGIS,代码行数:35,代码来源:utils.py

示例2: setUp

    def setUp(self):
        testid = self.id().split(".")
        testheader = "\n#####_____ {0}.{1} _____#####\n".format(testid[1], testid[2])
        qDebug(testheader)

        if not self.authm.masterPasswordIsSet() or not self.authm.masterPasswordHashInDb():
            self.set_master_password()
开发者ID:liminlu0314,项目名称:QGIS,代码行数:7,代码来源:test_qgsauthsystem.py

示例3: checkTest

    def checkTest(self, **kwargs):
        self.lyr.writeToLayer(self.layer)

        ms = self._MapSettings  # class settings
        settings_type = "Class"
        if self._TestMapSettings is not None:
            ms = self._TestMapSettings  # per test settings
            settings_type = "Test"
        if "PAL_VERBOSE" in os.environ:
            qDebug("MapSettings type: {0}".format(settings_type))
            qDebug(mapSettingsString(ms))

        img = renderMapToImage(ms, parallel=False)
        self._TestImage = getTempfilePath("png")
        if not img.save(self._TestImage, "png"):
            os.unlink(self._TestImage)
            raise OSError("Failed to save output from map render job")
        self.saveControlImage(self._TestImage)

        mismatch = 0
        if "PAL_NO_MISMATCH" not in os.environ:
            # some mismatch expected
            mismatch = self._Mismatch if self._Mismatch else 0
            if self._TestGroup in self._Mismatches:
                mismatch = self._Mismatches[self._TestGroup]
        colortol = 0
        if "PAL_NO_COLORTOL" not in os.environ:
            colortol = self._ColorTol if self._ColorTol else 0
            if self._TestGroup in self._ColorTols:
                colortol = self._ColorTols[self._TestGroup]
        self.assertTrue(*self.renderCheck(mismatch=mismatch, colortol=colortol, imgpath=self._TestImage))
开发者ID:GrokImageCompression,项目名称:QGIS,代码行数:31,代码来源:test_qgspallabeling_placement.py

示例4: checkTest

    def checkTest(self, **kwargs):
        self.layer.setLabeling(QgsVectorLayerSimpleLabeling(self.lyr))

        ms = self._MapSettings  # class settings
        settings_type = 'Class'
        if self._TestMapSettings is not None:
            ms = self._TestMapSettings  # per test settings
            settings_type = 'Test'
        if 'PAL_VERBOSE' in os.environ:
            qDebug('MapSettings type: {0}'.format(settings_type))
            qDebug(mapSettingsString(ms))

        img = renderMapToImage(ms, parallel=False)
        self._TestImage = getTempfilePath('png')
        if not img.save(self._TestImage, 'png'):
            os.unlink(self._TestImage)
            raise OSError('Failed to save output from map render job')
        self.saveControlImage(self._TestImage)

        mismatch = 0
        if 'PAL_NO_MISMATCH' not in os.environ:
            # some mismatch expected
            mismatch = self._Mismatch if self._Mismatch else 0
            if self._TestGroup in self._Mismatches:
                mismatch = self._Mismatches[self._TestGroup]
        colortol = 0
        if 'PAL_NO_COLORTOL' not in os.environ:
            colortol = self._ColorTol if self._ColorTol else 0
            if self._TestGroup in self._ColorTols:
                colortol = self._ColorTols[self._TestGroup]
        self.assertTrue(*self.renderCheck(mismatch=mismatch,
                                          colortol=colortol,
                                          imgpath=self._TestImage))
开发者ID:giohappy,项目名称:QGIS,代码行数:33,代码来源:test_qgspallabeling_canvas.py

示例5: setUp

    def setUp(self):
        testid = self.id().split('.')
        testheader = '\n#####_____ {0}.{1} _____#####\n'. \
            format(testid[1], testid[2])
        qDebug(testheader)

        if (not self.authm.masterPasswordIsSet() or
                not self.authm.masterPasswordHashInDatabase()):
            self.set_master_password()
开发者ID:ndavid,项目名称:QGIS,代码行数:9,代码来源:test_qgsauthsystem.py

示例6: replyFinished

    def replyFinished(self):
        reply = self.sender()
        url = reply.request().url().toString()
        self.log("replyFinished: %s" % url)
        if not url in self.fetchedFiles:
            self.fetchedFiles[url] = None
        self.requestingUrls.remove(url)
        self.replies.remove(reply)
        isFromCache = 0
        httpStatusCode = reply.attribute(QNetworkRequest.HttpStatusCodeAttribute)
        if reply.error() == QNetworkReply.NoError:
            self.fetchSuccesses += 1
            if reply.attribute(QNetworkRequest.SourceIsFromCacheAttribute):
                self.cacheHits += 1
                isFromCache = 1
            elif not reply.hasRawHeader("Cache-Control"):
                cache = QgsNetworkAccessManager.instance().cache()
                if cache:
                    metadata = cache.metaData(reply.request().url())
                    # self.log("Expiration date: " + metadata.expirationDate().toString().encode("utf-8"))
                    if metadata.expirationDate().isNull():
                        metadata.setExpirationDate(
                            QDateTime.currentDateTime().addSecs(self.default_cache_expiration * 60 * 60))
                        cache.updateMetaData(metadata)
                        self.log(
                            "Default expiration date has been set: %s (%d h)" % (url, self.default_cache_expiration))

            if reply.isReadable():
                data = reply.readAll()
                self.fetchedFiles[url] = data
            else:
                qDebug("http status code: " + str(httpStatusCode))
        else:
            if self.sync and httpStatusCode == 404:
                self.fetchedFiles[url] = self.NOT_FOUND
            self.fetchErrors += 1
            if self.errorStatus == self.NO_ERROR:
                self.errorStatus = self.UNKNOWN_ERROR

        self.replyFinished.emit(url, reply.error(), isFromCache)
        reply.deleteLater()

        if debug_mode:
            qDebug("queue: %d, requesting: %d" % (len(self.queue), len(self.requestingUrls)))

        if len(self.queue) + len(self.requestingUrls) == 0:
            # all replies have been received
            if self.sync:
                self.logT("eventLoop.quit()")
                self.eventLoop.quit()
            else:
                self.timer.stop()
        elif len(self.queue) > 0:
            # start fetching the next file
            self.fetchNext()
        self.log("replyFinished End: %s" % url)
开发者ID:boundlessgeo,项目名称:qgis-baselayers-plugin,代码行数:56,代码来源:downloader.py

示例7: setLayerType

 def setLayerType(self, layerType):
     qDebug(" setLayerType: %s" % layerType.layerTypeName)
     self.layerType = layerType
     self.setCustomProperty(OpenlayersLayer.LAYER_PROPERTY,
                            layerType.layerTypeName)
     coordRefSys = self.layerType.coordRefSys(None)  # FIXME
     self.setCrs(coordRefSys)
     # TODO: get extent from layer type
     self.setExtent(QgsRectangle(-20037508.34,
                                 -20037508.34, 20037508.34, 20037508.34))
开发者ID:dongikjang,项目名称:qgis-tmsforkorea-plugin,代码行数:10,代码来源:openlayers_layer.py

示例8: refreshItem

 def refreshItem(self, item):
     if isinstance(item, TreeItem):
         # find the index for the tree item using the path
         index = self._rPath2Index(item.path())
     else:
         # find the index for the db item
         index = self._rItem2Index(item)
     if index.isValid():
         self._refreshIndex(index)
     else:
         qDebug("invalid index")
开发者ID:NyakudyaA,项目名称:QGIS,代码行数:11,代码来源:db_model.py

示例9: setLayerType

 def setLayerType(self, layerType):
     qDebug(" setLayerType: %s" % layerType.layerTypeName)
     self.layerType = layerType
     self.setCustomProperty(OpenlayersLayer.LAYER_PROPERTY,
                            layerType.layerTypeName)
     coordRefSys = self.layerType.coordRefSys(None)  # FIXME
     self.setCrs(coordRefSys)
     
     # set layer's full extent, 2014-06-12 minpa lee
     ext = self.layerType.fullExtent
     self.setExtent(QgsRectangle(ext[0], ext[1], ext[2], ext[3]))
开发者ID:mapplus,项目名称:qgis-tmsforkorea-plugin,代码行数:11,代码来源:openlayers_layer.py

示例10: configTest

    def configTest(self, prefix, abbr):
        """Call in setUp() function of test subclass"""
        self._TestGroupPrefix = prefix
        self._TestGroupAbbr = abbr

        # insert test's Class.function marker into debug output stream
        # this helps visually track down the start of a test's debug output
        testid = self.id().split(".")
        self._TestGroup = testid[1]
        self._TestFunction = testid[2]
        testheader = "\n#####_____ {0}.{1} _____#####\n".format(self._TestGroup, self._TestFunction)
        qDebug(testheader)

        # define the shorthand name of the test (to minimize file name length)
        self._Test = "{0}_{1}".format(self._TestGroupAbbr, self._TestFunction.replace("test_", ""))
开发者ID:kalxas,项目名称:QGIS,代码行数:15,代码来源:test_qgspallabeling_base.py

示例11: testTable

    def testTable(self):
        """Test we can render a html table in a single frame."""
        layout_html = QgsLayoutItemHtml(self.layout)
        html_frame = QgsLayoutFrame(self.layout, layout_html)
        html_frame.attemptSetSceneRect(QRectF(0, 0, 100, 200))
        html_frame.setFrameEnabled(True)
        layout_html.addFrame(html_frame)
        layout_html.setUrl(self.htmlUrl())

        checker = QgsLayoutChecker('composerhtml_table', self.layout)
        checker.setControlPathPrefix("composer_html")
        myTestResult, myMessage = checker.testLayout()

        qDebug(myMessage)
        self.layout.removeMultiFrame(layout_html)
        assert myTestResult, myMessage
开发者ID:mhugo,项目名称:QGIS,代码行数:16,代码来源:test_qgslayouthtml.py

示例12: fetchFiles

    def fetchFiles(self, urls):
        self.logT("TileLayer.fetchFiles() starts")
        # create a QEventLoop object that belongs to the current thread (if ver. > 2.1, it is render thread)
        eventLoop = QEventLoop()
        self.logT("Create event loop: " + str(eventLoop))  # DEBUG
        # QObject.connect(self, SIGNAL("allRepliesFinished()"), eventLoop.quit)
        self.allRepliesFinished.connect(eventLoop.quit)

        # create a timer to watch whether rendering is stopped
        watchTimer = QTimer()
        watchTimer.timeout.connect(eventLoop.quit)

        # send a fetch request to the main thread
        # self.emit(SIGNAL("fetchRequest(QStringList)"), urls)
        self.fetchRequest.emit(urls)

        # wait for the fetch to finish
        tick = 0
        interval = 500
        timeoutTick = self.downloadTimeout / interval
        watchTimer.start(interval)
        while tick < timeoutTick:
            # run event loop for 0.5 seconds at maximum
            eventLoop.exec_()

            if debug_mode:
                qDebug("watchTimerTick: %d" % tick)
                qDebug("unfinished downloads: %d" % self.downloader.unfinishedCount())

            if self.downloader.unfinishedCount() == 0 or self.renderContext.renderingStopped():
                break
            tick += 1
        watchTimer.stop()

        if tick == timeoutTick and self.downloader.unfinishedCount() > 0:
            self.log("fetchFiles timeout")
            # self.emitShowBarMessage("fetchFiles timeout", duration=5)   #DEBUG
            self.downloader.abort()
            self.downloader.errorStatus = Downloader.TIMEOUT_ERROR
        files = self.downloader.fetchedFiles

        watchTimer.timeout.disconnect(eventLoop.quit)  #
        # QObject.disconnect(self, SIGNAL("allRepliesFinished()"), eventLoop.quit)
        self.allRepliesFinished.disconnect(eventLoop.quit)

        self.logT("TileLayer.fetchFiles() ends")
        return files
开发者ID:nextgis,项目名称:quickmapservices,代码行数:47,代码来源:tilelayer.py

示例13: testTable

    def testTable(self):
        """Test we can render a html table in a single frame."""
        composerHtml = QgsComposerHtml(self.mComposition, False)
        htmlFrame = QgsComposerFrame(self.mComposition, composerHtml, 0, 0, 100, 200)
        htmlFrame.setFrameEnabled(True)
        composerHtml.addFrame(htmlFrame)
        composerHtml.setUrl(self.htmlUrl())

        checker = QgsCompositionChecker("composerhtml_table", self.mComposition)
        checker.setControlPathPrefix("composer_html")
        myTestResult, myMessage = checker.testComposition()

        qDebug(myMessage)
        self.mComposition.removeMultiFrame(composerHtml)
        composerHtml = None

        assert myTestResult, myMessage
开发者ID:GrokImageCompression,项目名称:QGIS,代码行数:17,代码来源:test_qgscomposerhtml.py

示例14: saveControlImage

    def saveControlImage(self, tmpimg=''):
        # don't save control images for RenderVsOtherOutput (Vs) tests, since
        # those control images belong to a different test result
        if ('PAL_CONTROL_IMAGE' not in os.environ
                or 'Vs' in self._TestGroup):
            return
        imgpath = self.controlImagePath()
        testdir = os.path.dirname(imgpath)
        if not os.path.exists(testdir):
            os.makedirs(testdir)
        imgbasepath = \
            os.path.join(testdir,
                         os.path.splitext(os.path.basename(imgpath))[0])
        # remove any existing control images
        for f in glob.glob(imgbasepath + '.*'):
            if os.path.exists(f):
                os.remove(f)
        qDebug('Control image for {0}.{1}'.format(self._TestGroup,
                                                  self._TestFunction))

        if not tmpimg:
            # TODO: this can be deprecated, when per-base-test-class rendering
            #       in checkTest() is verified OK for all classes
            qDebug('Rendering control to: {0}'.format(imgpath))
            ms = self._MapSettings  # class settings
            """:type: QgsMapSettings"""
            settings_type = 'Class'
            if self._TestMapSettings is not None:
                ms = self._TestMapSettings  # per test settings
                settings_type = 'Test'
            qDebug('MapSettings type: {0}'.format(settings_type))

            img = renderMapToImage(ms, parallel=False)
            """:type: QImage"""
            tmpimg = getTempfilePath('png')
            if not img.save(tmpimg, 'png'):
                os.unlink(tmpimg)
                raise OSError('Control not created for: {0}'.format(imgpath))

        if tmpimg and os.path.exists(tmpimg):
            qDebug('Copying control to: {0}'.format(imgpath))
            shutil.copyfile(tmpimg, imgpath)
        else:
            raise OSError('Control not copied to: {0}'.format(imgpath))
开发者ID:GrokImageCompression,项目名称:QGIS,代码行数:44,代码来源:test_qgspallabeling_base.py

示例15: debug

def debug(msg, verbosity=1):
    if debuglevel >= verbosity:
        try:
            qDebug(msg)
        except Exception:
            pass
开发者ID:mapplus,项目名称:qgis-tmsforkorea-plugin,代码行数:6,代码来源:openlayers_layer.py


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