From a6ec3459451481ffaa846c62e71d917efc04a335 Mon Sep 17 00:00:00 2001 From: JPPauly <47689920+JPPauly@users.noreply.github.com> Date: Fri, 16 Apr 2021 07:56:13 +0200 Subject: [PATCH 1/2] Migrated from QSettings to QgsSettings --- wfsclientconfigdialog.py | 8 ++++---- wfsclientdialog.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wfsclientconfigdialog.py b/wfsclientconfigdialog.py index 44c2d9b..9d2a085 100644 --- a/wfsclientconfigdialog.py +++ b/wfsclientconfigdialog.py @@ -33,7 +33,7 @@ def __init__(self, parent): self.ui = Ui_WfsClientConfig() self.ui.setupUi(self) - self.settings = QtCore.QSettings() + self.settings = QgsSettings() #Restore UI from Settings resolvexlinkhref = self.settings.value("/Wfs20Client/resolveXpathHref") @@ -46,17 +46,17 @@ def __init__(self, parent): index = self.ui.cmbResolveDepth.findText(resolvedepth) self.ui.cmbResolveDepth.setCurrentIndex(index) - if resolvexlinkhref: + if resolvexlinkhref == "true": self.ui.chkResolveXlinkHref.setChecked(True) else: self.ui.chkResolveXlinkHref.setChecked(False) - if attributestofields: + if attributestofields == "true": self.ui.chkAttributesToFields.setChecked(True) else: self.ui.chkAttributesToFields.setChecked(False) - if disablenasdetection: + if disablenasdetection == "true": self.ui.chkDisableNasDetection.setChecked(True) else: self.ui.chkDisableNasDetection.setChecked(False) diff --git a/wfsclientdialog.py b/wfsclientdialog.py index 200e63f..e474ab5 100644 --- a/wfsclientdialog.py +++ b/wfsclientdialog.py @@ -53,7 +53,7 @@ def __init__(self, parent, url): self.ui = Ui_WfsClient() self.ui.setupUi(self) - self.settings = QtCore.QSettings() + self.settings = QgsSettings() self.qnam = QNetworkAccessManager() self.qnam.authenticationRequired.connect(self.authenticationRequired) self.qnam.sslErrors.connect(self.sslErrors) @@ -1005,20 +1005,20 @@ def load_vector_layer(self, filename, layername): gdaltimeout = "5" self.logger.debug("GDAL_HTTP_TIMEOUT " + gdaltimeout) gdal.SetConfigOption("GDAL_HTTP_TIMEOUT", gdaltimeout) - if resolvexlinkhref: + if resolvexlinkhref == "true": gdal.SetConfigOption('GML_SKIP_RESOLVE_ELEMS', 'HUGE') self.logger.debug("resolveXpathHref " + str(resolvexlinkhref)) else: gdal.SetConfigOption('GML_SKIP_RESOLVE_ELEMS', 'ALL') - if attributestofields: + if attributestofields == "true": gdal.SetConfigOption('GML_ATTRIBUTES_TO_OGR_FIELDS', 'YES') self.logger.debug("attributesToFields " + str(attributestofields)) else: gdal.SetConfigOption('GML_ATTRIBUTES_TO_OGR_FIELDS', 'NO') nasdetectionstring = "NAS-Operationen.xsd;NAS-Operationen_optional.xsd;AAA-Fachschema.xsd" - if disablenasdetection: + if disablenasdetection == "true": nasdetectionstring = 'asdf/asdf/asdf' self.logger.debug("Using 'NAS_INDICATOR': " + nasdetectionstring) gdal.SetConfigOption('NAS_INDICATOR', nasdetectionstring) From b350b8eadf726c1c52b2404cc4d9d5835ea408bd Mon Sep 17 00:00:00 2001 From: JPPauly <47689920+JPPauly@users.noreply.github.com> Date: Fri, 30 Apr 2021 08:46:54 +0200 Subject: [PATCH 2/2] Bugfix: Settings being checked for Bool True or String 'true' --- wfsclientconfigdialog.py | 6 +++--- wfsclientdialog.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wfsclientconfigdialog.py b/wfsclientconfigdialog.py index 9d2a085..ea36e57 100644 --- a/wfsclientconfigdialog.py +++ b/wfsclientconfigdialog.py @@ -46,17 +46,17 @@ def __init__(self, parent): index = self.ui.cmbResolveDepth.findText(resolvedepth) self.ui.cmbResolveDepth.setCurrentIndex(index) - if resolvexlinkhref == "true": + if resolvexlinkhref is True or resolvexlinkhref == "true": self.ui.chkResolveXlinkHref.setChecked(True) else: self.ui.chkResolveXlinkHref.setChecked(False) - if attributestofields == "true": + if attributestofields is True or attributestofields == "true": self.ui.chkAttributesToFields.setChecked(True) else: self.ui.chkAttributesToFields.setChecked(False) - if disablenasdetection == "true": + if disablenasdetection is True or disablenasdetection == "true": self.ui.chkDisableNasDetection.setChecked(True) else: self.ui.chkDisableNasDetection.setChecked(False) diff --git a/wfsclientdialog.py b/wfsclientdialog.py index e474ab5..57f5ae6 100644 --- a/wfsclientdialog.py +++ b/wfsclientdialog.py @@ -1005,20 +1005,20 @@ def load_vector_layer(self, filename, layername): gdaltimeout = "5" self.logger.debug("GDAL_HTTP_TIMEOUT " + gdaltimeout) gdal.SetConfigOption("GDAL_HTTP_TIMEOUT", gdaltimeout) - if resolvexlinkhref == "true": + if resolvexlinkhref is True or resolvexlinkhref == "true": gdal.SetConfigOption('GML_SKIP_RESOLVE_ELEMS', 'HUGE') self.logger.debug("resolveXpathHref " + str(resolvexlinkhref)) else: gdal.SetConfigOption('GML_SKIP_RESOLVE_ELEMS', 'ALL') - if attributestofields == "true": + if attributestofields is True or attributestofields == "true": gdal.SetConfigOption('GML_ATTRIBUTES_TO_OGR_FIELDS', 'YES') self.logger.debug("attributesToFields " + str(attributestofields)) else: gdal.SetConfigOption('GML_ATTRIBUTES_TO_OGR_FIELDS', 'NO') nasdetectionstring = "NAS-Operationen.xsd;NAS-Operationen_optional.xsd;AAA-Fachschema.xsd" - if disablenasdetection == "true": + if disablenasdetection is True or disablenasdetection == "true": nasdetectionstring = 'asdf/asdf/asdf' self.logger.debug("Using 'NAS_INDICATOR': " + nasdetectionstring) gdal.SetConfigOption('NAS_INDICATOR', nasdetectionstring)