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


Python QUrl.removeQueryItem方法代码示例

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


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

示例1: _open_wfs

# 需要导入模块: from PyQt4.QtCore import QUrl [as 别名]
# 或者: from PyQt4.QtCore.QUrl import removeQueryItem [as 别名]
    def _open_wfs(self, name, capabilites_url):
        # Add new HTTPConnection like in source
        # https://github.com/qgis/QGIS/blob/master/src/gui/qgsnewhttpconnection.cpp
        # https://github.com/qgis/QGIS/blob/79616fd8d8285b4eb93adafdfcb97a3e429b832e/src/app/qgisapp.cpp#L3783

        self.msg_log(u'add WFS: Name={0}, original URL={1}'.format(name, capabilites_url))

        # remove additional url parameters, otherwise adding wfs works the frist time only
        # https://github.com/qgis/QGIS/blob/9eee12111567a84f4d4de7e020392b3c01c28598/src/gui/qgsnewhttpconnection.cpp#L199-L214
        url = QUrl(capabilites_url)
        url.removeQueryItem('SERVICE')
        url.removeQueryItem('REQUEST')
        url.removeQueryItem('FORMAT')
        url.removeQueryItem('service')
        url.removeQueryItem('request')
        url.removeQueryItem('format')
        #also remove VERSION: shouldn't be necessary, but QGIS sometimes seems to append version=1.0.0
        url.removeQueryItem('VERSION')
        url.removeQueryItem('version')

        capabilites_url = url.toString()
        self.msg_log(u'add WFS: Name={0}, base URL={1}'.format(name, capabilites_url))

        s = QSettings()

        self.msg_log(u'existing WFS url: {0}'.format(s.value(u'Qgis/connections-wfs/{0}/url'.format(name), '')))

        key_user = u'Qgis/WFS/{0}/username'.format(name)
        key_pwd = u'Qgis/WFS/{0}/password'.format(name)
        key_referer = u'Qgis/connections-wfs/{0}/referer'.format(name)
        key_url = u'Qgis/connections-wfs/{0}/url'.format(name)
        key_authcfg = u'Qgis/WFS/{0}/authcfg'.format(name)

        s.remove(key_user)
        s.remove(key_pwd)
        s.remove(key_referer)
        s.remove(key_url)
        s.sync()

        s.setValue(key_user, '')
        s.setValue(key_pwd, '')
        s.setValue(key_referer, '')
        s.setValue(key_url, capabilites_url)

        if self.settings.auth_propagate and self.settings.authcfg:
            s.setValue(key_authcfg, self.settings.authcfg)

        s.setValue(u'Qgis/connections-wfs/selected', name)

        # create new dialog
        wfs_dlg = QgsProviderRegistry.instance().selectWidget("WFS", self.main_win)

        QObject.connect(
            wfs_dlg
            , SIGNAL("addWfsLayer( QString, QString )")
            , self.main_win, SLOT("addWfsLayer( QString, QString )")
        )

        wfs_dlg.show()
开发者ID:MonsantoCo,项目名称:QGIS-CKAN-Browser,代码行数:61,代码来源:util.py


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