本文整理汇总了Python中PyQt.QtCore.QDir.toNativeSeparators方法的典型用法代码示例。如果您正苦于以下问题:Python QDir.toNativeSeparators方法的具体用法?Python QDir.toNativeSeparators怎么用?Python QDir.toNativeSeparators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt.QtCore.QDir
的用法示例。
在下文中一共展示了QDir.toNativeSeparators方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testQgsCentroidFillSymbolLayerV2
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def testQgsCentroidFillSymbolLayerV2(self):
"""
Create a new style from a .sld file and match test
"""
mTestName = 'QgsCentroidFillSymbolLayerV2'
mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.sld' % (unitTestDataPath(), mTestName))
mDoc = QDomDocument(mTestName)
mFile = QFile(mFilePath)
mFile.open(QIODevice.ReadOnly)
mDoc.setContent(mFile, True)
mFile.close()
mSymbolLayer = QgsCentroidFillSymbolLayerV2.createFromSld(
mDoc.elementsByTagName('PointSymbolizer').item(0).toElement())
mExpectedValue = type(QgsCentroidFillSymbolLayerV2())
mValue = type(mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'regular_star'
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'#55aaff'
mValue = mSymbolLayer.subSymbol().symbolLayer(0).color().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'#00ff00'
mValue = mSymbolLayer.subSymbol().symbolLayer(0).borderColor().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
示例2: testQgsSvgMarkerSymbolLayerV2
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def testQgsSvgMarkerSymbolLayerV2(self):
"""
Create a new style from a .sld file and match test
"""
mTestName = 'QgsSvgMarkerSymbolLayerV2'
mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.sld' % (unitTestDataPath(), mTestName))
mDoc = QDomDocument(mTestName)
mFile = QFile(mFilePath)
mFile.open(QIODevice.ReadOnly)
mDoc.setContent(mFile, True)
mFile.close()
mSymbolLayer = QgsSvgMarkerSymbolLayerV2.createFromSld(mDoc.elementsByTagName('PointSymbolizer').item(0).toElement())
mExpectedValue = type(QgsSvgMarkerSymbolLayerV2())
mValue = type(mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'skull.svg'
mValue = os.path.basename(mSymbolLayer.path())
print("VALUE", mSymbolLayer.path())
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 12
mValue = mSymbolLayer.size()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 45
mValue = mSymbolLayer.angle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
示例3: testQgsSVGFillSymbolLayer
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def testQgsSVGFillSymbolLayer(self):
"""
Create a new style from a .sld file and match test
"""
mTestName = 'QgsSVGFillSymbolLayer'
mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.sld' % (unitTestDataPath(), mTestName))
mDoc = QDomDocument(mTestName)
mFile = QFile(mFilePath)
mFile.open(QIODevice.ReadOnly)
mDoc.setContent(mFile, True)
mFile.close()
mSymbolLayer = QgsSVGFillSymbolLayer.createFromSld(
mDoc.elementsByTagName('PolygonSymbolizer').item(0).toElement())
mExpectedValue = type(QgsSVGFillSymbolLayer())
mValue = type(mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 'accommodation_camping.svg'
mValue = os.path.basename(mSymbolLayer.svgFilePath())
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 6
mValue = mSymbolLayer.patternWidth()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
示例4: testQgsSimpleLineSymbolLayerV2
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def testQgsSimpleLineSymbolLayerV2(self):
"""
Create a new style from a .sld file and match test
"""
mTestName = 'QgsSimpleLineSymbolLayerV2'
mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.sld' % (unitTestDataPath(), mTestName))
mDoc = QDomDocument(mTestName)
mFile = QFile(mFilePath)
mFile.open(QIODevice.ReadOnly)
mDoc.setContent(mFile, True)
mFile.close()
mSymbolLayer = QgsSimpleLineSymbolLayerV2.createFromSld(
mDoc.elementsByTagName('LineSymbolizer').item(0).toElement())
mExpectedValue = type(QgsSimpleLineSymbolLayerV2())
mValue = type(mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'#aa007f'
mValue = mSymbolLayer.color().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 1.26
mValue = mSymbolLayer.width()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = Qt.RoundCap
mValue = mSymbolLayer.penCapStyle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = Qt.MiterJoin
mValue = mSymbolLayer.penJoinStyle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = True
mValue = mSymbolLayer.useCustomDashPattern()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = [5.0, 2.0]
mValue = mSymbolLayer.customDashVector()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
示例5: testQgsPointPatternFillSymbolLayer
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def testQgsPointPatternFillSymbolLayer(self):
"""
Create a new style from a .sld file and match test
"""
# at the moment there is an empty createFromSld implementation
# that return nulls
mTestName = 'QgsPointPatternFillSymbolLayer'
mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.sld' % (unitTestDataPath(), mTestName))
mDoc = QDomDocument(mTestName)
mFile = QFile(mFilePath)
mFile.open(QIODevice.ReadOnly)
mDoc.setContent(mFile, True)
mFile.close()
mSymbolLayer = QgsPointPatternFillSymbolLayer.createFromSld(
mDoc.elementsByTagName('PolygonSymbolizer').item(0).toElement())
mExpectedValue = type(QgsPointPatternFillSymbolLayer())
mValue = type(mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'triangle'
mValue = mSymbolLayer.subSymbol().symbolLayer(0).name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'#ffaa00'
mValue = mSymbolLayer.subSymbol().symbolLayer(0).color().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'#ff007f'
mValue = mSymbolLayer.subSymbol().symbolLayer(0).borderColor().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 5
mValue = mSymbolLayer.subSymbol().symbolLayer(0).angle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 3
mValue = mSymbolLayer.subSymbol().symbolLayer(0).size()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
示例6: testQgsEllipseSymbolLayerV2
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def testQgsEllipseSymbolLayerV2(self):
"""
Create a new style from a .sld file and match test
"""
mTestName = 'QgsEllipseSymbolLayerV2'
mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.sld' % (unitTestDataPath(), mTestName))
mDoc = QDomDocument(mTestName)
mFile = QFile(mFilePath)
mFile.open(QIODevice.ReadOnly)
mDoc.setContent(mFile, True)
mFile.close()
mSymbolLayer = QgsEllipseSymbolLayerV2.createFromSld(
mDoc.elementsByTagName('PointSymbolizer').item(0).toElement())
mExpectedValue = type(QgsEllipseSymbolLayerV2())
mValue = type(mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'circle'
mValue = mSymbolLayer.symbolName()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'#ffff7f'
mValue = mSymbolLayer.fillColor().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'#aaaaff'
mValue = mSymbolLayer.outlineColor().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 7
mValue = mSymbolLayer.symbolWidth()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 5
mValue = mSymbolLayer.symbolHeight()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
示例7: testQgsFontMarkerSymbolLayerV2
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def testQgsFontMarkerSymbolLayerV2(self):
"""
Create a new style from a .sld file and match test
"""
mTestName = 'QgsFontMarkerSymbolLayerV2'
mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.sld' % (unitTestDataPath(), mTestName))
mDoc = QDomDocument(mTestName)
mFile = QFile(mFilePath)
mFile.open(QIODevice.ReadOnly)
mDoc.setContent(mFile, True)
mFile.close()
mSymbolLayer = QgsFontMarkerSymbolLayerV2.createFromSld(
mDoc.elementsByTagName('PointSymbolizer').item(0).toElement())
mExpectedValue = type(QgsFontMarkerSymbolLayerV2())
mValue = type(mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'Arial'
mValue = mSymbolLayer.fontFamily()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u"M"
mValue = mSymbolLayer.character()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 6.23
mValue = mSymbolLayer.size()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 3
mValue = mSymbolLayer.angle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
示例8: testQgsLinePatternFillSymbolLayer
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def testQgsLinePatternFillSymbolLayer(self):
"""
Create a new style from a .sld file and match test
"""
mTestName = 'QgsLinePatternFillSymbolLayer'
mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.sld' % (unitTestDataPath(), mTestName))
mDoc = QDomDocument(mTestName)
mFile = QFile(mFilePath)
mFile.open(QIODevice.ReadOnly)
mDoc.setContent(mFile, True)
mFile.close()
mSymbolLayer = QgsLinePatternFillSymbolLayer.createFromSld(
mDoc.elementsByTagName('PolygonSymbolizer').item(0).toElement())
mExpectedValue = type(QgsLinePatternFillSymbolLayer())
mValue = type(mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'#ff55ff'
mValue = mSymbolLayer.color().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 1.5
mValue = mSymbolLayer.lineWidth()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 4
mValue = mSymbolLayer.distance()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 57
mValue = mSymbolLayer.lineAngle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
示例9: testQgsSimpleFillSymbolLayerV2
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def testQgsSimpleFillSymbolLayerV2(self):
"""Create a new style from a .sld file and match test.
"""
mTestName = 'QgsSimpleFillSymbolLayerV2'
mFilePath = QDir.toNativeSeparators('%s/symbol_layer/%s.sld' % (unitTestDataPath(), mTestName))
mDoc = QDomDocument(mTestName)
mFile = QFile(mFilePath)
mFile.open(QIODevice.ReadOnly)
mDoc.setContent(mFile, True)
mFile.close()
mSymbolLayer = QgsSimpleFillSymbolLayerV2.createFromSld(
mDoc.elementsByTagName('PolygonSymbolizer').item(0).toElement())
mExpectedValue = type(QgsSimpleFillSymbolLayerV2())
mValue = type(mSymbolLayer)
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = Qt.SolidPattern
mValue = mSymbolLayer.brushStyle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = u'#ffaa7f'
mValue = mSymbolLayer.borderColor().name()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = Qt.DotLine
mValue = mSymbolLayer.borderStyle()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
mExpectedValue = 0.26
mValue = mSymbolLayer.borderWidth()
mMessage = 'Expected "%s" got "%s"' % (mExpectedValue, mValue)
assert mExpectedValue == mValue, mMessage
示例10: defaultOutputFolder
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def defaultOutputFolder():
folder = os.path.join(userFolder(), "outputs")
if not QDir(folder).exists():
QDir().mkpath(folder)
return unicode(QDir.toNativeSeparators(folder))
示例11: userFolder
# 需要导入模块: from PyQt.QtCore import QDir [as 别名]
# 或者: from PyQt.QtCore.QDir import toNativeSeparators [as 别名]
def userFolder():
userDir = os.path.join(QgsApplication.qgisSettingsDirPath(), 'processing')
if not QDir(userDir).exists():
QDir().mkpath(userDir)
return unicode(QDir.toNativeSeparators(userDir))