From cef46278bc6598f8cef0afd2b6114b8c74c32ea9 Mon Sep 17 00:00:00 2001
From: Tom LAVEILLE
Date: Thu, 25 Sep 2025 13:50:17 +0200
Subject: [PATCH] correctif mineur
---
CenRa_FLUX/flux_editor.py | 59 ++++++++++++++++++++++++---------------
CenRa_FLUX/metadata.txt | 4 +--
plugins.xml | 6 ++--
3 files changed, 42 insertions(+), 27 deletions(-)
diff --git a/CenRa_FLUX/flux_editor.py b/CenRa_FLUX/flux_editor.py
index 603e0bc..36e808f 100644
--- a/CenRa_FLUX/flux_editor.py
+++ b/CenRa_FLUX/flux_editor.py
@@ -103,7 +103,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.toolButton.setIcon(QtGui.QIcon(resources_path('ui', 'find.png')))
self.comboBox_2.addItem("SIG")
self.comboBox_2.addItem('REF')
- self.comboBox.currentIndexChanged.connect(self.initialisation_flux)
+
self.commandLinkButton.clicked.connect(self.selection_flux)
self.tableWidget.itemDoubleClicked.connect(self.selection_flux)
self.pushButton_2.clicked.connect(self.limite_flux)
@@ -123,6 +123,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.DeBUG.addItem('01')
self.DeBUG.addItem('0726')
self.DeBUG.addItem('4269')
+ self.comboBox.currentIndexChanged.connect(self.initialisation_flux)
self.DeBUG.currentIndexChanged.connect(self.SwitchDEBUG)
self.DeBUG.hide()
@@ -186,8 +187,8 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
dbtype = refdb
con = psycopg2.connect("host=" + host + " port=" + port + " dbname=" + dbtype + " user=" + user + " password=" + mdp)
cur = con.cursor(cursor_factory=psycopg2.extras.DictCursor)
- self.initialisation_flux()
self.combobox_custom()
+ #self.initialisation_flux()
# Create the dialog with elements (after translation) and keep reference
# Only create GUI ONCE in callback, so that it will only load when the plugin is started
if self.first_start is True:
@@ -210,27 +211,27 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
dbtype = sigdb
con = psycopg2.connect("host=" + host + " port=" + port + " dbname=" + dbtype + " user=" + user + " password=" + mdp)
cur = con.cursor(cursor_factory=psycopg2.extras.DictCursor)
- self.initialisation_flux()
self.combobox_custom()
+ #self.initialisation_flux()
# Create the dialog with elements (after translation) and keep reference
# Only create GUI ONCE in callback, so that it will only load when the plugin is started
if self.first_start is True:
self.first_start = False
# show the dialog
- self.show()
+ # self.show()
# Run the dialog event loop
- result = self.exec()
+ # result = self.exec()
# See if OK was pressed
- if result:
+ #if result:
# Do something useful here - delete the line containing pass and
# substitute with your code.
- pass
+ # pass
def suppression_flux(self):
self.tableWidget_2.removeRow(self.tableWidget_2.currentRow())
def initialisation_flux(self):
- print('run_time')
+ print('run')
if dbtype == sigdb:
# self.toolButton.setEnabled(1)
if self.comboBox.currentText() == 'toutes les catégories':
@@ -240,13 +241,12 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
where schemaname like '""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) order by schemaname,tablename;"""
else:
custom_list = """(SELECT schemaname,tablename from pg_catalog.pg_tables
- where schemaname like '\\_""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '\\_""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) order by schemaname,tablename;"""
+ where schemaname like '\\_""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '\\_""" + str(self.comboBox.currentText()) + """%' order by schemaname,tablename) order by schemaname,tablename;"""
else:
if self.comboBox.currentText() == 'toutes les catégories':
custom_list = schemaname_list_ref
else:
- custom_list = """SELECT schemaname,tablename from pg_catalog.pg_tables
- where schemaname like '""" + str(self.comboBox.currentText()) + """' order by schemaname,tablename;"""
+ custom_list = """SELECT schemaname, tablename from pg_catalog.pg_tables WHERE schemaname LIKE '""" + str(self.comboBox.currentText()) + """' AND tablename NOT LIKE 'qgis_projects' order by schemaname, tablename;"""
cur.execute(custom_list)
list_schema = cur.fetchall()
@@ -326,11 +326,14 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.tableWidget.setItem(i, 3, item)
i = i + 1
- SQLprojects = """SELECT schemaname, tablename FROM pg_catalog.pg_tables WHERE tablename LIKE 'qgis_projects'"""
+ if self.comboBox.currentText() == 'toutes les catégories':
+ SQLprojects = """SELECT schemaname, tablename FROM pg_catalog.pg_tables WHERE tablename LIKE 'qgis_projects'"""
+ else:
+ SQLprojects = """SELECT schemaname, tablename FROM pg_catalog.pg_tables WHERE tablename LIKE 'qgis_projects' AND schemaname LIKE '""" + str(self.comboBox.currentText()) + """';"""
cur.execute(SQLprojects)
list_projects = cur.fetchall()
list_projects_qgis = []
- if len(list_projects) <= 1:
+ if len(list_projects) >= 1:
for ProjectName in list_projects:
SQLProjectsQgis = """SELECT name, metadata, content FROM """ + '"' + ProjectName[0] + '"."' + ProjectName[1] + '"'
cur.execute(SQLProjectsQgis)
@@ -343,10 +346,10 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
itemIcon.setIcon(icon)
self.tableWidget.setItem(i, 0, itemIcon)
- item = QTableWidgetItem('QGIS')
+ item = QTableWidgetItem('qgis')
self.tableWidget.setItem(i, 1, item)
- item = QTableWidgetItem('projet')
+ item = QTableWidgetItem(ProjectName[0])
self.tableWidget.setItem(i, 2, item)
item = QTableWidgetItem(Project[0])
@@ -441,8 +444,17 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
# p = []
SQLloadRaster = """SELECT concat(r_table_schema,'.',r_table_name) from public.raster_columns; """
- cur.execute(SQLloadRaster)
- list_raster = cur.fetchall()
+ SQLextension = """SELECT count(extname) FROM pg_catalog.pg_extension WHERE extname LIKE 'postgis_raster';"""
+
+ cur.execute(SQLextension)
+ count_extension = cur.fetchall()[0][0]
+
+ if count_extension == 1:
+ cur.execute(SQLloadRaster)
+ list_raster = cur.fetchall()
+ else:
+ list_raster = []
+
RasterList = []
for rasterFind in list_raster:
RasterList.append(rasterFind[0])
@@ -457,26 +469,28 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
if code == 'travaux' or code == 'agregation':
schema = self.tableWidget_2.item(row, 2).text()
table = self.tableWidget_2.item(row, 3).text()
+ elif code == '00':
+ table = self.tableWidget_2.item(row, 3).text()
else:
table = self.tableWidget_2.item(row, 3).text()
table = schema + '_' + table
elif dbtype == refdb:
- # code = self.tableWidget_2.item(row,1).text()
+ code = self.tableWidget_2.item(row,1).text()
schema = self.tableWidget_2.item(row, 2).text()
table = self.tableWidget_2.item(row, 3).text()
# .split("?", 1)[0]
uri = QgsDataSourceUri()
uri.setConnection(host, port, dbtype, user, mdp)
-
- # nom du schéma à remplacer: "hydrographie" à supprimer et mettre "couches_collaboratives" lorsqu'on aura regroupé les couches à modifier dans un même schéma
+ # nom du schéma à remplacer: "hydrographie" à supprimer et mettre "couches_collaboratives" lorsqu'on aura regroupé les couches à modifier dans un même
if (schema + '.' + table) in RasterList:
uri.setDataSource(schema, table, "rast")
uri.setKeyColumn('rid')
uri.setSrid('2154')
layer = QgsRasterLayer(uri.uri(), table, "postgresraster")
QgsProject.instance().addMapLayer(layer)
- elif code == 'QGIS':
- schema = '_' + self.tableWidget_2.item(row, 2).text()
+ elif code == 'qgis':
+ schema = self.tableWidget_2.item(row, 2).text()
+ print(schema)
table = self.tableWidget_2.item(row, 3).text()
uri_project = 'postgresql://' + user + ':' + mdp + '@' + host + ':' + port + '?sslmode=disable&dbname=' + dbtype + "&schema=" + schema + '&project=' + table
QgsProject.instance().read(uri_project)
@@ -527,6 +541,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.comboBox.addItem('69')
self.comboBox.addItem('agregation')
self.comboBox.addItem('travaux')
+ self.comboBox.addItem('qgis')
self.comboBox.addItem('form')
if dbtype == refdb:
self.toolButton.setEnabled(0)
diff --git a/CenRa_FLUX/metadata.txt b/CenRa_FLUX/metadata.txt
index 6e82d34..c625655 100644
--- a/CenRa_FLUX/metadata.txt
+++ b/CenRa_FLUX/metadata.txt
@@ -7,7 +7,7 @@ name=CenRa_FLUX
qgisMinimumVersion=3.0
supportsQt6=True
description=Permet d'ouvrire une table dans la base PostGis
-version=3.7
+version=3.13
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
email=si_besoin@cen-rhonealpes.fr
@@ -32,7 +32,7 @@ icon=icon.png
# experimental flag
experimental=False
-changelog=CenRa_FLUX:
05/09/2025 - Version 3.7:
- Ouverture de projet QGIS contenue dans la base de donnees.
30/07/2025 - Version 3.6:
- Correctife de bug.29/07/2025 - Version 3.5:
- Bug fix sur les donnee raster.23/07/2025 - Version 3.4:
- Ouverture raster dans la base SIG.23/07/2025 - Version 3.3:
- Optimisation des chargement.22/07/2025 - Version 3.2:
- Visualisation des format raster et vecteur dans REF.21/07/2025 - Version 3.1:
- Bug fix pour l'ouverture de plus de 5 couches.19/05/2025 - Version 3.0:
- Compatible PyQt5 et PyQt6.09/04/2025 - Version 2.9:
- Correctif bug en TT.09/04/2025 - Version 2.8:
- Optimisation pour le TT.07/04/2025 - Version 2.7:
- mode debug.03/04/2025 - Version 2.6:
- Mise a jour de securite.20/03/2025 - Version 2.5:
- Visualisation distincte des couches ne se trouvant pas dans l'antenne.13/02/2025 - Version 2.4:
- Ajoute redimensionnement et déplacement mollette.05/02/2025 - Version 2.3:
- Bouton de visualisation des couches se trouvent uniquement dans le canva de la carte.07/01/2025 - Version 2.2:
- ByPass du certif ssl ci erreur.22/10/2024 - Version 2.1:
- Correctif de bug. - Evolution de la limit de 3 à 5. 22/10/2024 - Version 2.0:
- Reformatage du code.03/10/2024 - Version 1.14:
- Remonte la fênetre dans la pille.13/09/2024 - Version 1.13:
- MAJ sur le lien du changelog- Bug-fix: Ouvre MultiPolygone et Polygon séparément.10/09/2024 - Version 1.11:
- Ouverture de table contenant plusieurs géométries.26/08/2024 - Version 1.10:
- Ajoute d'un changelog et vérification de mise à jour.
+changelog=CenRa_FLUX:
25/09/2025 - Version 3.13:
- test.25/09/2025 - Version 3.12:
- version +1.25/09/2025 - Version 3.11:
- Correctife sur les code 00.24/09/2025 - Version 3.10:
- Erreur sur l ouverture des couche raster. 24/09/2025 - Version 3.9:
- bugfix lier aux extention pgsql.09/09/2025 - Version 3.8:
- Bug REF fix.05/09/2025 - Version 3.7:
- Ouverture de projet QGIS contenue dans la base de donnees.30/07/2025 - Version 3.6:
- Correctife de bug.29/07/2025 - Version 3.5:
- Bug fix sur les donnee raster.23/07/2025 - Version 3.4:
- Ouverture raster dans la base SIG.23/07/2025 - Version 3.3:
- Optimisation des chargement.22/07/2025 - Version 3.2:
- Visualisation des format raster et vecteur dans REF.21/07/2025 - Version 3.1:
- Bug fix pour l'ouverture de plus de 5 couches.19/05/2025 - Version 3.0:
- Compatible PyQt5 et PyQt6.09/04/2025 - Version 2.9:
- Correctif bug en TT.09/04/2025 - Version 2.8:
- Optimisation pour le TT.07/04/2025 - Version 2.7:
- mode debug.03/04/2025 - Version 2.6:
- Mise a jour de securite.20/03/2025 - Version 2.5:
- Visualisation distincte des couches ne se trouvant pas dans l'antenne.13/02/2025 - Version 2.4:
- Ajoute redimensionnement et déplacement mollette.05/02/2025 - Version 2.3:
- Bouton de visualisation des couches se trouvent uniquement dans le canva de la carte.07/01/2025 - Version 2.2:
- ByPass du certif ssl ci erreur.22/10/2024 - Version 2.1:
- Correctif de bug. - Evolution de la limit de 3 à 5. 22/10/2024 - Version 2.0:
- Reformatage du code.03/10/2024 - Version 1.14:
- Remonte la fênetre dans la pille.13/09/2024 - Version 1.13:
- MAJ sur le lien du changelog- Bug-fix: Ouvre MultiPolygone et Polygon séparément.10/09/2024 - Version 1.11:
- Ouverture de table contenant plusieurs géométries.26/08/2024 - Version 1.10:
- Ajoute d'un changelog et vérification de mise à jour.
# deprecated flag (applies to the whole plugin, not just a single version)
deprecated=False
diff --git a/plugins.xml b/plugins.xml
index 9d1a2bd..69a54fd 100644
--- a/plugins.xml
+++ b/plugins.xml
@@ -50,9 +50,9 @@
cenra,sicen
-
+
Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.
- 3.7
+ 3.13
3.16
https://plateformesig.cenra-outils.org/
CenRa_FLUX.zip
@@ -61,7 +61,7 @@
https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_FLUX.zip
CEN-Rhone-Alpes
2024-02-06
- 2025-09-05
+ 2025-09-25
False
False
cenra,flux