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


Python QtGui.QDesktopServices类代码示例

本文整理汇总了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"))
开发者ID:3liz,项目名称:QuickOSM,代码行数:7,代码来源:QuickOSMWidget.py

示例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))
开发者ID:3liz,项目名称:QuickOSM,代码行数:7,代码来源:query_dialog.py

示例3: openLink

 def openLink(self, url):
     if url.toString() == "log":
         self.close()
         logDock = iface.mainWindow().findChild(QDockWidget, 'MessageLog')
         logDock.show()
     else:
         QDesktopServices.openUrl(url)
开发者ID:cz172638,项目名称:QGIS,代码行数:7,代码来源:MessageDialog.py

示例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))
开发者ID:CS-SI,项目名称:QGIS,代码行数:8,代码来源:console.py

示例5: openHelp

    def openHelp(self):
        locale = QgsApplication.locale()

        if locale in ['uk']:
            QDesktopServices.openUrl(
                QUrl(self.home))
        else:
            QDesktopServices.openUrl(
                QUrl(self.home))
开发者ID:alexbruy,项目名称:qconsolidate,代码行数:9,代码来源:aboutdialog.py

示例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'))
开发者ID:alexbruy,项目名称:photo2shape,代码行数:9,代码来源:aboutdialog.py

示例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
开发者ID:rldhont,项目名称:QgisCadastrePlugin,代码行数:10,代码来源:cadastre_export_dialog.py

示例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')
                )
开发者ID:DelazJ,项目名称:MapsPrinter,代码行数:12,代码来源:maps_printer.py

示例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'))
开发者ID:alexbruy,项目名称:qscatter,代码行数:13,代码来源:aboutdialog.py

示例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))
开发者ID:inasafe,项目名称:inasafe,代码行数:13,代码来源:help.py

示例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)))
开发者ID:boundlessgeo,项目名称:desktop-documentation,代码行数:33,代码来源:qgis-settings-to-ini.py

示例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))
开发者ID:3liz,项目名称:QuickOSM,代码行数:19,代码来源:actions.py

示例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)
开发者ID:qgiscloud,项目名称:qgis-cloud-plugin,代码行数:22,代码来源:error_report_dialog.py

示例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
开发者ID:3liz,项目名称:QuickOSM,代码行数:64,代码来源:actions.py

示例15: giveHelp

 def giveHelp(self):
     self.showInfo('Giving help')
     QDesktopServices.openUrl(QUrl.fromLocalFile(
                      self.plugin_dir + "/help/html/index.html"))
开发者ID:havatv,项目名称:qgisstandarddeviationalellipseplugin,代码行数:4,代码来源:SDEllipse_dialog.py


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