本文整理汇总了Python中qgis.PyQt.QtCore.QUrl.fromLocalFile方法的典型用法代码示例。如果您正苦于以下问题:Python QUrl.fromLocalFile方法的具体用法?Python QUrl.fromLocalFile怎么用?Python QUrl.fromLocalFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.PyQt.QtCore.QUrl
的用法示例。
在下文中一共展示了QUrl.fromLocalFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadInventoryFile
# 需要导入模块: from qgis.PyQt.QtCore import QUrl [as 别名]
# 或者: from qgis.PyQt.QtCore.QUrl import fromLocalFile [as 别名]
def loadInventoryFile(self, outputFile, isOnlyGeo):
"""
Loads the inventory upon completion
"""
if not isOnlyGeo:
# Adding the layer and making it active
url = QUrl.fromLocalFile(outputFile)
url.addQueryItem('delimiter', ',')
layer_uri = str(url.toEncoded())
layer = self.iface.addVectorLayer(layer_uri, 'Inventory', 'delimitedtext')
else:
layer = self.iface.addVectorLayer(outputFile, 'Inventory', 'ogr')
if layer:
self.iface.setActiveLayer(layer)
# Creating and Attribute Action to load the inventoried file
actions = layer.actions()
field = '[% "fileName" %]'
actions.addAction(QgsAction.GenericPython, 'Load Vector Layer', 'qgis.utils.iface.addVectorLayer(r\'%s\', \'File\', \'ogr\')' % field)
actions.addAction(QgsAction.GenericPython, 'Load Raster Layer', 'qgis.utils.iface.addRasterLayer(r\'%s\', \'File\')' % field)
示例2: help
# 需要导入模块: from qgis.PyQt.QtCore import QUrl [as 别名]
# 或者: from qgis.PyQt.QtCore.QUrl import fromLocalFile [as 别名]
def help(self):
'''Display a help page'''
url = QUrl.fromLocalFile(os.path.dirname(__file__) + "/index.html").toString()
webbrowser.open(url, new=2)
示例3: helpUrl
# 需要导入模块: from qgis.PyQt.QtCore import QUrl [as 别名]
# 或者: from qgis.PyQt.QtCore.QUrl import fromLocalFile [as 别名]
def helpUrl(self):
file = os.path.dirname(__file__) + '/index.html'
if not os.path.exists(file):
return ''
return QUrl.fromLocalFile(file).toString(QUrl.FullyEncoded)
示例4: help
# 需要导入模块: from qgis.PyQt.QtCore import QUrl [as 别名]
# 或者: from qgis.PyQt.QtCore.QUrl import fromLocalFile [as 别名]
def help(self):
'''Display a help page'''
import webbrowser
url = QUrl.fromLocalFile(os.path.dirname(__file__) + "/index.html").toString()
webbrowser.open(url, new=2)
示例5: open_help
# 需要导入模块: from qgis.PyQt.QtCore import QUrl [as 别名]
# 或者: from qgis.PyQt.QtCore.QUrl import fromLocalFile [as 别名]
def open_help(self):
QDesktopServices.openUrl(
QUrl.fromLocalFile(
os.path.join(
os.path.dirname(__file__), "doc", "build", "html", "index.html"
)
)
)
示例6: help
# 需要导入模块: from qgis.PyQt.QtCore import QUrl [as 别名]
# 或者: from qgis.PyQt.QtCore.QUrl import fromLocalFile [as 别名]
def help(self):
url = QUrl.fromLocalFile(os.path.dirname(__file__) + "/index.html").toString()
webbrowser.open(url, new=2)
示例7: help
# 需要导入模块: from qgis.PyQt.QtCore import QUrl [as 别名]
# 或者: from qgis.PyQt.QtCore.QUrl import fromLocalFile [as 别名]
def help(self):
'''Display a help page'''
url = QUrl.fromLocalFile(self.plugin_dir + '/index.html').toString()
webbrowser.open(url, new=2)