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


Python QUrlQuery.queryItemValue方法代码示例

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


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

示例1: acceptNavigationRequest

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import queryItemValue [as 别名]
 def acceptNavigationRequest(self, url, _type, isMainFrame):
     query = QUrlQuery(url)
     if query.hasQueryItem("requrl"):
         orig_url = query.queryItemValue("requrl", QUrl.FullyDecoded)
         url = QUrl(orig_url)
         QDesktopServices.openUrl(url)
         return False
     return super().acceptNavigationRequest(url, _type, isMainFrame)
开发者ID:zhsj,项目名称:qwechat,代码行数:10,代码来源:view.py

示例2: _qute_settings_set

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import queryItemValue [as 别名]
def _qute_settings_set(url):
    """Handler for qute://settings/set."""
    query = QUrlQuery(url)
    option = query.queryItemValue('option', QUrl.FullyDecoded)
    value = query.queryItemValue('value', QUrl.FullyDecoded)

    # https://github.com/qutebrowser/qutebrowser/issues/727
    if option == 'content.javascript.enabled' and value == 'false':
        msg = ("Refusing to disable javascript via qute://settings "
               "as it needs javascript support.")
        message.error(msg)
        return 'text/html', b'error: ' + msg.encode('utf-8')

    try:
        config.instance.set_str(option, value, save_yaml=True)
        return 'text/html', b'ok'
    except configexc.Error as e:
        message.error(str(e))
        return 'text/html', b'error: ' + str(e).encode('utf-8')
开发者ID:The-Compiler,项目名称:qutebrowser,代码行数:21,代码来源:qutescheme.py

示例3: __parseUrl

# 需要导入模块: from PyQt5.QtCore import QUrlQuery [as 别名]
# 或者: from PyQt5.QtCore.QUrlQuery import queryItemValue [as 别名]
 def __parseUrl(self, url):
     """
     Private method to parse the AdBlock URL for the subscription.
     
     @param url AdBlock URL for the subscription (QUrl)
     """
     if url.scheme() != "abp":
         return
     
     if url.path() != "subscribe":
         return
     
     if qVersion() >= "5.0.0":
         from PyQt5.QtCore import QUrlQuery
         urlQuery = QUrlQuery(url)
         self.__title = urlQuery.queryItemValue("title")
         self.__enabled = urlQuery.queryItemValue("enabled") != "false"
         self.__location = QByteArray(urlQuery.queryItemValue("location"))
         
         # Check for required subscription
         self.__requiresLocation = urlQuery.queryItemValue(
             "requiresLocation")
         self.__requiresTitle = urlQuery.queryItemValue("requiresTitle")
         if self.__requiresLocation and self.__requiresTitle:
             import Helpviewer.HelpWindow
             Helpviewer.HelpWindow.HelpWindow.adBlockManager()\
                 .loadRequiredSubscription(self.__requiresLocation,
                                           self.__requiresTitle)
         
         lastUpdateString = urlQuery.queryItemValue("lastUpdate")
         self.__lastUpdate = QDateTime.fromString(lastUpdateString,
                                                  Qt.ISODate)
     else:
         self.__title = \
             QUrl.fromPercentEncoding(url.encodedQueryItemValue("title"))
         self.__enabled = QUrl.fromPercentEncoding(
             url.encodedQueryItemValue("enabled")) != "false"
         self.__location = QByteArray(QUrl.fromPercentEncoding(
             url.encodedQueryItemValue("location")))
         
         # Check for required subscription
         self.__requiresLocation = QUrl.fromPercentEncoding(
             url.encodedQueryItemValue("requiresLocation"))
         self.__requiresTitle = QUrl.fromPercentEncoding(
             url.encodedQueryItemValue("requiresTitle"))
         if self.__requiresLocation and self.__requiresTitle:
             import Helpviewer.HelpWindow
             Helpviewer.HelpWindow.HelpWindow.adBlockManager()\
                 .loadRequiredSubscription(self.__requiresLocation,
                                           self.__requiresTitle)
         
         lastUpdateByteArray = url.encodedQueryItemValue("lastUpdate")
         lastUpdateString = QUrl.fromPercentEncoding(lastUpdateByteArray)
         self.__lastUpdate = QDateTime.fromString(lastUpdateString,
                                                  Qt.ISODate)
     
     self.__loadRules()
开发者ID:Darriall,项目名称:eric,代码行数:59,代码来源:AdBlockSubscription.py


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