本文整理汇总了Python中qgis.PyQt.QtGui.QDesktopServices类的典型用法代码示例。如果您正苦于以下问题:Python QDesktopServices类的具体用法?Python QDesktopServices怎么用?Python QDesktopServices使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDesktopServices类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open_map_features
def open_map_features():
"""
Open MapFeatures
"""
desktop_service = QDesktopServices()
desktop_service.openUrl(
QUrl("http://wiki.openstreetmap.org/wiki/Mapfeatures"))
示例2: open_doc_overpass
def open_doc_overpass():
"""
Open Overpass's documentation
"""
url = "http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide"
desktop_service = QDesktopServices()
desktop_service.openUrl(QUrl(url))
示例3: openLink
def openLink(self, url):
if url.toString() == "log":
self.close()
logDock = iface.mainWindow().findChild(QDockWidget, 'MessageLog')
logDock.show()
else:
QDesktopServices.openUrl(url)
示例4: openScriptFileExtEditor
def openScriptFileExtEditor(self):
tabWidget = self.tabEditorWidget.currentWidget()
path = tabWidget.path
import subprocess
try:
subprocess.Popen([os.environ['EDITOR'], path])
except KeyError:
QDesktopServices.openUrl(QUrl.fromLocalFile(path))
示例5: openHelp
def openHelp(self):
locale = QgsApplication.locale()
if locale in ['uk']:
QDesktopServices.openUrl(
QUrl(self.home))
else:
QDesktopServices.openUrl(
QUrl(self.home))
示例6: openHelp
def openHelp(self):
locale = QgsApplication.locale()
if locale in ['uk']:
QDesktopServices.openUrl(
QUrl('https://github.com/alexbruy/photo2shape'))
else:
QDesktopServices.openUrl(
QUrl('https://github.com/alexbruy/photo2shape'))
示例7: exportAsPDF
def exportAsPDF(self):
paths = super().exportAsPDF()
if self.isMulti:
info = u"Les relevés ont été enregistrés dans le répertoire :\n%s\n\nOuvrir le dossier ?" % self.targetDir
openFolder = QDesktopServices()
openFolder.openUrl(QUrl('file:///%s' % self.targetDir))
return paths
示例8: showHelp
def showHelp(self):
"""Shows the help page."""
locale = QSettings().value('locale/userLocale')[0:2]
help_file = self.plugin_dir + '/help/help_{}.html'.format(locale)
if os.path.exists(help_file):
QDesktopServices.openUrl(QUrl('file:///'+ help_file))
else:
QDesktopServices.openUrl(QUrl(
'file:///'+ self.plugin_dir + '/help/help.html')
)
示例9: openHelp
def openHelp(self):
overrideLocale = QSettings().value('locale/overrideFlag', False, bool)
if not overrideLocale:
locale = QLocale.system().name()[:2]
else:
locale = QSettings().value('locale/userLocale', '')
if locale in ['uk']:
QDesktopServices.openUrl(
QUrl('https://github.com/alexbruy/qscatter'))
else:
QDesktopServices.openUrl(
QUrl('https://github.com/alexbruy/qscatter'))
示例10: show_help
def show_help(message=None):
"""Open an help message in the user's browser
:param message: An optional message object to display in the dialog.
:type message: Message.Message
"""
help_path = mktemp('.html')
with open(help_path, 'wb+') as f:
help_html = get_help_html(message)
f.write(help_html.encode('utf8'))
path_with_protocol = 'file://' + help_path
QDesktopServices.openUrl(QUrl(path_with_protocol))
示例11: main
def main():
datestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
if QT5:
ini_out_dir = QStandardPaths.writableLocation(QStandardPaths.DesktopLocation)
else:
ini_out_dir = QDesktopServices.storageLocation(QDesktopServices.DesktopLocation)
ini_name = 'org.qgis.{0}-settings_{1}.ini'.format(QGIS_APP_NAME, datestamp)
ini_out = QDir(ini_out_dir).absoluteFilePath(ini_name)
if not os.path.exists(ini_out_dir):
print('INI output directory does not exist: {0}'.format(ini_out_dir))
return
if not os.access(ini_out_dir, os.W_OK | os.X_OK):
print('INI output directory is not writeable: {0}'.format(ini_out_dir))
return
# QGIS settings
if HAS_QGSSETTINGS:
qgis_settings = QgsSettings()
else:
qgis_settings = QSettings()
# Output INI settings
ini_settings = QSettings(ini_out, QSettings.IniFormat)
qgis_keys = qgis_settings.allKeys()
for k in qgis_keys:
ini_settings.setValue(k, qgis_settings.value(k))
ini_settings.sync()
print("Settings output to: {0}".format(QDir.toNativeSeparators(ini_out)))
示例12: run_sketch_line
def run_sketch_line(network, ref):
"""
Run an action with two values for sketchline
@param network:network of the bus
@type network:str
@param ref:ref of the bus
@type ref:str
"""
if network == '' or ref == '':
iface.messageBar().pushMessage(
tr('Sorry, this field is empty for this entity.'),
level=Qgis.Warning,
duration=7)
else:
var = QDesktopServices()
url = 'http://www.overpass-api.de/api/sketch-line?' \
'network=' + network + '&ref=' + ref
var.openUrl(QUrl(url))
示例13: __reportError
def __reportError(self):
body = ("Please provide any additional information here:\n\n\n"
"If you encountered an upload error, if possible please attach a zip file containing a minimal extract of the dataset, as well as the QGIS project file.\n\n\n"
"Technical information:\n%s\n\n"
"Versions:\n"
" QGIS: %s\n"
" Python: %s\n"
" OS: %s\n"
" QGIS Cloud Plugin: %s\n\n"
"Username: %s\n") % (
self.plainTextEdit.toPlainText(),
Qgis.QGIS_VERSION,
sys.version.replace("\n", " "),
platform.platform(),
self.metadata.version(),
self.username)
url = QUrl()
url.toEncoded("mailto:[email protected]?subject=%s&body=%s" % (
urllib.parse.quote(self.windowTitle()),
urllib.parse.quote(body)),
)
QDesktopServices.openUrl(url)
示例14: run
def run(field, value):
"""
Run an action with only one value as parameter
@param field:Type of the action
@type field:str
@param value:Value of the field for one entity
@type value:str
"""
if value == '':
iface.messageBar().pushMessage(
tr('Sorry, this field \'{}\' is empty for this entity.'
.format(field)),
level=Qgis.Warning, duration=7)
else:
if field in ['url', 'website', 'wikipedia', 'wikidata']:
var = QDesktopServices()
url = None
if field == 'url' or field == 'website':
url = value
if field == 'ref_UAI':
url = "http://www.education.gouv.fr/pid24302/annuaire-" \
"resultat-recherche.html?lycee_name=" + value
if field == 'wikipedia':
url = "http://en.wikipedia.org/wiki/" + value
if field == 'wikidata':
url = "http://www.wikidata.org/wiki/" + value
var.openUrl(QUrl(url))
elif field == 'mapillary':
if 'go2mapillary' in plugins:
plugins['go2mapillary'].dockwidget.show()
plugins["go2mapillary"].mainAction.setChecked(False)
plugins['go2mapillary'].viewer.openLocation(value)
else:
var = QDesktopServices()
url = 'https://www.mapillary.com/map/im/' + value
var.openUrl(QUrl(url))
elif field == 'josm':
import urllib.request, urllib.error, urllib.parse
try:
url = 'http://localhost:8111/load_object?objects=' + value
urllib.request.urlopen(url).read()
except urllib.error.URLError:
iface.messageBar().pushMessage(
tr('The JOSM remote seems to be disabled.'),
level=Qgis.Critical,
duration=7)
# NOT USED
elif field == 'rawedit':
# url = QUrl("http://rawedit.openstreetmap.fr/edit/" + value)
# web_browser = QWebView(None)
# web_browser.load(url)
# web_browser.show()
pass
示例15: giveHelp
def giveHelp(self):
self.showInfo('Giving help')
QDesktopServices.openUrl(QUrl.fromLocalFile(
self.plugin_dir + "/help/html/index.html"))