This commit is contained in:
Tom LAVEILLE 2025-02-04 16:56:19 +01:00
parent be3a082f93
commit 80a563357d
6 changed files with 57 additions and 14 deletions

View File

@ -72,6 +72,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.tableWidget.setSelectionBehavior(QTableWidget.SelectRows)
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
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)
@ -81,6 +82,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.commandLinkButton_2.clicked.connect(self.suppression_flux)
self.tableWidget_2.itemDoubleClicked.connect(self.suppression_flux)
self.comboBox_2.currentIndexChanged.connect(self.bd_source)
self.toolButton.clicked.connect(self.getCanevas)
layout = QVBoxLayout()
self.lineEdit.textChanged.connect(self.filtre_dynamique)
layout.addWidget(self.lineEdit)
@ -356,6 +358,20 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
if not match:
break
def getCanevas(self):
print(iface.mapCanvas().extent())
# SQL_EXTENT = ''
# SQL_GEOM = "SELECT f_table_schema,f_table_name FROM geometry_columns WHERE f_geometry_column = 'geom'"
# cur.execute(SQL_GEOM)
# TableHaveGeom = cur.fetchall()
# for e in TableHaveGeom:
# SchemaName = e[0]
# TableName = e[1]
# if SchemaName[0:5] != '_form':
# if SchemaName[0:4] == '_01_' or SchemaName[0:4] == '_42_' or SchemaName[0:4] == '_69_':
# SQL_EXTENT=SQL_EXTENT+"SELECT st_envelope(st_union(geom)),'"+TableName+"' AS table_name FROM "+'"'+SchemaName+'"."'+TableName+'"'+' UNION ALL '
# SQL_EXTENT = SQL_EXTENT[:-11]
# print(SQL_EXTENT)
def popup(self):
self.dialog = Popup() # +++ - self

View File

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<resources>
</resources>
<widget class="QDialog" name="Dialog">
<property name="enabled">
<bool>true</bool>
@ -65,8 +63,8 @@
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>350</x>
<y>20</y>
<x>345</x>
<y>10</y>
<width>221</width>
<height>71</height>
</rect>
@ -75,7 +73,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources.qrc">:/plugins/CenRa_FLUX/logo.jpg</pixmap>
<pixmap>:/plugins/CenRa_FLUX/logo.jpg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
@ -139,7 +137,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<iconset>
<normaloff>:/plugins/CenRa_FLUX/arrow-bottom.png</normaloff>:/plugins/CenRa_FLUX/arrow-bottom.png</iconset>
</property>
<property name="iconSize">
@ -162,7 +160,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<iconset>
<normaloff>:/plugins/CenRa_FLUX/arrow-up.png</normaloff>:/plugins/CenRa_FLUX/arrow-up.png</iconset>
</property>
<property name="iconSize">
@ -237,6 +235,18 @@
<string>Flux sélectionné(s) à charger :</string>
</property>
</widget>
<zorder>label_3</zorder>
<zorder>comboBox</zorder>
<zorder>comboBox_2</zorder>
<zorder>pushButton_2</zorder>
<zorder>tableWidget</zorder>
<zorder>tableWidget_2</zorder>
<zorder>commandLinkButton</zorder>
<zorder>commandLinkButton_2</zorder>
<zorder>lineEdit</zorder>
<zorder>label</zorder>
<zorder>label_2</zorder>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -235,6 +235,19 @@
<string>Flux sélectionné(s) à charger :</string>
</property>
</widget>
<widget class="QToolButton" name="toolButton">
<property name="geometry">
<rect>
<x>670</x>
<y>130</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<zorder>label_3</zorder>
<zorder>comboBox</zorder>
<zorder>comboBox_2</zorder>
@ -246,6 +259,7 @@
<zorder>lineEdit</zorder>
<zorder>label</zorder>
<zorder>label_2</zorder>
<zorder>toolButton</zorder>
</widget>
<resources/>
<connections/>

View File

@ -12,7 +12,7 @@
name=CenRa_POSTGIS
qgisMinimumVersion=3.0
description=Permet de crée un dossier dans la base PostGis
version=2.4
version=2.5
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
email=si_besoin@cen-rhonealpes.fr
@ -21,7 +21,7 @@ email=si_besoin@cen-rhonealpes.fr
# Optional items:
# Uncomment the following line and add your changelog entries:
changelog=<h2>CenRa_POSTGIS:</h2></br><p><h3>23/01/2025 - Version 2.4: </h3> - Correctif sur les pkey.</p></br><p><h3>22/01/2025 - Version 2.3: </h3> - Correctif sur la creation de projet.</p></br><p><h3>21/01/2025 - Version 2.2: </h3> - Correctif sur la longeur des nom.</p></br><p><h3>07/01/2025 - Version 2.1: </h3> - ByPass du certif ssl ci erreur.</p></br><p><h3>22/10/2024 - Version 2.0:</h3>- Refont du code.</p>
changelog=<h2>CenRa_POSTGIS:</h2></br><p><h3>04/02/2025 - Version 2.5: </h3> - Correctif bug création de couche.</p></br><p><h3>23/01/2025 - Version 2.4: </h3> - Correctif sur les pkey.</p></br><p><h3>22/01/2025 - Version 2.3: </h3> - Correctif sur la creation de projet.</p></br><p><h3>21/01/2025 - Version 2.2: </h3> - Correctif sur la longeur des nom.</p></br><p><h3>07/01/2025 - Version 2.1: </h3> - ByPass du certif ssl ci erreur.</p></br><p><h3>22/10/2024 - Version 2.0:</h3>- Refont du code.</p>
# tags are comma separated with spaces allowed
tags=cenra, postgis, database

View File

@ -373,16 +373,19 @@ def create_travaux(self,schema,cur,con,host ,port ,dbname ,user ,mdp):
def create_habita(self,schema,cur,con,host ,port ,dbname ,user ,mdp):
### Creation de la table habitat
if self.couche_habitat.isChecked():
if self.annee_2.text() == 'aaaa' or self.annee_2.text() == '':
if self.annee_2.text() == 'aaaa' or self.annee_2.text() == '':
tablename = schema + "_habitat"
else :
tablename = schema + "_habitat_" + self.annee_2.text()
tablename_1=tablename+"_points"
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+ tablename_1[len(schema):]+"','gid')"
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+tablename_1+"','gid')"
tablename_qgis = tablename_1[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
SQL_VEGETHAB = "CREATE TABLE "+ schema + "."+ tablename_1 + champ_vegethab_point
print(RETURNE)
print('')
print(SQL_VEGETHAB)
cur.execute(SQL_VEGETHAB)
cur.execute(RETURNE)
sequence_name = cur.fetchone()[0]

View File

@ -1,8 +1,8 @@
<?xml version = '1.0' encoding = 'UTF-8'?>
<plugins>
<pyqgis_plugin name="CenRa_POSTGIS" version="2.4">
<pyqgis_plugin name="CenRa_POSTGIS" version="2.5">
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
<version>2.4</version>
<version>2.5</version>
<qgis_minimum_version>3.16</qgis_minimum_version>
<homepage>https://plateformesig.cenra-outils.org/</homepage>
<file_name>CenRa_POSTGIS.zip</file_name>
@ -11,7 +11,7 @@
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_POSTGIS.zip</download_url>
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
<create_date>2024-02-06</create_date>
<update_date>2025-01-23</update_date>
<update_date>2025-02-04</update_date>
<experimental>False</experimental>
<deprecated>False</deprecated>
<tags>cenra,postgis</tags>