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


Python QUrlQuery.addQueryItem方法代码示例

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


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

示例1: suggestionsUrl

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
 def suggestionsUrl(self, searchTerm):
     """
     Public method to get a URL ready for suggestions.
     
     @param searchTerm term to search for (string)
     @return URL (QUrl)
     """
     if not self._suggestionsUrlTemplate:
         return QUrl()
     
     ret = QUrl.fromEncoded(QByteArray(self.parseTemplate(
         searchTerm, self._suggestionsUrlTemplate).encode("utf-8")))
     
     if self.__searchMethod != "post":
         if qVersion() >= "5.0.0":
             from PyQt5.QtCore import QUrlQuery
             urlQuery = QUrlQuery(ret)
             for parameter in self._suggestionsParameters:
                 urlQuery.addQueryItem(
                     parameter[0],
                     self.parseTemplate(searchTerm, parameter[1]))
             ret.setQuery(urlQuery)
         else:
             for parameter in self._suggestionsParameters:
                 ret.addQueryItem(
                     parameter[0],
                     self.parseTemplate(searchTerm, parameter[1]))
     
     return ret
开发者ID:testmana2,项目名称:test,代码行数:31,代码来源:OpenSearchEngine.py

示例2: test_file_pathsep

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
 def test_file_pathsep(self, sep):
     url = QUrl('qute://pdfjs/file')
     query = QUrlQuery()
     query.addQueryItem('filename', 'foo{}bar'.format(sep))
     url.setQuery(query)
     with pytest.raises(qutescheme.RequestDeniedError):
         qutescheme.data_for_url(url)
开发者ID:mehak,项目名称:qutebrowser,代码行数:9,代码来源:test_qutescheme.py

示例3: getHttp

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
    def getHttp(self, uri, params):
        QgsApplication.setOverrideCursor(Qt.WaitCursor)
        try:
            rq = QUrl(uri)
            q = QUrlQuery()
            for (k, v) in params.items():
                q.addQueryItem(k, v)

            rq.setQuery(q)
            req = QNetworkRequest(rq)

            try:
                reply = self.nominatim_networkAccessManager.blockingGet(req)
                resource = reply.content().data().decode('utf8')
                r = json.loads(resource)

                if (isinstance(r, list)):
                    self.populateTable(r)
                else:
                    self.populateTable([r])
            except:
                self.tableResult.clearContents()

        finally:
            QgsApplication.restoreOverrideCursor()
开发者ID:xcaeag,项目名称:Nominatim-Qgis-Plugin,代码行数:27,代码来源:nominatim_dlg.py

示例4: get_main_url

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
def get_main_url(filename):
    """Get the URL to be opened to view a local PDF."""
    url = QUrl('qute://pdfjs/web/viewer.html')
    query = QUrlQuery()
    query.addQueryItem('filename', filename)  # read from our JS
    query.addQueryItem('file', '')  # to avoid pdfjs opening the default PDF
    url.setQuery(query)
    return url
开发者ID:The-Compiler,项目名称:qutebrowser,代码行数:10,代码来源:pdfjs.py

示例5: email

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
def email(subject, body):
    """Opens the e-mail composer with the given subject and body, with version information added to it."""
    subject = "[{0} {1}] {2}".format(appinfo.appname, appinfo.version, subject)
    body = "{0}\n\n{1}\n\n".format(debuginfo.version_info_string(' -- '), body)
    url = QUrl("mailto:" + appinfo.maintainer_email)
    query = QUrlQuery()
    query.addQueryItem("subject", subject)
    query.addQueryItem("body", body)
    url.setQuery(query)
    helpers.openUrl(url, "email")
开发者ID:19joho66,项目名称:frescobaldi,代码行数:12,代码来源:bugreport.py

示例6: load_account_page

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
 def load_account_page(self, account, tab=None, task=None, reset_history=False, set_home=False):
     self.tab = tab
     self.task = task
     self.account = account
     url = QUrl(account.server.settings_url)
     url_query = QUrlQuery()
     for name, value in self.query_items:
         url_query.addQueryItem(name, value)
     url.setQuery(url_query)
     if set_home:
         self.homepage = url
     if reset_history:
         self.history().clear()
         self.page().mainFrame().evaluateJavaScript('window.location.replace("{}");'.format(url.toString()))  # this will replace the current url in the history
     else:
         self.load(url)
开发者ID:AGProjects,项目名称:blink-qt,代码行数:18,代码来源:accounts.py

示例7: exchange_authorization_code

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
 def exchange_authorization_code(self, authorization_code, scopes, callback):
     log.debug("OAuth: exchanging authorization_code %s for an access_token", authorization_code)
     host, port = config.setting['server_host'], config.setting['server_port']
     path = "/oauth2/token"
     url = QUrl()
     url_query = QUrlQuery()
     url_query.addQueryItem("grant_type", "authorization_code")
     url_query.addQueryItem("code", authorization_code)
     url_query.addQueryItem("client_id", MUSICBRAINZ_OAUTH_CLIENT_ID)
     url_query.addQueryItem("client_secret", MUSICBRAINZ_OAUTH_CLIENT_SECRET)
     url_query.addQueryItem("redirect_uri", "urn:ietf:wg:oauth:2.0:oob")
     url.setQuery(url_query.query(QUrl.FullyEncoded))
     data = string_(url.query())
     self.webservice.post(host, port, path, data,
                     partial(self.on_exchange_authorization_code_finished, scopes, callback),
                     parse_response_type=None, mblogin=True, priority=True, important=True)
