From 986688e3fa014c946a2307037020641d957aff46 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 15 Jul 2024 09:44:39 +1000 Subject: [PATCH 1/4] [grass] Drop custom defaultVectorFileExtension implementation This fixes the GRASS provider ignoring the "default output vector layer extension" setting for processing. The override in the grass provider is NOT required as the base class method already applies the logic for falling back to shp when gpkg is not available (which was added here in 2e92dabd), and also correctly respects the default format setting. Fixes #43988 --- python/plugins/grassprovider/Grass7AlgorithmProvider.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/python/plugins/grassprovider/Grass7AlgorithmProvider.py b/python/plugins/grassprovider/Grass7AlgorithmProvider.py index a2da3fd8a37e..76cf6957f7b9 100644 --- a/python/plugins/grassprovider/Grass7AlgorithmProvider.py +++ b/python/plugins/grassprovider/Grass7AlgorithmProvider.py @@ -133,15 +133,6 @@ def svgIconPath(self): def versionInfo(self): return Grass7Utils.installedVersion() or None - def defaultVectorFileExtension(self, hasGeometry=True): - # By default,'gpkg', but if OGR has not been compiled with sqlite3, then - # we take "SHP" - if 'GPKG' in [o.driverName for o in - QgsVectorFileWriter.ogrDriverList()]: - return 'gpkg' - else: - return 'shp' if hasGeometry else 'dbf' - def supportsNonFileBasedOutput(self): """ GRASS7 Provider doesn't support non file based outputs From b3fc545e8e437ab07ba6b898805a835556bf468c Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 15 Jul 2024 09:46:53 +1000 Subject: [PATCH 2/4] Fix comment grammar --- python/plugins/grassprovider/Grass7AlgorithmProvider.py | 4 ++-- python/plugins/grassprovider/Grass7Utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/plugins/grassprovider/Grass7AlgorithmProvider.py b/python/plugins/grassprovider/Grass7AlgorithmProvider.py index 76cf6957f7b9..049b56ced389 100644 --- a/python/plugins/grassprovider/Grass7AlgorithmProvider.py +++ b/python/plugins/grassprovider/Grass7AlgorithmProvider.py @@ -140,11 +140,11 @@ def supportsNonFileBasedOutput(self): return False def supportedOutputVectorLayerExtensions(self): - # We use the same extensions than QGIS because: + # We use the same extensions as QGIS because: # - QGIS is using OGR like GRASS # - There are very chances than OGR version used in GRASS is # different from QGIS OGR version. - return QgsVectorFileWriter.supportedFormatExtensions() + return super().supportedOutputVectorLayerExtensions() def supportedOutputRasterLayerExtensions(self): return Grass7Utils.getSupportedOutputRasterExtensions() diff --git a/python/plugins/grassprovider/Grass7Utils.py b/python/plugins/grassprovider/Grass7Utils.py index dd4f0daabe90..9ed0601eb3db 100644 --- a/python/plugins/grassprovider/Grass7Utils.py +++ b/python/plugins/grassprovider/Grass7Utils.py @@ -601,7 +601,7 @@ def grassHelpPath(): @staticmethod def getSupportedOutputRasterExtensions(): - # We use the same extensions than GDAL because: + # We use the same extensions as GDAL because: # - GRASS is also using GDAL for raster imports. # - Chances that GRASS is compiled with another version of # GDAL than QGIS are very limited! From c714df58e69eae9866c06778cc761b3d75d2ccbb Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 15 Jul 2024 14:33:37 +1000 Subject: [PATCH 3/4] Update python/plugins/grassprovider/grass_provider.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Loïc Bartoletti --- python/plugins/grassprovider/Grass7AlgorithmProvider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/plugins/grassprovider/Grass7AlgorithmProvider.py b/python/plugins/grassprovider/Grass7AlgorithmProvider.py index 049b56ced389..b854ceaabda9 100644 --- a/python/plugins/grassprovider/Grass7AlgorithmProvider.py +++ b/python/plugins/grassprovider/Grass7AlgorithmProvider.py @@ -142,7 +142,7 @@ def supportsNonFileBasedOutput(self): def supportedOutputVectorLayerExtensions(self): # We use the same extensions as QGIS because: # - QGIS is using OGR like GRASS - # - There are very chances than OGR version used in GRASS is + # - There are very few chances than OGR version used in GRASS is # different from QGIS OGR version. return super().supportedOutputVectorLayerExtensions() From 7038d45a6c19f27cc23787a5783b04159e541829 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 15 Jul 2024 18:03:31 +1000 Subject: [PATCH 4/4] Update python/plugins/grassprovider/grass_provider.py Co-authored-by: Alexander Bruy --- python/plugins/grassprovider/Grass7AlgorithmProvider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/plugins/grassprovider/Grass7AlgorithmProvider.py b/python/plugins/grassprovider/Grass7AlgorithmProvider.py index b854ceaabda9..651500b2b48e 100644 --- a/python/plugins/grassprovider/Grass7AlgorithmProvider.py +++ b/python/plugins/grassprovider/Grass7AlgorithmProvider.py @@ -142,7 +142,7 @@ def supportsNonFileBasedOutput(self): def supportedOutputVectorLayerExtensions(self): # We use the same extensions as QGIS because: # - QGIS is using OGR like GRASS - # - There are very few chances than OGR version used in GRASS is + # - There are very few chances that OGR version used in GRASS is # different from QGIS OGR version. return super().supportedOutputVectorLayerExtensions()