mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-19 00:04:52 -04:00
MetaSearch: minor fixes for QGIS 3 compat
This commit is contained in:
parent
c2b365c70e
commit
6ce208c776
@ -145,7 +145,7 @@ class MetaSearchDialog(QDialog, BASE_CLASS):
|
|||||||
self.populate_connection_list()
|
self.populate_connection_list()
|
||||||
self.btnCapabilities.setEnabled(False)
|
self.btnCapabilities.setEnabled(False)
|
||||||
self.spnRecords.setValue(
|
self.spnRecords.setValue(
|
||||||
self.settings.value('/MetaSearch/returnRecords', 10, int))
|
int(self.settings.value('/MetaSearch/returnRecords', 10)))
|
||||||
|
|
||||||
key = '/MetaSearch/%s' % self.cmbConnectionsSearch.currentText()
|
key = '/MetaSearch/%s' % self.cmbConnectionsSearch.currentText()
|
||||||
self.catalog_url = self.settings.value('%s/url' % key)
|
self.catalog_url = self.settings.value('%s/url' % key)
|
||||||
@ -380,7 +380,7 @@ class MetaSearchDialog(QDialog, BASE_CLASS):
|
|||||||
def set_bbox_from_map(self):
|
def set_bbox_from_map(self):
|
||||||
"""set bounding box from map extent"""
|
"""set bounding box from map extent"""
|
||||||
|
|
||||||
crs = self.map.mapRenderer().destinationCrs()
|
crs = self.map.mapSettings().destinationCrs()
|
||||||
crsid = int(crs.authid().split(':')[1])
|
crsid = int(crs.authid().split(':')[1])
|
||||||
|
|
||||||
extent = self.map.extent()
|
extent = self.map.extent()
|
||||||
|
@ -44,7 +44,7 @@ from jinja2 import Environment, FileSystemLoader
|
|||||||
from pygments import highlight
|
from pygments import highlight
|
||||||
from pygments.lexers import XmlLexer
|
from pygments.lexers import XmlLexer
|
||||||
from pygments.formatters import HtmlFormatter
|
from pygments.formatters import HtmlFormatter
|
||||||
from qgis.PyQt.QtCore import QUrl
|
from qgis.PyQt.QtCore import QUrl, QUrlQuery
|
||||||
from qgis.PyQt.QtWidgets import QMessageBox
|
from qgis.PyQt.QtWidgets import QMessageBox
|
||||||
from qgis.PyQt.uic import loadUiType
|
from qgis.PyQt.uic import loadUiType
|
||||||
|
|
||||||
@ -110,9 +110,12 @@ def get_connections_from_file(parent, filename):
|
|||||||
def prettify_xml(xml):
|
def prettify_xml(xml):
|
||||||
"""convenience function to prettify XML"""
|
"""convenience function to prettify XML"""
|
||||||
|
|
||||||
if xml.count('\n') > 5: # likely already pretty printed
|
if isinstance(xml, bytes):
|
||||||
|
xml = xml.decode('utf-8')
|
||||||
|
|
||||||
|
if xml.count('\n') > 20: # likely already pretty printed
|
||||||
return xml
|
return xml
|
||||||
else:
|
|
||||||
# check if it's a GET request
|
# check if it's a GET request
|
||||||
if xml.startswith('http'):
|
if xml.startswith('http'):
|
||||||
return xml
|
return xml
|
||||||
@ -138,7 +141,7 @@ def get_help_url():
|
|||||||
"""return QGIS MetaSearch help documentation link"""
|
"""return QGIS MetaSearch help documentation link"""
|
||||||
|
|
||||||
locale_name = QgsSettings().value('locale/userLocale')[0:2]
|
locale_name = QgsSettings().value('locale/userLocale')[0:2]
|
||||||
major, minor = QGis.QGIS_VERSION.split('.')[:2]
|
major, minor = Qgis.QGIS_VERSION.split('.')[:2]
|
||||||
|
|
||||||
if minor == '99': # master
|
if minor == '99': # master
|
||||||
version = 'testing'
|
version = 'testing'
|
||||||
@ -182,10 +185,15 @@ def serialize_string(input_string):
|
|||||||
def clean_ows_url(url):
|
def clean_ows_url(url):
|
||||||
"""clean an OWS URL of added basic service parameters"""
|
"""clean an OWS URL of added basic service parameters"""
|
||||||
|
|
||||||
url2 = QUrl(url)
|
url = QUrl(url)
|
||||||
url2.removeEncodedQueryItem('service')
|
query_string = url.query()
|
||||||
url2.removeEncodedQueryItem('SERVICE')
|
|
||||||
url2.removeEncodedQueryItem('request')
|
|
||||||
url2.removeEncodedQueryItem('REQUEST')
|
|
||||||
|
|
||||||
return url2.toString()
|
if query_string:
|
||||||
|
query_string = QUrlQuery(query_string)
|
||||||
|
query_string.removeQueryItem('service')
|
||||||
|
query_string.removeQueryItem('SERVICE')
|
||||||
|
query_string.removeQueryItem('request')
|
||||||
|
query_string.removeQueryItem('REQUEST')
|
||||||
|
url.setQuery(query_string)
|
||||||
|
|
||||||
|
return url.toString()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user