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


Python QUrl.setFragment方法代码示例

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


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

示例1: get_proxy_auth_credentials

# 需要导入模块: from PyQt5.Qt import QUrl [as 别名]
# 或者: from PyQt5.Qt.QUrl import setFragment [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)
开发者ID:kovidgoyal,项目名称:vise,代码行数:10,代码来源:auth.py

示例2: current_changed

# 需要导入模块: from PyQt5.Qt import QUrl [as 别名]
# 或者: from PyQt5.Qt.QUrl import setFragment [as 别名]
 def current_changed(self, current, previous):
     link = current.data(Qt.UserRole)
     if link is None:
         return
     url = None
     if link.is_external:
         if link.href:
             frag = ('#' + link.anchor.id) if link.anchor.id else ''
             url = QUrl(link.href + frag)
     elif link.anchor.location:
         path = current_container().name_to_abspath(link.anchor.location.name)
         if path and os.path.exists(path):
             url = QUrl.fromLocalFile(path)
             if link.anchor.id:
                 url.setFragment(link.anchor.id)
     if url is None:
         self.view.setHtml('<p>' + _('No destination found for this link'))
         self.current_url = url
     elif url != self.current_url:
         self.current_url = url
         self.view.setUrl(url)
开发者ID:thuvh,项目名称:calibre,代码行数:23,代码来源:reports.py

示例3: get_http_auth_credentials

# 需要导入模块: from PyQt5.Qt import QUrl [as 别名]
# 或者: from PyQt5.Qt.QUrl import setFragment [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())))
开发者ID:kovidgoyal,项目名称:vise,代码行数:26,代码来源:auth.py


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