开发者ID:Sophist-UK,项目名称:Sophist_picard,代码行数:18,代码来源:oauth.py

示例8: loadMessages

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
    def loadMessages(self, skip=None, beforeId=None, afterId=None, limit=50):
        logger.debug("listMessages")
        url = QUrl(
            GITTER_API + "/rooms/{}/chatMessages".format(self.id)
        )
        query = QUrlQuery()
        if skip:
            query.addQueryItem("skip", str(skip))
        if beforeId:
            query.addQueryItem("beforeId", str(beforeId))
        if afterId:
            query.addQueryItem("afterId", str(afterId))
        elif self._messages.last_id:
            query.addQueryItem("afterId", str(self._messages.last_id()))
        if limit:
            query.addQueryItem("limit", str(limit))

        url.setQuery(query)
        req = makeRequest(url, self._auth)
        reply = self._net.get(req)
        reply.finished.connect(lambda: self.readMessages(reply))
开发者ID:detrout,项目名称:telepathy-gitter,代码行数:23,代码来源:rooms.py

示例9: _generate_pdfjs_script

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
def _generate_pdfjs_script(filename):
    """Generate the script that shows the pdf with pdf.js.

    Args:
        filename: The name of the file to open.
    """
    url = QUrl('qute://pdfjs/file')
    url_query = QUrlQuery()
    url_query.addQueryItem('filename', filename)
    url.setQuery(url_query)

    return jinja.js_environment.from_string("""
        document.addEventListener("DOMContentLoaded", function() {
          if (typeof window.PDFJS !== 'undefined') {
              // v1.x
              {% if disable_create_object_url %}
              window.PDFJS.disableCreateObjectURL = true;
              {% endif %}
              window.PDFJS.verbosity = window.PDFJS.VERBOSITY_LEVELS.info;
          } else {
              // v2.x
              const options = window.PDFViewerApplicationOptions;
              {% if disable_create_object_url %}
              options.set('disableCreateObjectURL', true);
              {% endif %}
              options.set('verbosity', pdfjsLib.VerbosityLevel.INFOS);
          }

          const viewer = window.PDFView || window.PDFViewerApplication;
          viewer.open({{ url }});
        });
    """).render(
        url=javascript.to_js(url.toString(QUrl.FullyEncoded)),
        # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-70420
        disable_create_object_url=(
            not qtutils.version_check('5.12') and
            not qtutils.version_check('5.7.1', exact=True, compiled=False) and
            objects.backend == usertypes.Backend.QtWebEngine))
开发者ID:The-Compiler,项目名称:qutebrowser,代码行数:40,代码来源:pdfjs.py

示例10: exceptHook

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
def exceptHook(type_, value, tback):
    stack = ''.join(traceback.format_exception(type_, value, tback))

    title = QApplication.translate("ExcpHook", "System error")
    text = QApplication.translate("ExcpHook",
                        "A system error occurred.\n"
                        "Do you want to send an error message to the author?")
    msgBox = QMessageBox(QMessageBox.Information, title, text)
    msgBox.setDetailedText(stack)
    msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
    if msgBox.exec_() == QMessageBox.Yes:
        line = traceback.extract_tb(tback)[-1]
        subject = "[v%s] %s - %s:%d" % (version.Version, type_.__name__,
                                        line[0], line[1])

        errorMessage = []
        # errorMessage.append(QApplication.translate(
        #    "ExcpHook",
        #    "PLEASE ADD A COMMENT, IT WILL HELP IN SOLVING THE PROBLEM"))
        # errorMessage.append('')
        errorMessage.append("%s: %s" % (version.AppName, version.Version))
        errorMessage.append("OS: %s %s (%s)" % (platform.system(),
                                                platform.release(),
                                                platform.version()))
        errorMessage.append("Python: %s (%s)" % (platform.python_version(),
                                                 platform.architecture()[0]))
        errorMessage.append("Qt: %s" % PYQT_VERSION_STR)
        try:
            errorMessage.append("Locale: %s" % Settings()['locale'])
        except:
            pass

        errorMessage.append('')
        errorMessage.append(stack)

        url = QUrl('http://opennumismat.idea.informer.com/proj/')
        query = QUrlQuery()
        query.addQueryItem('mod', 'add')
        query.addQueryItem('cat', '3')
        query.addQueryItem('idea', subject)
        query.addQueryItem('descr', '\n'.join(errorMessage))
        url.setQuery(query)

        executor = QDesktopServices()
        executor.openUrl(url)

    # Call the default handler
    sys.__excepthook__(type_, value, tback)
开发者ID:OpenNumismat,项目名称:open-numismat,代码行数:50,代码来源:main.py

