From e43a19bb4c564ca05afc33c0151cc0d74e8900e4 Mon Sep 17 00:00:00 2001 From: iona5 Date: Tue, 22 Dec 2020 14:27:28 +0100 Subject: [PATCH] fix issue #5: ensure valid CRS returned from QgsProjectionSelectionDialog --- coordinator.py | 11 +++++++++-- metadata.txt | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/coordinator.py b/coordinator.py index e9d5ec3..4afc74b 100644 --- a/coordinator.py +++ b/coordinator.py @@ -275,10 +275,17 @@ def setWarningMessage(self, message): def openCrsSelectionDialogForSection(self, section): projSelector = QgsProjectionSelectionDialog() if(projSelector.exec()): + selectedCrs = projSelector.crs() + + # workaround for checking if there was no CRS selected + # but user clicked 'OK': check if authid-string is empty: + if not selectedCrs.authid() : + return + if section == CoordinatorDockWidget.SectionInput: - self.setInputCrs(projSelector.crs()) + self.setInputCrs(selectedCrs) elif section == CoordinatorDockWidget.SectionOutput: - self.setOutputCrs(projSelector.crs()) + self.setOutputCrs(selectedCrs) def setOutputCrsToCanvasCrs(self): crs = self.canvas.mapSettings().destinationCrs() diff --git a/metadata.txt b/metadata.txt index 2826c9e..34fb947 100644 --- a/metadata.txt +++ b/metadata.txt @@ -25,6 +25,7 @@ repository=https://github.com/iona5/coordinator changelog=0.4 - pull request 16: use default values when capturing points (thanks @AlexanderFinkbeiner) - fix capture with wrong coordinate system with Point geometry + - ensure a valid CRS is selected when changing through QgsProjectionSelectionDialog (issue #5) 0.3 - issue #2: make sure capture tool is deselected when user selects another tool - issue #12: negative coordinates in geodetic systems were not properly processed