Skip to content
Permalink
Browse files
Merge pull request #46270 from gbd-consult/feature/metasearch
[MetaSearch] Save Settings
  • Loading branch information
nyalldawson committed Dec 20, 2021
2 parents 43568f2 + 1f025e5 commit 8dc8331394ea90ec0bfc517632ae313c8f718c69
Showing with 24 additions and 16 deletions.
  1. +23 −15 python/plugins/MetaSearch/dialogs/maindialog.py
  2. +1 −1 python/plugins/MetaSearch/metadata.txt
@@ -88,10 +88,11 @@ def __init__(self, iface):

# form inputs
self.startfrom = 1
self.maxrecords = 10
self.timeout = 10
self.disable_ssl_verification = False
self.constraints = []
self.maxrecords = int(self.settings.value('/MetaSearch/returnRecords', 10))
self.timeout = int(self.settings.value('/MetaSearch/timeout', 10))
self.disable_ssl_verification = self.settings.value(
'/MetaSearch/disableSSL', False, bool)

# Services tab
self.cmbConnectionsServices.activated.connect(self.save_connection)
@@ -139,12 +140,29 @@ def __init__(self, iface):

def manageGui(self):
"""open window"""
def _on_timeout_change(value):
self.settings.setValue('/MetaSearch/timeout', value)
self.timeout = value

def _on_records_change(value):
self.settings.setValue('/MetaSearch/returnRecords', value)
self.maxrecords = value

def _on_ssl_state_change(state):
self.settings.setValue('/MetaSearch/disableSSL', bool(state))
self.disable_ssl_verification = bool(state)

self.tabWidget.setCurrentIndex(0)
self.populate_connection_list()
self.btnRawAPIResponse.setEnabled(False)
self.spnRecords.setValue(
int(self.settings.value('/MetaSearch/returnRecords', 10)))

# load settings
self.spnRecords.setValue(self.maxrecords)
self.spnRecords.valueChanged.connect(_on_records_change)
self.spnTimeout.setValue(self.timeout)
self.spnTimeout.valueChanged.connect(_on_timeout_change)
self.disableSSLVerification.setChecked(self.disable_ssl_verification)
self.disableSSLVerification.stateChanged.connect(_on_ssl_state_change)

key = '/MetaSearch/%s' % self.cmbConnectionsSearch.currentText()
self.catalog_url = self.settings.value('%s/url' % key)
@@ -435,10 +453,6 @@ def search(self):
# clear all fields and disable buttons
self.clear_results()

# save some settings
self.settings.setValue('/MetaSearch/returnRecords',
self.spnRecords.cleanText())

# set current catalog
current_text = self.cmbConnectionsSearch.currentText()
key = '/MetaSearch/%s' % current_text
@@ -449,10 +463,6 @@ def search(self):

# start position and number of records to return
self.startfrom = 1
self.maxrecords = self.spnRecords.value()

# set timeout
self.timeout = self.spnTimeout.value()

# bbox
# CRS is WGS84 with axis order longitude, latitude
@@ -840,7 +850,6 @@ def show_metadata(self):

identifier = get_item_data(item, 'identifier')

self.disable_ssl_verification = self.disableSSLVerification.isChecked()
auth = None

if self.disable_ssl_verification:
@@ -935,7 +944,6 @@ def reject(self):
def _get_catalog(self):
"""convenience function to init catalog wrapper"""

self.disable_ssl_verification = self.disableSSLVerification.isChecked()
auth = None

if self.disable_ssl_verification:
@@ -3,7 +3,7 @@ name=MetaSearch Catalog Client
description=MetaSearch is a QGIS plugin to interact with metadata catalog services (CSW).
about=MetaSearch is a QGIS plugin to interact with metadata catalog services, supporting the OGC Catalog Service for the Web (CSW) standard. MetaSearch provides an easy and intuitive approach and user-friendly interface to searching metadata catalogs within QGIS.
category=Web
version=0.3.5
version=0.3.6
qgisMinimumVersion=3.0
icon=images/MetaSearch.svg
author=Tom Kralidis

0 comments on commit 8dc8331

Please sign in to comment.