From 6a59dec2c3f2adef667a7fa94d2fbc0bcf8335a6 Mon Sep 17 00:00:00 2001 From: Djedouas Date: Tue, 2 Mar 2021 16:24:58 +0100 Subject: [PATCH] =?UTF-8?q?V=C3=A9rif=20pr=C3=A9sence=20layer=20OpenStreet?= =?UTF-8?q?Map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orientation/orientation.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/orientation/orientation.py b/orientation/orientation.py index 4dd2449..9374863 100644 --- a/orientation/orientation.py +++ b/orientation/orientation.py @@ -172,7 +172,7 @@ class Orientation: icon_path = ':/plugins/caliec/icon.png' self.add_action( icon_path, - text=self.tr(u'Créer le projet'), + text=self.tr('Créer le projet'), callback=self.run, parent=self.iface.mainWindow()) @@ -184,7 +184,7 @@ class Orientation: """Removes the plugin menu item and icon from QGIS GUI.""" for action in self.actions: self.iface.removePluginMenu( - self.tr(u'&CaLiÉc'), + self.tr('CaLiÉc'), action) self.iface.removeToolBarIcon(action) @@ -201,7 +201,6 @@ class Orientation: tempdir = tempfile.TemporaryDirectory() styles_url = 'https://forge.chapril.org/linux_alpes/caliec/raw/branch/master/styles/' lambert93 = QgsCoordinateReferenceSystem("EPSG:2154") - wgs = QgsCoordinateReferenceSystem("EPSG:4326") wgspm = QgsCoordinateReferenceSystem("EPSG:3857") scr = wgspm project = QgsProject.instance() @@ -212,6 +211,10 @@ class Orientation: context = dataobjects.createContext() context.setInvalidGeometryCheck(QgsFeatureRequest.GeometryNoCheck) + if len(project.mapLayersByName("OpenStreetMap")) == 0: + QMessageBox.warning(self.iface.mainWindow(), "Attention", "Affichez d'abord un fond Openstreetmap (menu XYZ tiles) et cadrez la zone voulue") + return + # Correspondances des noms des couches et des styles: # "NOM_DE_LA_COUCHE_OSM": ("nom_du_style", "nom_du_layer") # Commenter les couches non désirées