示例11: exceptHook

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
def exceptHook(type_, value, tback):
    stack = ''.join(traceback.format_exception(type_, value, tback))

    title = QApplication.translate("ExcpHook", "System error")
    text = QApplication.translate("ExcpHook",
                        "A system error occurred.\n"
                        "Do you want to send an error message to the author\n"
                        "(Google account required)?")
    msgBox = QMessageBox(QMessageBox.Information, title, text)
    msgBox.setDetailedText(stack)
    msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
    if msgBox.exec_() == QMessageBox.Yes:
        line = traceback.extract_tb(tback, 1)[0]
        subject = "[v%s] %s - %s:%d" % (version.Version, type_.__name__,
                                        line[0], line[1])

        errorMessage = []
        errorMessage.append("%s: %s" % (version.AppName, version.Version))
        errorMessage.append("OS: %s %s %s (%s)" % (platform.system(),
                                                   platform.release(),
                                                   platform.architecture()[0],
                                                   platform.version()))
        errorMessage.append("Python: %s" % platform.python_version())
        errorMessage.append("Qt: %s" % PYQT_VERSION_STR)
        errorMessage.append('')
        errorMessage.append(stack)

        url = QUrl('https://code.google.com/p/open-numismat/issues/entry')
        query = QUrlQuery()
        query.addQueryItem('summary', subject)
        query.addQueryItem('comment', '\n'.join(errorMessage))
        url.setQuery(query)

        executor = QDesktopServices()
        executor.openUrl(url)

    # Call the default handler
    sys.__excepthook__(type_, value, tback)
开发者ID:Ffahath,项目名称:open-numismat,代码行数:40,代码来源:main.py

示例12: refresh_access_token

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
 def refresh_access_token(self, callback):
     refresh_token = config.persist["oauth_refresh_token"]
     log.debug("OAuth: refreshing access_token with a refresh_token %s", refresh_token)
     host, port = config.setting['server_host'], config.setting['server_port']
     path = "/oauth2/token"
     url = QUrl()
     url_query = QUrlQuery()
     url_query.addQueryItem("grant_type", "refresh_token")
     url_query.addQueryItem("refresh_token", refresh_token)
     url_query.addQueryItem("client_id", MUSICBRAINZ_OAUTH_CLIENT_ID)
     url_query.addQueryItem("client_secret", MUSICBRAINZ_OAUTH_CLIENT_SECRET)
     url.setQuery(url_query.query(QUrl.FullyEncoded))
     data = string_(url.query())
     self.webservice.post(host, port, path, data,
                     partial(self.on_refresh_access_token_finished, callback),
                     parse_response_type=None, mblogin=True, priority=True, important=True)
开发者ID:Sophist-UK,项目名称:Sophist_picard,代码行数:18,代码来源:oauth.py

示例13: _sendRequest

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
    def _sendRequest(self, url, params, headers={}):
        if self.asynchonous:

            if self.reply is not None:
                self.reply.finished.disconnect(self.reply_finished)
                self.reply.abort()
                self.reply = None

            url = QUrl(url)
            q = QUrlQuery(url)
            for key, value in params.items():
                q.addQueryItem(key, value)
            url.setQuery(q)
            QgsLogger.debug('Request: {}'.format(url.toEncoded()))
            request = QNetworkRequest(url)
            for key, value in headers.items():
                request.setRawHeader(key, value)
            self.reply = QgsNetworkAccessManager.instance().get(request)
            self.reply.finished.connect(self.reply_finished)

        else:
            response = urlopen(self.url + '?' + urllib.urlencode(params))
            data = json.load(response)
            self.load_data(data)
开发者ID:3nids,项目名称:quickfinder,代码行数:26,代码来源:http_finder.py

示例14: encode_uri

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import addQueryItem [as 别名]
def encode_uri(ds_uri, schema_name, project_name=None):
    u = QUrl()
    urlQuery = QUrlQuery()

    u.setScheme("postgresql")
    u.setHost(ds_uri.host())
    if ds_uri.port() != '':
        u.setPort(int(ds_uri.port()))
    if ds_uri.username() != '':
        u.setUserName(ds_uri.username())
    if ds_uri.password() != '':
        u.setPassword(ds_uri.password())

    if ds_uri.service() != '':
        urlQuery.addQueryItem("service", ds_uri.service())
    if ds_uri.authConfigId() != '':
        urlQuery.addQueryItem("authcfg", ds_uri.authConfigId())
    if ds_uri.sslMode() != QgsDataSourceUri.SslPrefer:
        urlQuery.addQueryItem("sslmode", QgsDataSourceUri.encodeSslMode(ds_uri.sslMode()))

    urlQuery.addQueryItem("dbname", ds_uri.database())

    urlQuery.addQueryItem("schema", schema_name)
    if project_name:
        urlQuery.addQueryItem("project", project_name)

    u.setQuery(urlQuery)
    return str(u.toEncoded(), 'utf-8')
开发者ID:jonnyforestGIS,项目名称:QGIS,代码行数:30,代码来源:test_project_storage_postgres.py


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