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


Python QDir.separator方法代码示例

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


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

示例1: testComposition

# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import separator [as 别名]
    def testComposition(self, page=0, pixelDiff=0):
        if self.mComposition is None:
            myMessage = "Composition not valid"
            return False, myMessage

        # load expected image
        self.setControlName("expected_" + self.mTestName)

        # get width/height, create image and render the composition to it
        outputImage = QImage(self.mSize, QImage.Format_RGB32)

        self.mComposition.setPlotStyle(QgsComposition.Print)
        outputImage.setDotsPerMeterX(self.mDotsPerMeter)
        outputImage.setDotsPerMeterY(self.mDotsPerMeter)
        QgsMultiRenderChecker.drawBackground(outputImage)
        p = QPainter(outputImage)
        self.mComposition.renderPage(p, page)
        p.end()

        renderedFilePath = QDir.tempPath() + QDir.separator() + QFileInfo(self.mTestName).baseName() + "_rendered.png"
        outputImage.save(renderedFilePath, "PNG")

        self.setRenderedImage(renderedFilePath)

        testResult = self.runTest(self.mTestName, pixelDiff)

        return testResult, self.report()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:29,代码来源:qgscompositionchecker.py

示例2: requestFinished

# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import separator [as 别名]
 def requestFinished(self):
     reply = self.sender()
     self.buttonBox.setEnabled(False)
     if reply.error() != QNetworkReply.NoError:
         self.mResult = reply.errorString()
         if reply.error() == QNetworkReply.OperationCanceledError:
             self.mResult += "<br/><br/>" + QCoreApplication.translate("QgsPluginInstaller", "If you haven't cancelled the download manually, it might be caused by a timeout. In this case consider increasing the connection timeout value in QGIS options.")
         self.reject()
         reply.deleteLater()
         return
     self.file.open(QFile.WriteOnly)
     self.file.write(reply.readAll())
     self.file.close()
     self.stateChanged(0)
     reply.deleteLater()
     pluginDir = qgis.utils.home_plugin_path
     tmpPath = self.file.fileName()
     # make sure that the parent directory exists
     if not QDir(pluginDir).exists():
         QDir().mkpath(pluginDir)
     # if the target directory already exists as a link, remove the link without resolving:
     QFile(pluginDir + unicode(QDir.separator()) + self.plugin["id"]).remove()
     try:
         unzip(unicode(tmpPath), unicode(pluginDir))  # test extract. If fails, then exception will be raised and no removing occurs
         # removing old plugin files if exist
         removeDir(QDir.cleanPath(pluginDir + "/" + self.plugin["id"]))  # remove old plugin if exists
         unzip(unicode(tmpPath), unicode(pluginDir))  # final extract.
     except:
         self.mResult = self.tr("Failed to unzip the plugin package. Probably it's broken or missing from the repository. You may also want to make sure that you have write permission to the plugin directory:") + "\n" + pluginDir
         self.reject()
         return
     try:
         # cleaning: removing the temporary zip file
         QFile(tmpPath).remove()
     except:
         pass
     self.close()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:39,代码来源:qgsplugininstallerinstallingdialog.py

示例3: getOutputFileName

# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import separator [as 别名]
 def getOutputFileName(self):
     if self.useDirAsOutput:
         if self.outSelector.filename():
             return self.outSelector.filename() + QDir.separator() + "contour.shp"
     return self.outSelector.filename()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:7,代码来源:doContour.py


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