diff --git a/CenRa_FLUX/flux_editor.py b/CenRa_FLUX/flux_editor.py index 1e9f17d6..c1aa3c33 100644 --- a/CenRa_FLUX/flux_editor.py +++ b/CenRa_FLUX/flux_editor.py @@ -25,6 +25,7 @@ from qgis.PyQt.QtWidgets import ( # QMenu, # QToolButton, # QTableWidget, + QPushButton, QTableWidgetItem, QMessageBox, QVBoxLayout, @@ -101,6 +102,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS): self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger(0)) self.toolButton.setIcon(QtGui.QIcon(resources_path('ui', 'find.png'))) + self.toolButton_2.setIcon(QtGui.QIcon(resources_path('ui', 'star.png'))) self.comboBox_2.addItem("SIG") self.comboBox_2.addItem('REF') @@ -113,6 +115,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS): self.checkBox.hide() # self.checkBox.stateChanged.connect(self.modeCarte) self.toolButton.clicked.connect(self.getCanevas) + self.toolButton_2.clicked.connect(self.filtre_favorit) layout = QVBoxLayout() self.lineEdit.textChanged.connect(self.filtre_dynamique) # self.viewer.textChanged.connect(self.NewTitle) @@ -230,8 +233,41 @@ class Flux_Editor(QDialog, EDITOR_CLASS): def suppression_flux(self): self.tableWidget_2.removeRow(self.tableWidget_2.currentRow()) + def AddOrDelToUserFav(self): + selected_items = self.tableWidget.selectedItems() + favorit_statut = selected_items[4].text() + + selected_items[4].tableWidget().removeCellWidget(selected_items[4].row(), 4) + + schema_name = selected_items[2].text() + table_name = selected_items[3].text() + + if favorit_statut == "0": + FAV = "mStarIconDel.png" + selected_items[4].setText("1") + SQLAddFav = """INSERT INTO admin_sig.favtable (utilisateur, schema_name, table_name) VALUES ('""" + user + "','" + schema_name + "','" + table_name + """');""" + if dbtype == sigdb: + cur.execute(SQLAddFav) + con.commit() + + else: + FAV = "mStarIconAdd.png" + selected_items[4].setText("0") + SQLDelFav = """DELETE FROM admin_sig.favtable WHERE utilisateur LIKE '""" + user + """' AND schema_name LIKE '""" + schema_name + """' AND table_name LIKE '""" + table_name + """';""" + if dbtype == sigdb: + cur.execute(SQLDelFav) + con.commit() + + iconFav = QIcon() + iconFav.addPixmap(QtGui.QPixmap(resources_path('icons', FAV)), QIcon.Mode(0), QIcon.State(1)) + self.FavButton = QPushButton(iconFav, "") + selected_items[4].tableWidget().setCellWidget(selected_items[4].row(), 4, self.FavButton) + self.FavButton.clicked.connect(self.AddOrDelToUserFav) + def initialisation_flux(self): + self.tableWidget.clear() if NoSignals == 0: + # self.tableWidget.clear() # print('Initiaisation de la connection a la DB: ' + dbtype) if dbtype == sigdb: # self.toolButton.setEnabled(1) @@ -288,8 +324,19 @@ class Flux_Editor(QDialog, EDITOR_CLASS): GrandUser = [] for grandsFind in list_grands: GrandUser.append(grandsFind[0]) + + if dbtype == sigdb: + SQLFavTable = "SELECT concat(schema_name, '.', table_name) FROM admin_sig.favtable WHERE utilisateur LIKE '" + user + "';" + cur.execute(SQLFavTable) + list_fav = cur.fetchall() + FavList = [] + for favFind in list_fav: + FavList.append(favFind[0]) + else: + FavList = [] + self.tableWidget.setRowCount(len(list_schema)) - self.tableWidget.setColumnCount(4) + self.tableWidget.setColumnCount(5) i = 0 for value in list_schema: if dbtype == sigdb: @@ -320,6 +367,20 @@ class Flux_Editor(QDialog, EDITOR_CLASS): schema_name = str(value[0]) table_name = str(value[1]) + FavStatut = 0 + if (schema_name + '.' + table_name) not in FavList: + FAV = "mStarIconAdd.png" + FavStatut = 0 + else: + FAV = "mStarIconDel.png" + FavStatut = 1 + iconFav = QIcon() + iconFav.addPixmap(QtGui.QPixmap(resources_path('icons', FAV)), QIcon.Mode(0), QIcon.State(1)) + self.FavButton = QPushButton(iconFav, "") + self.FavButton.clicked.connect(self.AddOrDelToUserFav) + if dbtype == refdb: + self.FavButton.setEnabled(False) + if (str(value[0]) + '.' + str(value[1])) in RasterList: SVG = 'mIconRaster.svg' else: @@ -337,6 +398,9 @@ class Flux_Editor(QDialog, EDITOR_CLASS): self.tableWidget.setItem(i, 2, item) item = QTableWidgetItem(table_name) self.tableWidget.setItem(i, 3, item) + item = QTableWidgetItem(str(FavStatut)) + self.tableWidget.setItem(i, 4, item) + self.tableWidget.setCellWidget(i, 4, self.FavButton) # if dbtype == sigdb: if (str(value[0]) + '.' + str(value[1])) in GrandUser: @@ -379,13 +443,17 @@ class Flux_Editor(QDialog, EDITOR_CLASS): item = QTableWidgetItem(Project[0]) self.tableWidget.setItem(i, 3, item) + item = QTableWidgetItem('FavIcon') + self.tableWidget.setItem(i, 4, item) + i = i + 1 self.tableWidget.setColumnWidth(0, 20) self.tableWidget.setColumnWidth(1, 70) self.tableWidget.setColumnWidth(2, 300) self.tableWidget.setColumnWidth(3, 300) - self.tableWidget.setHorizontalHeaderLabels(["Type", "Code", "Schema", "Table"]) + self.tableWidget.setColumnWidth(4, 20) + self.tableWidget.setHorizontalHeaderLabels(["Type", "Code", "Schema", "Table", "Favorit"]) if self.lineEdit.text() != 'Recherche par mots-clés': self.filtre_dynamique(self.lineEdit.text()) @@ -403,14 +471,15 @@ class Flux_Editor(QDialog, EDITOR_CLASS): for column in range(self.tableWidget.columnCount()): cloned_item = selected_items[column].clone() - self.tableWidget_2.setHorizontalHeaderLabels(["Type", "Code", "Schema", "Table"]) - self.tableWidget_2.setColumnCount(4) + self.tableWidget_2.setHorizontalHeaderLabels(["Type", "Code", "Schema", "Table", "Favorit"]) + self.tableWidget_2.setColumnCount(5) self.tableWidget_2.setItem(selected_row, column, cloned_item) self.tableWidget_2.setColumnWidth(0, 20) self.tableWidget_2.setColumnWidth(1, 70) self.tableWidget_2.setColumnWidth(2, 300) self.tableWidget_2.setColumnWidth(3, 300) + self.tableWidget_2.setColumnWidth(4, 20) def item_already_exists(self, new_item_text): # Assuming you want to compare items in the first column for uniqueness @@ -588,6 +657,18 @@ class Flux_Editor(QDialog, EDITOR_CLASS): self.comboBox.addItem(baxval[0]) NoSignals = 0 + def filtre_favorit(self, filter_fav): + if self.toolButton_2.text() == "0": + self.toolButton_2.setText("1") + for i in range(self.tableWidget.rowCount()): + item = self.tableWidget.item(i, 4) + match = self.toolButton_2.text() not in item.text().lower() + self.tableWidget.setRowHidden(i, match) + elif self.toolButton_2.text() == "1": + self.toolButton_2.setText("0") + for i in range(self.tableWidget.rowCount()): + self.tableWidget.setRowHidden(i, False) + def filtre_dynamique(self, filter_text): if filter_text.find(' ') >= 0: filter_text = filter_text.replace(" ", "_") @@ -595,6 +676,10 @@ class Flux_Editor(QDialog, EDITOR_CLASS): for j in range(self.tableWidget.columnCount()): item = self.tableWidget.item(i, j) match = filter_text.lower() not in item.text().lower() + if match is False: + if self.toolButton_2.text() == "1": + item = self.tableWidget.item(i, 4) + match = self.toolButton_2.text() not in item.text().lower() self.tableWidget.setRowHidden(i, match) if not match: break @@ -637,6 +722,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS): DepName = QTableWidgetItem('form') SchemaName = QTableWidgetItem(e[0][6:]) TableName = QTableWidgetItem(e[1][len(e[0]) + 1:]) + FavoritStatut = QTableWidgetItem('FavIcon') self.tableWidget.insertRow(row_count) itemIcon = QTableWidgetItem() @@ -648,6 +734,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS): self.tableWidget.setItem(row_count, 1, DepName) self.tableWidget.setItem(row_count, 2, SchemaName) self.tableWidget.setItem(row_count, 3, TableName) + self.tableWidget.setItem(row_count, 3, FavoritStatut) if TableSomme == 0: for j in range(self.tableWidget.columnCount()): self.tableWidget.item(row_count, j).setBackground(QtGui.QColor(246, 185, 73, 50)) diff --git a/CenRa_FLUX/metadata.txt b/CenRa_FLUX/metadata.txt index 1dc5ec3c..6f9762fd 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.14 +version=3.15 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:


08/12/2025 - Version 3.14:

- message d'erreur pour les drois de couche sur la DB.


08/12/2025 - Version 3.13:

- Detection des droit utilisateur.


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.

+changelog=

CenRa_FLUX:


10/02/2026 - Version 3.15:

- Sauvegarde la recherche.


08/12/2025 - Version 3.14:

- message d'erreur pour les drois de couche sur la DB.


08/12/2025 - Version 3.13:

- Detection des droit utilisateur.


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/CenRa_FLUX/tools/icons/mStarIconAdd.png b/CenRa_FLUX/tools/icons/mStarIconAdd.png new file mode 100644 index 00000000..95edbfd0 Binary files /dev/null and b/CenRa_FLUX/tools/icons/mStarIconAdd.png differ diff --git a/CenRa_FLUX/tools/icons/mStarIconDel.png b/CenRa_FLUX/tools/icons/mStarIconDel.png new file mode 100644 index 00000000..4c5389ae Binary files /dev/null and b/CenRa_FLUX/tools/icons/mStarIconDel.png differ diff --git a/CenRa_FLUX/tools/ui/CenRa_Flux_base - Copie.ui b/CenRa_FLUX/tools/ui/CenRa_Flux_base - Copie.ui index dbeae75f..517afc8d 100644 --- a/CenRa_FLUX/tools/ui/CenRa_Flux_base - Copie.ui +++ b/CenRa_FLUX/tools/ui/CenRa_Flux_base - Copie.ui @@ -9,243 +9,387 @@ 0 0 - 910 - 800 + 890 + 810 - 910 - 800 + 600 + 400 - 910 - 800 + 890 + 810 SIG CEN-RA - - - - 260 - 130 - 171 - 22 - + + false + + + + QLayout::SetMaximumSize - - false + + 0 - - + + 0 - - - - - 370 - 80 - 171 - 22 - + + 0 - - false + + 0 - - + + 0 - - - - - 345 - 10 - 221 - 71 - - - - - - - :/plugins/CenRa_FLUX/logo.jpg - - - true - - - - - - 370 - 750 - 171 - 23 - - - - Charger les couches - - - - - true - - - - 30 - 170 - 850 - 281 - - - - QAbstractItemView::SingleSelection - - - true - - - - - - 30 - 550 - 850 - 181 - - - - QAbstractItemView::SingleSelection - - - - - - 400 - 470 - 61 - 61 - - - - - - - - :/plugins/CenRa_FLUX/arrow-bottom.png:/plugins/CenRa_FLUX/arrow-bottom.png - - - - 50 - 40 - - - - - - - 460 - 470 - 61 - 61 - - - - - - - - :/plugins/CenRa_FLUX/arrow-up.png:/plugins/CenRa_FLUX/arrow-up.png - - - - 50 - 40 - - - - - - true - - - - 480 - 130 - 171 - 21 - - - - Recherche par mots-clés - - - Qt::AlignCenter - - - false - - - true - - - - - - 40 - 150 - 161 - 16 - - - - - Calibri - 10 - false - - - - Liste des flux disponibles : - - - - - - 30 - 530 - 171 - 16 - - - - - Calibri - 10 - false - - - - Flux sélectionné(s) à charger : - - - label_3 - comboBox - comboBox_2 - pushButton_2 - tableWidget - tableWidget_2 - commandLinkButton - commandLinkButton_2 - lineEdit - label - label_2 + + + + + 890 + 810 + + + + Qt::ImhNoEditMenu|Qt::ImhNoTextHandles + + + QFrame::NoFrame + + + QFrame::Sunken + + + 0 + + + 0 + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + + 0 + 0 + 890 + 810 + + + + + 890 + 810 + + + + + + 450 + 470 + 61 + 61 + + + + + + + + :/plugins/CenRa_FLUX/arrow-up.png:/plugins/CenRa_FLUX/arrow-up.png + + + + 50 + 40 + + + + + + + 360 + 750 + 171 + 23 + + + + Charger les couches + + + + + + 30 + 150 + 161 + 16 + + + + + Calibri + 10 + false + + + + Liste des flux disponibles : + + + + + + 20 + 550 + 851 + 181 + + + + Qt::ImhNoEditMenu|Qt::ImhNoTextHandles + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + + + + 250 + 130 + 171 + 22 + + + + false + + + + + + + + true + + + + 470 + 130 + 171 + 21 + + + + Recherche par mots-clés + + + Qt::AlignCenter + + + false + + + true + + + + + + 660 + 130 + 21 + 21 + + + + + + + + + true + + + + 20 + 170 + 850 + 281 + + + + + 0 + 0 + + + + QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + true + + + + + + 20 + 530 + 171 + 16 + + + + + Calibri + 10 + false + + + + Flux sélectionné(s) à charger : + + + + + + 335 + 10 + 221 + 71 + + + + + + + :/plugins/CenRa_FLUX/logo.jpg + + + true + + + + + + 360 + 80 + 171 + 22 + + + + + 0 + 0 + + + + false + + + + + + + + + 390 + 470 + 61 + 61 + + + + + + + + :/plugins/CenRa_FLUX/arrow-bottom.png:/plugins/CenRa_FLUX/arrow-bottom.png + + + + 50 + 40 + + + + + + + 830 + 20 + 70 + 17 + + + + + + + + + + 10 + 20 + 71 + 22 + + + + + 0 + 0 + + + + false + + + + + + + + + 90 + 10 + 731 + 731 + + + + background-color: rgba(255, 255, 255,0.50); + + + + + + diff --git a/CenRa_FLUX/tools/ui/CenRa_Flux_base.ui b/CenRa_FLUX/tools/ui/CenRa_Flux_base.ui index 517afc8d..3ce84f75 100644 --- a/CenRa_FLUX/tools/ui/CenRa_Flux_base.ui +++ b/CenRa_FLUX/tools/ui/CenRa_Flux_base.ui @@ -386,6 +386,35 @@ background-color: rgba(255, 255, 255,0.50); + + + + 700 + 130 + 21 + 21 + + + + 0 + + + commandLinkButton_2 + pushButton_2 + label + tableWidget_2 + comboBox + lineEdit + toolButton + tableWidget + label_2 + label_3 + comboBox_2 + commandLinkButton + checkBox + DeBUG + toolButton_2 + viewer diff --git a/CenRa_FLUX/tools/ui/star.png b/CenRa_FLUX/tools/ui/star.png new file mode 100644 index 00000000..b1767ab7 Binary files /dev/null and b/CenRa_FLUX/tools/ui/star.png differ diff --git a/plugins.xml b/plugins.xml index 213a2e38..d06c287e 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.14 + 3.15 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-12-15 + 2026-02-10 False False cenra,flux