本文整理汇总了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)
示例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')
示例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()