本文整理汇总了Python中PyQt5.Qt.QUrl.toString方法的典型用法代码示例。如果您正苦于以下问题:Python QUrl.toString方法的具体用法?Python QUrl.toString怎么用?Python QUrl.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QUrl
的用法示例。
在下文中一共展示了QUrl.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_proxy_auth_credentials
# 需要导入模块: from PyQt5.Qt import QUrl [as 别名]
# 或者: from PyQt5.Qt.QUrl import toString [as 别名]
def get_proxy_auth_credentials(qurl, authenticator, proxy_host, parent=None):
qurl = QUrl(qurl)
qurl.setFragment(None)
d = Credentials(_('Please specify a password for {0} at the proxy: {1}').format(qurl.toString(), proxy_host), parent)
if d.exec_() == d.Accepted:
username, password = d.credentials
authenticator.setUser(username)
authenticator.setPassword(password)
示例2: get_http_auth_credentials
# 需要导入模块: from PyQt5.Qt import QUrl [as 别名]
# 或者: from PyQt5.Qt.QUrl import toString [as 别名]
def get_http_auth_credentials(qurl, authenticator, parent=None):
qurl = QUrl(qurl)
qurl.setFragment(None)
realm = authenticator.realm()
trealm = (' (%s)' % realm) if realm else ''
ac = parent and parent.get_login_credentials(qurl.toString())
d = Credentials(_('Please specify a password for {0}{1}').format(qurl.toString(), trealm), parent)
if ac is not None:
if ac['autologin']:
authenticator.setUser(ac['username'])
authenticator.setPassword(ac['password'])
return
d.credentials = ac['username'], ac['password']
if d.exec_() == d.Accepted:
username, password = d.credentials
authenticator.setUser(username)
authenticator.setPassword(password)
if parent is not None:
parent.on_login_form_submit(qurl.toString(), username, password)
else:
if parent is not None:
parent.setHtml('<p style="font-family:sans-serif">{} {}</p>'.format(
_('Authentication required to access: '), '<a href="{0}">{0}</a>'.format(qurl.toDisplayString())))
示例3: load_footnote_data
# 需要导入模块: from PyQt5.Qt import QUrl [as 别名]
# 或者: from PyQt5.Qt.QUrl import toString [as 别名]
def load_footnote_data(self, current_url):
fd = self.footnote_data_cache[current_url] = {}
try:
raw = self.view.document.javascript('window.calibre_extract.get_footnote_data()', typ='string')
for x in json.loads(raw or '{}'):
if x not in fd:
qu = QUrl(x)
path = qu.toLocalFile()
spath = self.spine_path(path)
if spath is not None:
target = qu.fragment(QUrl.FullyDecoded)
fd[qu.toString()] = (spath, target, qu)
self.known_footnote_targets[spath].add(target)
except Exception:
prints('Failed to get footnote data, with error:')
import traceback
traceback.print_exc()
return fd