diff --git a/.gitignore b/.gitignore
index 7d5b135..4f038e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,13 +3,13 @@
#Ignores all folders
/*
-*__pycache__/
-plugins.xml
#Except Plugin folders
-!/CenRa_AUTOMAP/*
!/CenRa_COPIE/*
!/CenRa_FLUX/*
!/CenRa_METABASE/*
!/CenRa_POSTGIS/*
-!/CenRa_SICEN/*
\ No newline at end of file
+!/CenRa_SICEN/*
+!/CenRa_AUTOMAP/*
+
+*__pycache__*
diff --git a/CenRa_AUTOMAP/tools/icons/icon.png b/CenRa_AUTOMAP/tools/icons/icon.png
index b2dbed9..a0b6c4a 100644
Binary files a/CenRa_AUTOMAP/tools/icons/icon.png and b/CenRa_AUTOMAP/tools/icons/icon.png differ
diff --git a/CenRa_AUTOMAP/tools/mise_en_pages/1. Modèle carto standard.qpt b/CenRa_AUTOMAP/tools/mise_en_pages/1. Modèle carto standard.qpt
deleted file mode 100644
index 0660974..0000000
--- a/CenRa_AUTOMAP/tools/mise_en_pages/1. Modèle carto standard.qpt
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CenRa_AUTOMAP/tools/mise_en_pages/2. Modèle carto plein page.qpt b/CenRa_AUTOMAP/tools/mise_en_pages/2. Modèle carto plein page.qpt
deleted file mode 100644
index 0660974..0000000
--- a/CenRa_AUTOMAP/tools/mise_en_pages/2. Modèle carto plein page.qpt
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CenRa_AUTOMAP/tools/mise_en_pages/NorthArrow_02.svg b/CenRa_AUTOMAP/tools/mise_en_pages/NorthArrow_02.svg
deleted file mode 100644
index 86fa08b..0000000
--- a/CenRa_AUTOMAP/tools/mise_en_pages/NorthArrow_02.svg
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/CenRa_AUTOMAP/tools/mise_en_pages/NorthArrow_03.svg b/CenRa_AUTOMAP/tools/mise_en_pages/NorthArrow_03.svg
deleted file mode 100644
index 5e2ac9a..0000000
--- a/CenRa_AUTOMAP/tools/mise_en_pages/NorthArrow_03.svg
+++ /dev/null
@@ -1,47 +0,0 @@
-
diff --git a/CenRa_AUTOMAP/tools/mise_en_pages/canvas.py b/CenRa_AUTOMAP/tools/mise_en_pages/canvas.py
deleted file mode 100644
index b054915..0000000
--- a/CenRa_AUTOMAP/tools/mise_en_pages/canvas.py
+++ /dev/null
@@ -1,317 +0,0 @@
-from qgis.core import (
- QgsLayoutSize,
- QgsUnitTypes,
- QgsLayoutPoint,
-)
-
-def fletch_canvas(self,values_page):
- ### Modèle carto standard ###
- if values_page == '1. Modèle carto standard.qpt':
- if self.radioButton_6.isChecked() and self.radioButton_7.isChecked():
-
- self.template_parameters['position_map_size'] = QgsLayoutSize(50, 50, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['position_map_position'] = QgsLayoutPoint(2.5, 20, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['map_size'] = QgsLayoutSize(199, 175, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['map_position'] = QgsLayoutPoint(5, 25, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['title_size'] = QgsLayoutSize(200, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['title_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['subtitle_size'] = QgsLayoutSize(200, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['subtitle_position'] = QgsLayoutPoint(5, 12, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_size'] = QgsLayoutSize(46, 16, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_position'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_credit_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_credit_position'] = QgsLayoutPoint(5, 275, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['legend_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['legend_position'] = QgsLayoutPoint(5, 205, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebarnumeric_size'] = QgsLayoutSize(55, 5, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebarnumeric_position'] = QgsLayoutPoint(145, 228, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebar_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebar_position'] = QgsLayoutPoint(145, 215, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['north_size'] = QgsLayoutSize(12, 12, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['north_position'] = QgsLayoutPoint(193, 214, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text_position'] = QgsLayoutPoint(205, 125, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text2_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text2_position'] = QgsLayoutPoint(104, 201, QgsUnitTypes.LayoutMillimeters)
-
-
-
- if self.radioButton_6.isChecked() and self.radioButton_8.isChecked():
-
- self.template_parameters['position_map_size'] = QgsLayoutSize(100, 100, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['position_map_position'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['map_size'] = QgsLayoutSize(285, 145, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['map_position'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['title_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['title_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['subtitle_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['subtitle_position'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_size'] = QgsLayoutSize(46, 16, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_position'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_credit_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_credit_position'] = QgsLayoutPoint(5, 185, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['legend_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['legend_position'] = QgsLayoutPoint(5, 168, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebarnumeric_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebarnumeric_position'] = QgsLayoutPoint(207, 193, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebar_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebar_position'] = QgsLayoutPoint(207, 180, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['north_size'] = QgsLayoutSize(8.4, 12.5, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['north_position'] = QgsLayoutPoint(273, 182, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text_position'] = QgsLayoutPoint(291.5, 123, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text2_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text2_position'] = QgsLayoutPoint(189, 168.5, QgsUnitTypes.LayoutMillimeters)
-
-
-
- if self.radioButton_5.isChecked() and self.radioButton_7.isChecked():
-
- self.template_parameters['map_size'] = QgsLayoutSize(285, 260, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['map_position'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['title_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['title_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['subtitle_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['subtitle_position'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_size'] = QgsLayoutSize(46, 16, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_position'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_credit_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_credit_position'] = QgsLayoutPoint(5, 395, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['legend_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['legend_position'] = QgsLayoutPoint(5, 284, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebarnumeric_size'] = QgsLayoutSize(50, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebarnumeric_position'] = QgsLayoutPoint(207, 310, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebar_size'] = QgsLayoutSize(50, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebar_position'] = QgsLayoutPoint(207, 298, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['north_size'] = QgsLayoutSize(8.4, 12.5, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['north_position'] = QgsLayoutPoint(273, 297, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text_position'] = QgsLayoutPoint(291.5, 123, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text2_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text2_position'] = QgsLayoutPoint(189, 284, QgsUnitTypes.LayoutMillimeters)
-
-
-
- if self.radioButton_5.isChecked() and self.radioButton_8.isChecked():
-
- self.template_parameters['map_size'] = QgsLayoutSize(408.5, 222, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['map_position'] = QgsLayoutPoint(5, 23.5, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['title_size'] = QgsLayoutSize(409, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['title_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['subtitle_size'] = QgsLayoutSize(409, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['subtitle_position'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_size'] = QgsLayoutSize(46, 16, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_position'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_credit_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_credit_position'] = QgsLayoutPoint(5, 275, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['legend_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['legend_position'] = QgsLayoutPoint(5, 249, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebarnumeric_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebarnumeric_position'] = QgsLayoutPoint(323, 282, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebar_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebar_position'] = QgsLayoutPoint(323, 270, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['north_size'] = QgsLayoutSize(8.4, 12.5, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['north_position'] = QgsLayoutPoint(402, 270, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text_position'] = QgsLayoutPoint(415, 123, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text2_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text2_position'] = QgsLayoutPoint(313, 247, QgsUnitTypes.LayoutMillimeters)
-
- ### Modèle carto plein page ###
- if values_page == '2. Modèle carto plein page.qpt':
- if self.radioButton_6.isChecked() and self.radioButton_7.isChecked():
-
- self.template_parameters['position_map_size'] = QgsLayoutSize(50, 50, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['position_map_position'] = QgsLayoutPoint(2.5, 20, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['map_size'] = QgsLayoutSize(210, 297, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['map_position'] = QgsLayoutPoint(0, 0, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['title_size'] = QgsLayoutSize(200, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['title_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['subtitle_size'] = QgsLayoutSize(200, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['subtitle_position'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_size'] = QgsLayoutSize(48, 17, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_credit_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_credit_position'] = QgsLayoutPoint(5, 275, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['legend_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['legend_position'] = QgsLayoutPoint(133, 215, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebarnumeric_size'] = QgsLayoutSize(64, 7, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebarnumeric_position'] = QgsLayoutPoint(3, 288, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebar_size'] = QgsLayoutSize(65, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebar_position'] = QgsLayoutPoint(3, 273, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['north_size'] = QgsLayoutSize(12, 12, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['north_position'] = QgsLayoutPoint(196, 283, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text_position'] = QgsLayoutPoint(205, 125, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text2_size'] = QgsLayoutSize(100, 4, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text2_position'] = QgsLayoutPoint(55, 292, QgsUnitTypes.LayoutMillimeters)
-
- if self.radioButton_6.isChecked() and self.radioButton_8.isChecked():
-
- self.template_parameters['position_map_size'] = QgsLayoutSize(100, 100, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['position_map_position'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['map_size'] = QgsLayoutSize(297, 210, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['map_position'] = QgsLayoutPoint(0, 0, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['title_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['title_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['subtitle_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['subtitle_position'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_size'] = QgsLayoutSize(48, 17, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_credit_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_credit_position'] = QgsLayoutPoint(5, 185, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['legend_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['legend_position'] = QgsLayoutPoint(231, 135, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebarnumeric_size'] = QgsLayoutSize(64, 7, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebarnumeric_position'] = QgsLayoutPoint(3, 201, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebar_size'] = QgsLayoutSize(65, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebar_position'] = QgsLayoutPoint(3, 186, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['north_size'] = QgsLayoutSize(12, 12, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['north_position'] = QgsLayoutPoint(283, 196, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text_position'] = QgsLayoutPoint(291.5, 123, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text2_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text2_position'] = QgsLayoutPoint(98, 205, QgsUnitTypes.LayoutMillimeters)
-
- if self.radioButton_5.isChecked() and self.radioButton_7.isChecked():
-
- self.template_parameters['position_map_size'] = QgsLayoutSize(50, 50, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['position_map_position'] = QgsLayoutPoint(2.5, 20, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['map_size'] = QgsLayoutSize(297, 420, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['map_position'] = QgsLayoutPoint(0, 0, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['title_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['title_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['subtitle_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['subtitle_position'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_size'] = QgsLayoutSize(48, 17, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_credit_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_credit_position'] = QgsLayoutPoint(5, 370, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['legend_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['legend_position'] = QgsLayoutPoint(219, 324, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebarnumeric_size'] = QgsLayoutSize(64, 7, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebarnumeric_position'] = QgsLayoutPoint(3, 410, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebar_size'] = QgsLayoutSize(65, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebar_position'] = QgsLayoutPoint(3, 395, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['north_size'] = QgsLayoutSize(24, 24, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['north_position'] = QgsLayoutPoint(271, 394, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text_position'] = QgsLayoutPoint(291, 125, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text2_size'] = QgsLayoutSize(100, 4, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text2_position'] = QgsLayoutPoint(98, 414, QgsUnitTypes.LayoutMillimeters)
-
- if self.radioButton_5.isChecked() and self.radioButton_8.isChecked():
-
- self.template_parameters['position_map_size'] = QgsLayoutSize(100, 100, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['position_map_position'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['map_size'] = QgsLayoutSize(420, 297, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['map_position'] = QgsLayoutPoint(0, 0, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['title_size'] = QgsLayoutSize(411, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['title_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['subtitle_size'] = QgsLayoutSize(411, 8, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['subtitle_position'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_size'] = QgsLayoutSize(48, 17, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_position'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['logo_credit_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['logo_credit_position'] = QgsLayoutPoint(5, 247, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['legend_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['legend_position'] = QgsLayoutPoint(341, 196, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebarnumeric_size'] = QgsLayoutSize(64, 7, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebarnumeric_position'] = QgsLayoutPoint(3, 287, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['scalebar_size'] = QgsLayoutSize(65, 15, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['scalebar_position'] = QgsLayoutPoint(3, 272, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['north_size'] = QgsLayoutSize(24, 24, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['north_position'] = QgsLayoutPoint(394, 271, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text_size'] = QgsLayoutSize(100, 4, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text_position'] = QgsLayoutPoint(414, 123, QgsUnitTypes.LayoutMillimeters)
-
- self.template_parameters['credit_text2_size'] = QgsLayoutSize(100, 4, QgsUnitTypes.LayoutMillimeters)
- self.template_parameters['credit_text2_position'] = QgsLayoutPoint(185, 292, QgsUnitTypes.LayoutMillimeters)
-
- # Retour des info #
- return self.template_parameters
\ No newline at end of file
diff --git a/CenRa_COPIE/README.md b/CenRa_COPIE/README.md
deleted file mode 100644
index 514d8fb..0000000
--- a/CenRa_COPIE/README.md
+++ /dev/null
@@ -1 +0,0 @@
-# CenRa_COPIE
\ No newline at end of file
diff --git a/CenRa_COPIE/cenra.py b/CenRa_COPIE/cenra.py
deleted file mode 100644
index 9331a43..0000000
--- a/CenRa_COPIE/cenra.py
+++ /dev/null
@@ -1,925 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-/***************************************************************************
- CenRa
- A QGIS plugin
- Conservatoire d'Espaces Naturels de Rhône-Alpes
- -------------------
- begin : 2014-03-27
- copyright : (C) 2014 by Conservatoire d'Espaces Naturels de Rhône-Alpes
- email : guillaume.costes@espaces-naturels.fr
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-"""
-from __future__ import absolute_import
-# Import the PyQt and QGIS libraries
-from builtins import next
-from builtins import str
-from builtins import object
-from qgis.PyQt.QtCore import QSettings
-from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog
-from qgis.PyQt.QtGui import QIcon
-from PyQt5.QtCore import *
-from PyQt5.QtGui import *
-from qgis.core import *
-from qgis.core import QgsDataSourceUri
-# Initialize Qt resources from file resources.py
-from . import resources_rc
-# Import the code for the dialog
-from .cenradialog import CenRaDialog
-from .table_postgisdialog import table_postgisDialog
-from .tools.PythonSQL import *
-from .tools.resources import maj_verif
-
-import os.path
-import webbrowser, os
-import psycopg2
-import psycopg2.extras
-import base64
-
-class CenRa(object):
-
- def __init__(self, iface):
- # Save reference to the QGIS interface
- self.iface = iface
- # initialize plugin directory
- self.plugin_dir = os.path.dirname(__file__)
- # initialize locale
- locale = QSettings().value("locale/userLocale")[0:2]
- localePath = os.path.join(self.plugin_dir, 'i18n', 'cenra_{}.qm'.format(locale))
-
- if os.path.exists(localePath):
- self.translator = QTranslator()
- self.translator.load(localePath)
-
- if qVersion() > '4.3.3':
- QCoreApplication.installTranslator(self.translator)
-
- # Create the dialog (after translation) and keep reference
- self.dlg = CenRaDialog()
- self.dlgAjout = table_postgisDialog()
- maj_verif('CenRa_POSTGIS')
- def initGui(self):
- self.toolBar = self.iface.addToolBar("CEN-RA")
- self.toolBar.setObjectName("CEN-RA")
-
- # ***Create action that will start plugin configuration
- self.action = QAction(
- QIcon(":/plugins/CenRa/page_new.png"),
- u"Création d'un dossier", self.iface.mainWindow())
- # connect the action to the run method
- self.action.triggered.connect(self.creation)
-
- # Add toolbar button and menu item
- self.toolBar.addAction(self.action)
- self.iface.addPluginToMenu(u"CenRa", self.action)
-
- # ***Create action that will start plugin configuration
- self.action = QAction(
- QIcon(":/plugins/CenRa/page_ajout.png"),
- u"Ajout d'une table", self.iface.mainWindow())
- # connect the action to the run method
- self.action.triggered.connect(self.ajout)
-
- # Add toolbar button and menu item
- self.toolBar.addAction(self.action)
- self.iface.addPluginToMenu(u"&CenRa", self.action)
-
- # ***Create action that will start plugin configuration
- self.action = QAction(
- QIcon(":/plugins/CenRa/help.png"),
- u"Aide", self.iface.mainWindow())
- # connect the action to the run method
- self.action.triggered.connect(self.doHelp)
-
- # Add toolbar button and menu item
- self.toolBar.addAction(self.action)
- self.iface.addPluginToMenu(u"CenRa", self.action)
-
- self.menu = QMenu()
- self.menu.setTitle( QCoreApplication.translate( "CENRA","&CenRa" ) )
-
- self.cenra_new = QAction( QIcon(":/plugins/CenRa/page_new.png"), QCoreApplication.translate("CENRA", u"Création d'un dossier" ), self.iface.mainWindow() )
- self.cenra_ajout = QAction( QIcon(":/plugins/CenRa/page_ajout.png"), QCoreApplication.translate("CENRA", "Ajout d'une table" ), self.iface.mainWindow() )
- self.cenra_help = QAction( QIcon(":/plugins/CenRa/help.png"), QCoreApplication.translate("CENRA", "Aide" ), self.iface.mainWindow() )
-
- self.menu.addActions( [self.cenra_new, self.cenra_ajout, self.cenra_help] )
-
- menu_bar = self.iface.mainWindow().menuBar()
- actions = menu_bar.actions()
- lastAction = actions[ len( actions ) - 1 ]
- menu_bar.insertMenu( lastAction, self.menu )
-
- self.cenra_new.triggered.connect(self.creation)
- self.cenra_ajout.triggered.connect(self.ajout)
- self.cenra_help.triggered.connect(self.doHelp)
-
- def unload(self):
- # Remove the plugin menu item and icon
- self.iface.removePluginMenu(u"&CENRA", self.action)
- self.iface.removePluginMenu(u"&CenRa", self.action)
- self.iface.removeToolBarIcon(self.action)
-
- # run method that performs all the real work
- def creation(self):
- # show the dialog
- self.dlg.show()
- # Run the dialog event loop
- result = self.dlg.exec_()
- # See if OK was pressed
- if result == 1:
-
-#**********************************Debut_script****************************************
-
- ### Creation du schema pour le nouveau site
- if self.dlg.at.isChecked():
- schema = "_" + self.dlg.dept.currentText() + "_at_" + self.dlg.nom.text().lower() # Ajout de "_" pour eviter pb de numero en premier caractere
- else :
- schema = "_" + self.dlg.dept.currentText() + "_" + self.dlg.nom.text().lower() # Ajout de "_" pour eviter pb de numero en premier caractere
-
- if self.dlg.nom.text() == "" or self.dlg.nom.text() == "NULL":
- QMessageBox.warning(None, "Oups :", "Veuillez renseigner un nom de dossier.")
- return
-
- ch = [u"à", u"À", u"â", u"Â", u"ä", u"Ä", u"å", u"Å", u"ç", u"Ç", u"é", u"É", u"è", u"È", u"ê", u"Ê", u"ë", u"Ë", u"î", u"Î", u"ï", u"Ï", u"ô", u"Ô", u"ö", u"Ö", u"ù", u"Ù", u"û", u"Û", u"ü", u"Ü", u"ÿ", u"Ÿ", u"'", u"-", u" "]
- for car in ch :
- if self.dlg.nom.text().find(car) != -1 :
- QMessageBox.warning(None, "Oups :", u"Le nom de dossier ne doit pas comporter de caractères spéciaux, ni d'espaces !\n\n\t" + self.dlg.nom.text().lower() )
- return
-
- first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
- first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
- res_ident = first_cur.fetchone()
- mdp = base64.b64decode(str(res_ident[0])).decode('utf-8')
- user = res_ident[1]
- con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
- cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_conn.close()
-
- SQL_schema = "CREATE SCHEMA " + schema + ";"
- SQL_GRANT_SCHEMA="GRANT CREATE, USAGE ON SCHEMA "+schema+" TO grp_qgis; GRANT CREATE, USAGE ON SCHEMA "+schema+" TO grp_sig;"
-
- cur.execute(SQL_schema)
- cur.execute(SQL_GRANT_SCHEMA)
-
- ### Creation de la table contour
- if self.dlg.couche_contour.isChecked(): # Verifie si la checkbox est cochee
- if self.dlg.annee_1.text() == 'aaaa' or self.dlg.annee_1.text() == '':
- tablename = schema + "_contour"
- else :
- tablename = schema + "_contour_" + self.dlg.annee_1.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- SQL_contour = "CREATE TABLE " + schema + "."+ tablename + champ_contour
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'contour_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_contour)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- ### Creation de la table habitat
- if self.dlg.couche_habitat.isChecked():
- if self.dlg.annee_2.text() == 'aaaa' or self.dlg.annee_2.text() == '':
- tablename = schema + "_habitat"
- else :
- tablename = schema + "_habitat_" + self.dlg.annee_2.text()
- tablename_1=tablename+"_points"
- 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
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename_1 + " ADD CONSTRAINT " + tablename_1 + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_coordonnees = "CREATE TRIGGER coordonnees" + tablename_1 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_1 + " FOR EACH ROW EXECUTE PROCEDURE ref.coordonnees();"
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename_1 + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'vegethab_points_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_1+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_1+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename_1+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_VEGETHAB)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_coordonnees)
- cur.execute(SQL_style)
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
- ### Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename_1, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- tablename_2=tablename+"_lignes"
- tablename_qgis = tablename_2[1:]
- SQL_VEGETHAB = "CREATE TABLE "+ schema + "."+ tablename_2 + champ_vegethab_multilinestring
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename_2 + " ADD CONSTRAINT " + tablename_2 + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_length_m = "CREATE TRIGGER length_m" + tablename_2 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_2 + " FOR EACH ROW EXECUTE PROCEDURE ref.length_m();"
- SQL_trigger_length_km = "CREATE TRIGGER length_km" + tablename_2 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_2 + " FOR EACH ROW EXECUTE PROCEDURE ref.length_km();"
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename_2 + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'vegethab_lignes_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_2+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_2+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename_2+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_VEGETHAB)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_length_m)
- cur.execute(SQL_trigger_length_km)
- cur.execute(SQL_style)
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
- ### Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename_2, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- tablename_3=tablename+"_polygones"
- tablename_qgis = tablename_3[1:]
- SQL_VEGETHAB = "CREATE TABLE "+ schema + "."+ tablename_3 + champ_vegethab_multipolygon
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename_3 + " ADD CONSTRAINT " + tablename_3 + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename_3 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_3 + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename_3 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_3 + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename_3 + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'vegethab_polygones_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_3+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_3+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename_3+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_VEGETHAB)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
- cur.execute(SQL_style)
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
- ### Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename_3, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
- '''
- SQL_habitat = "CREATE TABLE " + schema + "."+ tablename + champ_habitat
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
- SQL_trigger_concat_cd_cb = "CREATE TRIGGER concat_cd_cb" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.concat_cd_cb();"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'habitat_modele_v3'"""
-
- cur.execute(SQL_habitat)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
- cur.execute(SQL_trigger_concat_cd_cb)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
- '''
- ### Creation de la table travaux prevus
- if self.dlg.couche_travaux_prevus.isChecked():
- #**********Poly
- if self.dlg.annee_5.text() == 'aaaa' or self.dlg.annee_5.text() == '':
- tablename = schema + "_travaux_prevus_poly"
- else :
- tablename = schema + "_travaux_prevus_poly_" + self.dlg.annee_5.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- SQL_travaux_prevus = "CREATE TABLE " + schema + "."+ tablename + champ_travaux_prevus_multipolygon
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'travaux_prevus_poly_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_travaux_prevus)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
- cur.execute(SQL_GRANT_TABLE)
-
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- #**********ligne
- if self.dlg.annee_5.text() == 'aaaa' or self.dlg.annee_5.text() == '':
- tablename = schema + "_travaux_prevus_ligne"
- else :
- tablename = schema + "_travaux_prevus_ligne_" + self.dlg.annee_5.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- SQL_travaux_prevus = "CREATE TABLE " + schema + "."+ tablename + champ_travaux_prevus_multilinestring
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
- SQL_trigger_length_m = "CREATE TRIGGER length_m" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.length_m();"
- SQL_trigger_length_km = "CREATE TRIGGER length_km" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.length_km();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'travaux_prevus_ligne_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_travaux_prevus)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_trigger_length_m)
- cur.execute(SQL_trigger_length_km)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
- cur.execute(SQL_GRANT_TABLE)
-
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- #**********point
- if self.dlg.annee_5.text() == 'aaaa' or self.dlg.annee_5.text() == '':
- tablename = schema + "_travaux_prevus_point"
- else :
- tablename = schema + "_travaux_prevus_point_" + self.dlg.annee_5.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- SQL_travaux_prevus = "CREATE TABLE " + schema + "."+ tablename + champ_travaux_prevus_point
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
- SQL_trigger_coordonnees = "CREATE TRIGGER coordonnees" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.coordonnees();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'travaux_prevus_point_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_travaux_prevus)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_trigger_coordonnees)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
- cur.execute(SQL_GRANT_TABLE)
-
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- ### Creation de la table vierge
- if self.dlg.couche_vierge.isChecked():
- if self.dlg.annee_4.text() == 'aaaa' or self.dlg.annee_4.text() == '':
- tablename = schema + "_" + self.dlg.nom_couche_vierge.text().lower()
- else :
- tablename = schema + "_" + self.dlg.nom_couche_vierge.text().lower() + "_" + self.dlg.annee_4.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- if self.dlg.couche_vierge_point.isChecked() == 1 :
- champ_vierge = champ_viergePoint
-
- if self.dlg.couche_vierge_ligne.isChecked() == 1 :
- champ_vierge = champ_viergeLigne
-
- if self.dlg.couche_vierge_polygone.isChecked() == 1 :
- champ_vierge = champ_viergePolygone
-
- SQL_vierge = "CREATE TABLE " + schema + "."+ tablename + champ_vierge
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
-
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
- SQL_trigger_length_m = "CREATE TRIGGER length_m" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.length_m();"
- SQL_trigger_length_km = "CREATE TRIGGER length_km" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.length_km();"
- SQL_trigger_coordonnees = "CREATE TRIGGER coordonnees" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.coordonnees();"
-
- cur.execute(SQL_vierge)
- cur.execute(SQL_pkey)
-
- if self.dlg.couche_vierge_point.isChecked() == 1 :
- cur.execute(SQL_trigger_coordonnees)
-
- if self.dlg.couche_vierge_ligne.isChecked() == 1 :
- cur.execute(SQL_trigger_length_m)
- cur.execute(SQL_trigger_length_km)
-
- if self.dlg.couche_vierge_polygone.isChecked() == 1 :
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
-
- con.commit()
-
- ### Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- else :
- con.commit()
-
- con.close()
- pass
-
- ### Outil Aide
- def doHelp(self):
- webbrowser.open("http://plateformesig.cenra-outils.org/")
-
- ### Outil Ajout de nouvelles couche a un dossier
- def ajout(self):
- first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
- first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
- res_ident = first_cur.fetchone()
- mdp = base64.b64decode(str(res_ident[0])).decode('utf-8')
- user = res_ident[1]
-
- con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
- cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_conn.close()
- # Creation de la liste des schemas de la base de donnees
- SQL = """WITH list_schema AS (
- select schemaname,'sig' as group from pg_catalog.pg_tables
- where schemaname ~ E'^_(0|1|2|3|4|6|7|f)'
- group by schemaname
- order by schemaname)
-
- select string_agg(schemaname,',')
- from list_schema
- group by "group";"""
-
- cur.execute(SQL)
-
- list_brut = str(next(cur))
- list = list_brut [2:-2]
- listItems = list.split(",")
-
- con.close()
-
- self.dlgAjout.ui.schema.clear()
- self.dlgAjout.ui.schema.addItems(listItems)
- self.dlgAjout.ui.schema.setCurrentIndex(-1) # Pour ne pas commencer la liste au premier schema
-
- # show the dialog
- self.dlgAjout.show()
- # Run the dialog event loop
- result = self.dlgAjout.exec_()
- # See if OK was pressed
- if result == 1:
-#******************************debut script*********************************
- first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
- first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
- res_ident = first_cur.fetchone()
- mdp = base64.b64decode(str(res_ident[0])).decode('utf-8')
- user = res_ident[1]
- con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
- cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_conn.close()
-
- if self.dlgAjout.ui.schema.currentIndex() == -1 :
- QMessageBox.warning(None, "Oups :", "Veuillez choisir un nom de dossier.")
- return
-
- schema = self.dlgAjout.ui.schema.currentText()
-
- ### Creation de la table contour
- if self.dlgAjout.ui.couche_contour.isChecked(): # Verifie si la checkbox est cochee
- if self.dlgAjout.ui.annee_1.text() == 'aaaa' or self.dlgAjout.ui.annee_1.text() == '':
- tablename = schema + "_contour"
- else :
- tablename = schema + "_contour_" + self.dlgAjout.ui.annee_1.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- SQL_contour = "CREATE TABLE " + schema + "."+ tablename + champ_contour
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'contour_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_contour)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- ### Creation de la table habitat
-
- if self.dlgAjout.ui.couche_habitat.isChecked():
- if self.dlgAjout.ui.annee_2.text() == 'aaaa' or self.dlgAjout.ui.annee_2.text() == '':
- tablename = schema + "_habitat"
- else :
- tablename = schema + "_habitat_" + self.dlgAjout.ui.annee_2.text()
-
- tablename_1=tablename+"_points"
- 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
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename_1 + " ADD CONSTRAINT " + tablename_1 + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_coordonnees = "CREATE TRIGGER coordonnees" + tablename_1 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_1 + " FOR EACH ROW EXECUTE PROCEDURE ref.coordonnees();"
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename_1 + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'vegethab_points_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_1+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_1+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename_1+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_VEGETHAB)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_coordonnees)
- cur.execute(SQL_style)
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
- ### Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename_1, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- tablename_2=tablename+"_lignes"
- tablename_qgis = tablename_2[1:]
- SQL_VEGETHAB = "CREATE TABLE "+ schema + "."+ tablename_2 + champ_vegethab_multilinestring
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename_2 + " ADD CONSTRAINT " + tablename_2 + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_length_m = "CREATE TRIGGER length_m" + tablename_2 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_2 + " FOR EACH ROW EXECUTE PROCEDURE ref.length_m();"
- SQL_trigger_length_km = "CREATE TRIGGER length_km" + tablename_2 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_2 + " FOR EACH ROW EXECUTE PROCEDURE ref.length_km();"
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename_2 + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'vegethab_lignes_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_2+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_2+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename_2+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_VEGETHAB)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_length_m)
- cur.execute(SQL_trigger_length_km)
- cur.execute(SQL_style)
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
- ### Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename_2, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- tablename_3=tablename+"_polygones"
- tablename_qgis = tablename_3[1:]
- SQL_VEGETHAB = "CREATE TABLE "+ schema + "."+ tablename_3 + champ_vegethab_multipolygon
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename_3 + " ADD CONSTRAINT " + tablename_3 + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename_3 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_3 + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename_3 + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename_3 + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename_3 + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'vegethab_polygones_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_3+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename_3+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename_3+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_VEGETHAB)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
- cur.execute(SQL_style)
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
- ### Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename_3, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
- '''
- SQL_habitat = "CREATE TABLE " + schema + "."+ tablename + champ_habitat
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
- SQL_trigger_concat_cd_cb = "CREATE TRIGGER concat_cd_cb" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.concat_cd_cb();"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'habitat_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_habitat)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
- cur.execute(SQL_trigger_concat_cd_cb)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
- '''
- ### Creation de la table travaux prevus
- if self.dlgAjout.ui.couche_travaux_prevus.isChecked():
- #**********Poly
- if self.dlgAjout.ui.annee_5.text() == 'aaaa' or self.dlgAjout.ui.annee_5.text() == '':
- tablename = schema + "_travaux_prevus_poly"
- else :
- tablename = schema + "_travaux_prevus_poly_" + self.dlgAjout.ui.annee_5.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- SQL_travaux_prevus = "CREATE TABLE " + schema + "."+ tablename + champ_travaux_prevus_multipolygon
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'travaux_prevus_poly_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_travaux_prevus)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- #**********ligne
- if self.dlgAjout.ui.annee_5.text() == 'aaaa' or self.dlgAjout.ui.annee_5.text() == '':
- tablename = schema + "_travaux_prevus_ligne"
- else :
- tablename = schema + "_travaux_prevus_ligne_" + self.dlgAjout.ui.annee_5.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- SQL_travaux_prevus = "CREATE TABLE " + schema + "."+ tablename + champ_travaux_prevus_multilinestring
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
- SQL_trigger_length_m = "CREATE TRIGGER length_m" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.length_m();"
- SQL_trigger_length_km = "CREATE TRIGGER length_km" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.length_km();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'travaux_prevus_ligne_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_travaux_prevus)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_trigger_length_m)
- cur.execute(SQL_trigger_length_km)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- #**********point
- if self.dlgAjout.ui.annee_5.text() == 'aaaa' or self.dlgAjout.ui.annee_5.text() == '':
- tablename = schema + "_travaux_prevus_point"
- else :
- tablename = schema + "_travaux_prevus_point_" + self.dlgAjout.ui.annee_5.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- SQL_travaux_prevus = "CREATE TABLE " + schema + "."+ tablename + champ_travaux_prevus_point
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
- SQL_trigger_date_creation = "CREATE TRIGGER date_creation" + tablename + " BEFORE INSERT ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_creation();"
- SQL_trigger_date_maj = "CREATE TRIGGER date_maj" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.date_maj();"
- SQL_trigger_coordonnees = "CREATE TRIGGER coordonnees" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.coordonnees();"
-
- SQL_style = """INSERT INTO layer_styles (f_table_catalog, f_table_schema, f_table_name, f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, update_time)
- SELECT f_table_catalog, '""" + schema + "', '" + tablename + """', f_geometry_column, stylename, styleqml, stylesld, useasdefault, "owner", ui, now()
- FROM layer_styles
- WHERE description = 'travaux_prevus_point_modele_v3'"""
- SQL_GRANT_TABLE="GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_qgis;GRANT DELETE, INSERT, REFERENCES, SELECT, TRIGGER, TRUNCATE, UPDATE ON "+schema+"."+tablename+" TO grp_sig;GRANT ALL ON SEQUENCE "+schema+"."+tablename+"_gid_seq TO grp_qgis;"
-
- cur.execute(SQL_travaux_prevus)
- cur.execute(SQL_pkey)
- cur.execute(SQL_trigger_date_creation)
- cur.execute(SQL_trigger_date_maj)
- cur.execute(SQL_trigger_coordonnees)
- cur.execute(SQL_style) ## Enregistrement du style (comme style par defaut) dans la table layer_styles
- cur.execute(SQL_GRANT_TABLE)
-
- con.commit()
-
- ## Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- ### Creation de la table vierge
- if self.dlgAjout.ui.couche_vierge.isChecked():
- if self.dlgAjout.ui.annee_4.text() == 'aaaa' or self.dlgAjout.ui.annee_4.text() == '':
- tablename = schema + "_" + self.dlgAjout.ui.nom_couche_vierge.text().lower()
- else :
- tablename = schema + "_" + self.dlgAjout.ui.nom_couche_vierge.text().lower() + "_" + self.dlgAjout.ui.annee_4.text()
- tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
-
- if self.dlgAjout.ui.couche_vierge_point.isChecked() == 1 :
- champ_vierge = champ_viergePoint
-
- if self.dlgAjout.ui.couche_vierge_ligne.isChecked() == 1 :
- champ_vierge = champ_viergeLigne
-
- if self.dlgAjout.ui.couche_vierge_polygone.isChecked() == 1 :
- champ_vierge = champ_viergePolygone
-
- SQL_vierge = "CREATE TABLE " + schema + "."+ tablename + champ_vierge
- SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
-
- SQL_trigger_area_m2 = "CREATE TRIGGER area_m2" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_m2();"
- SQL_trigger_area_ha = "CREATE TRIGGER area_ha" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.area_ha();"
- SQL_trigger_length_m = "CREATE TRIGGER length_m" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.length_m();"
- SQL_trigger_length_km = "CREATE TRIGGER length_km" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.length_km();"
- SQL_trigger_coordonnees = "CREATE TRIGGER coordonnees" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.coordonnees();"
-
- cur.execute(SQL_vierge)
- cur.execute(SQL_pkey)
-
- if self.dlgAjout.ui.couche_vierge_point.isChecked() == 1 :
- cur.execute(SQL_trigger_coordonnees)
-
- if self.dlgAjout.ui.couche_vierge_ligne.isChecked() == 1 :
- cur.execute(SQL_trigger_length_m)
- cur.execute(SQL_trigger_length_km)
-
- if self.dlgAjout.ui.couche_vierge_polygone.isChecked() == 1 :
- cur.execute(SQL_trigger_area_m2)
- cur.execute(SQL_trigger_area_ha)
-
- con.commit()
-
- ### Affichage de la table
- uri = QgsDataSourceUri()
- # set host name, port, database name, username and password
- uri.setConnection(host ,port ,dbname ,user ,mdp)
- # set database schema, table name, geometry column and optionaly subset (WHERE clause)
- uri.setDataSource(schema, tablename, geom)
-
- layer = self.iface.addVectorLayer(uri.uri(), tablename_qgis, "postgres")
-
- else :
- con.commit()
-
- con.close()
- pass
diff --git a/CenRa_COPIE/copie.py b/CenRa_COPIE/copie.py
index d2d26c8..2f9b075 100644
--- a/CenRa_COPIE/copie.py
+++ b/CenRa_COPIE/copie.py
@@ -36,9 +36,12 @@ from qgis.gui import *
# Initialize Qt resources from file resources.py
from . import resources_rc
# Import the code for the dialog
+import qgis
+from .forms.about_form import CopieAboutDialog
from .copie_dialog import CopieDialog
import os.path
-from .PythonSQL import *
+from .tools.PythonSQL import *
+from .tools.resources import maj_verif
import psycopg2
import psycopg2.extras
import base64
@@ -77,6 +80,15 @@ class Copie(object):
# Create the dialog (after translation) and keep reference
self.dlg = CopieDialog()
+ maj_verif('CenRa_COPIE')
+
+ version = qgis.utils.pluginMetadata('CenRa_COPIE','version')
+ # Display About window on first use
+ s = QSettings()
+ versionUse = s.value("copie/version", 1, type=str)
+ if str(versionUse) != str(version) :
+ s.setValue("copie/version", str(version))
+ self.open_about_dialog()
# Declare instance attributes
self.actions = []
@@ -85,6 +97,10 @@ class Copie(object):
self.toolbar = self.iface.addToolBar(u'Copie')
self.toolbar.setObjectName(u'Copie')
+ def open_about_dialog(self):
+ dialog = CopieAboutDialog(self.iface)
+ dialog.exec_()
+
# noinspection PyMethodMayBeStatic
def tr(self, message):
"""Get the translation for a string using Qt translation API.
diff --git a/CenRa_COPIE/metadata.txt b/CenRa_COPIE/metadata.txt
index 39c179c..737063d 100644
--- a/CenRa_COPIE/metadata.txt
+++ b/CenRa_COPIE/metadata.txt
@@ -10,7 +10,7 @@
name=CenRA_COPIE
qgisMinimumVersion=3.0
description=Permet la copie d'une table dans une base PostGis
-version=1.3
+version=1.5
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
email=si_besoin@cen-rhonealpes.fr
@@ -19,7 +19,7 @@ email=si_besoin@cen-rhonealpes.fr
# Recommended items:
# Uncomment the following line and add your changelog:
-changelog=Traduction pour QGIS v3
+changelog=
CenRa_COPIE:
13/09/2024 - Version 1.5:
- Ajoute d'un changelog et vérification de mise à jour.
# Tags are comma separated with spaces allowed
tags=cenra, database, table
diff --git a/CenRa_COPIE/tools/PythonSQL.py b/CenRa_COPIE/tools/PythonSQL.py
index 9880760..dbb7afc 100644
--- a/CenRa_COPIE/tools/PythonSQL.py
+++ b/CenRa_COPIE/tools/PythonSQL.py
@@ -57,8 +57,8 @@ champ_vegethab_point = """(
occupati_3 bigint,
milieu_cod character varying(254) COLLATE pg_catalog."default",
milieu_lib character varying(254) COLLATE pg_catalog."default",
- x_wgs84 double precision,
- y_wgs84 double precision,
+ surface_m2 numeric,
+ surface_ha numeric,
commentair character varying(254) COLLATE pg_catalog."default",
date_creat date,
date_maj date,
@@ -99,8 +99,8 @@ champ_vegethab_multilinestring = """(
occupati_3 bigint,
milieu_cod character varying(254) COLLATE pg_catalog."default",
milieu_lib character varying(254) COLLATE pg_catalog."default",
- longueur_m double precision,
- longueur_km double precision,
+ surface_m2 numeric,
+ surface_ha numeric,
commentair character varying(254) COLLATE pg_catalog."default",
date_creat date,
date_maj date,
diff --git a/CenRa_COPIE/tools/resources.py b/CenRa_COPIE/tools/resources.py
index c35f9ef..71bbf36 100644
--- a/CenRa_COPIE/tools/resources.py
+++ b/CenRa_COPIE/tools/resources.py
@@ -117,6 +117,7 @@ def login_base(take=None):
user = res_ident[1]
con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
+
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
first_conn.close()
@@ -138,24 +139,45 @@ def send_issues(url,titre,body,labels):
payload = {'title': titre, 'body': body, 'labels': labels}
-
- r = requests.post(url, data=json.dumps(payload), headers=headers)
- print(r.text)
+ try:
+ urllib.request.urlopen('https://google.com')
+ binar = True
+ except:
+ binar = False
+ r = ''
+ if binar:
+ r = requests.post(url, data=json.dumps(payload), headers=headers)
return r
def maj_verif(NAME):
import qgis
- import urllib
+ import urllib.request
+ iface = qgis.utils.iface
+ from qgis.core import Qgis
url = qgis.utils.pluginMetadata(NAME,'repository')
- URL = url+'/raw/branch/main/plugins.xml'
+ #URL = url+'/raw/branch/main/plugins.xml'
+ URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
# print(URL)
version = qgis.utils.pluginMetadata(NAME,'version')
len_version = len(version)
- version_web = str(urllib.request.urlopen(URL).read())
- plugin_num = version_web.find(NAME)
- valeur_version_web = version_web.find('',plugin_num)+9
- version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
+ try:
+ urllib.request.urlopen('https://google.com')
+ binar = True
+ except:
+ binar = False
+ if binar:
+ version_web = str(urllib.request.urlopen(URL).read())
+ plugin_num = version_web.find(NAME)
+ valeur_version_web = version_web.find('',plugin_num)+9
+ version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
+ if version_plugin != version:
+ iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
+ else:
+ iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
- if version_plugin == version:
- iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
\ No newline at end of file
+def devlog(NAME):
+ import qgis
+ devmaj = ''
+ devmaj = devmaj+qgis.utils.pluginMetadata(NAME,'changelog')
+ return devmaj
\ No newline at end of file
diff --git a/CenRa_FLUX/tools/PythonSQL.py b/CenRa_FLUX/tools/PythonSQL.py
index 843c0e7..dcf20a2 100644
--- a/CenRa_FLUX/tools/PythonSQL.py
+++ b/CenRa_FLUX/tools/PythonSQL.py
@@ -31,7 +31,7 @@ else:
if os_user == 'STAGE':
os_user='stage'
if os_user == 'Administrateur':
- os_user = 'admin'
+ os_user = 'stage'
schemaname_distinct="""SELECT DISTINCT schemaname from pg_catalog.pg_tables
WHERE schemaname NOT LIKE '_archives' AND schemaname NOT LIKE 'topology' AND schemaname NOT LIKE 'information_schema' AND schemaname NOT LIKE 'pg_catalog' and schemaname NOT LIKE 'public' AND schemaname NOT LIKE '_trier'
diff --git a/CenRa_FLUX/tools/resources.py b/CenRa_FLUX/tools/resources.py
index c35f9ef..6292309 100644
--- a/CenRa_FLUX/tools/resources.py
+++ b/CenRa_FLUX/tools/resources.py
@@ -89,7 +89,7 @@ def resources_path(*args):
:return: Absolute path to the resources folder.
:rtype: str
"""
- path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\resources")))
+ path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\tools")))
for item in args:
path = abspath(join(path, item))
return path
@@ -108,7 +108,7 @@ def load_ui(*args):
return ui_class
def login_base(take=None):
- from CenRa_Metabase.resources.PythonSQL import host,port,dbname,password,os_user
+ from .tools.PythonSQL import host,port,dbname,password,os_user
first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
@@ -117,6 +117,7 @@ def login_base(take=None):
user = res_ident[1]
con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
+
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
first_conn.close()
@@ -138,24 +139,45 @@ def send_issues(url,titre,body,labels):
payload = {'title': titre, 'body': body, 'labels': labels}
-
- r = requests.post(url, data=json.dumps(payload), headers=headers)
- print(r.text)
+ try:
+ urllib.request.urlopen('https://google.com')
+ binar = True
+ except:
+ binar = False
+ r = ''
+ if binar:
+ r = requests.post(url, data=json.dumps(payload), headers=headers)
return r
def maj_verif(NAME):
import qgis
- import urllib
+ import urllib.request
+ iface = qgis.utils.iface
+ from qgis.core import Qgis
url = qgis.utils.pluginMetadata(NAME,'repository')
- URL = url+'/raw/branch/main/plugins.xml'
+ #URL = url+'/raw/branch/main/plugins.xml'
+ URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
# print(URL)
version = qgis.utils.pluginMetadata(NAME,'version')
len_version = len(version)
- version_web = str(urllib.request.urlopen(URL).read())
- plugin_num = version_web.find(NAME)
- valeur_version_web = version_web.find('',plugin_num)+9
- version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
+ try:
+ urllib.request.urlopen('https://google.com')
+ binar = True
+ except:
+ binar = False
+ if binar:
+ version_web = str(urllib.request.urlopen(URL).read())
+ plugin_num = version_web.find(NAME)
+ valeur_version_web = version_web.find('',plugin_num)+9
+ version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
+ if version_plugin != version:
+ iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
+ else:
+ iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
- if version_plugin == version:
- iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
\ No newline at end of file
+def devlog(NAME):
+ import qgis
+ devmaj = ''
+ devmaj = devmaj+qgis.utils.pluginMetadata(NAME,'changelog')
+ return devmaj
\ No newline at end of file
diff --git a/CenRa_Metabase/__init__.py b/CenRa_Metabase/__init__.py
index 8a70ef0..4eaf7d0 100644
--- a/CenRa_Metabase/__init__.py
+++ b/CenRa_Metabase/__init__.py
@@ -6,5 +6,5 @@ __email__ = "info@3liz.org"
# noinspection PyPep8Naming
def classFactory(iface): # pylint: disable=invalid-name
_ = iface
- from CenRa_Metabase.CenRa_Metabase import PgMetadata
+ from CenRa_METABASE.CenRa_Metabase import PgMetadata
return PgMetadata()
diff --git a/CenRa_Metabase/i18n/af.ts b/CenRa_Metabase/i18n/af.ts
deleted file mode 100644
index 615a88c..0000000
--- a/CenRa_Metabase/i18n/af.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
- @default
-
-
- Good morning
- Goeie more
-
-
-
diff --git a/CenRa_Metabase/icon.png b/CenRa_Metabase/icon.png
index 96a568e..d53a910 100644
Binary files a/CenRa_Metabase/icon.png and b/CenRa_Metabase/icon.png differ
diff --git a/CenRa_Metabase/issues.py b/CenRa_Metabase/issues.py
index 29a69f0..92a4176 100644
--- a/CenRa_Metabase/issues.py
+++ b/CenRa_Metabase/issues.py
@@ -32,9 +32,8 @@ from qgis.PyQt.QtWidgets import (
)
from qgis.utils import iface
-from CenRa_Metabase.resources.i18n import tr
-from CenRa_Metabase.resources.resources import (
+from .tools.resources import (
load_ui,
resources_path,
send_issues,
diff --git a/CenRa_Metabase/resources/PythonSQL.py b/CenRa_Metabase/resources/PythonSQL.py
deleted file mode 100644
index 0b556bd..0000000
--- a/CenRa_Metabase/resources/PythonSQL.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import sys
-import socket
-import os
-IPAddr=socket.gethostbyname(socket.gethostname())
-#print(IPAddr)
-if IPAddr[0:11] == "100.100.100": #4269
- host = "100.100.100.11"
- port = "5432"
- dbname = "sig4269"
- sigdb="sig4269"
- refdb="ref_geo4269"
- password = "McVities"
-if IPAddr[0:9] == "192.168.0": #01
- host = "192.168.0.201"
- port = "5432"
- dbname = "sig01"
- sigdb="sig01"
- refdb="ref_geo01"
- password = "McVities"
-if IPAddr[0:9] == "192.168.1": #0726
- host = "192.168.1.201"
- port = "5432"
- dbname = "sig0726"
- sigdb="sig0726"
- refdb="ref_geo0726"
- password = "McVities"
-if sys.platform == 'linux':
- os_user = os.environ['USER']
-else:
- os_user = os.environ['USERNAME']
-if os_user == 'STAGE':
- os_user='stage'
\ No newline at end of file
diff --git a/CenRa_Metabase/resources/css/dock.css b/CenRa_Metabase/resources/css/dock.css
deleted file mode 100644
index f05b850..0000000
--- a/CenRa_Metabase/resources/css/dock.css
+++ /dev/null
@@ -1,61 +0,0 @@
-body {
- font-family: Ubuntu, Lucida Grande, Segoe UI, Arial, sans-serif;
- margin-left: 0px;
- margin-right: 0px;
- margin-top: 0px;
- font-size: 14px;
-}
-img {
- max-width: 100%;
-}
-img.logo{
- display: inline-block;
- margin-left:0px;
- margin-right: 0px;
- margin-top: 10px;
- margin-bottom: 10px;
- vertical-align: top;
- width:25%
-}
-h2, h3 {
- color: #fff;
- background-color: #8cb63c;
- line-height: 2;
- padding-left:5px;
-}
-
-table {
- border-collapse: collapse;
- width: 100%;
- font-size: 13px;
-}
-th{
- color: #2c4491
-}
-table tr th, table tr td {
- text-align: left;
- padding: 5px;
-}
-
-table.table-striped {
- border: 1px solid #BBB;
-}
-table.table-striped tr td {
- border: 1px solid #BBB;
-}
-table.table-striped tr th {
- border: 1px solid #BBB;
-}
-table.table-striped tr:nth-child(even) {
- background: #EEE;
-}
-table.table-striped tr:nth-child(odd) {
- background: #FFF;
-}
-
-#map {
- padding: 5px;
- width: 400px;
- height: 400px;
- box-shadow: 0 0 10px #999;
-}
diff --git a/CenRa_Metabase/resources/i18n.py b/CenRa_Metabase/resources/i18n.py
deleted file mode 100644
index 64a21da..0000000
--- a/CenRa_Metabase/resources/i18n.py
+++ /dev/null
@@ -1,49 +0,0 @@
-"""I18n tools."""
-
-from os.path import join
-
-from qgis.PyQt.QtCore import QLocale, QFileInfo
-from qgis.PyQt.QtWidgets import QApplication
-from qgis.core import QgsSettings
-
-from .resources import resources_path
-
-__copyright__ = "Copyright 2019, 3Liz"
-__license__ = "GPL version 3"
-__email__ = "info@3liz.org"
-__revision__ = "$Format:%H$"
-
-
-def setup_translation(file_pattern="{}.qm", folder=None):
- """Find the translation file according to locale.
-
- :param file_pattern: Custom file pattern to use to find QM files.
- :type file_pattern: basestring
-
- :param folder: Optional folder to look in if it's not the default.
- :type folder: basestring
-
- :return: The locale and the file path to the QM file, or None.
- :rtype: (basestring, basestring)
- """
- locale = QgsSettings().value("locale/userLocale", QLocale().name())
-
- if folder:
- ts_file = QFileInfo(join(folder, file_pattern.format(locale)))
- else:
- ts_file = QFileInfo(resources_path("i18n", file_pattern.format(locale)))
- if ts_file.exists():
- return locale, ts_file.absoluteFilePath()
-
- if folder:
- ts_file = QFileInfo(join(folder, file_pattern.format(locale[0:2])))
- else:
- ts_file = QFileInfo(resources_path("i18n", file_pattern.format(locale[0:2])))
- if ts_file.exists():
- return locale, ts_file.absoluteFilePath()
-
- return locale, None
-
-
-def tr(text, context="@default"):
- return QApplication.translate(context, text)
diff --git a/CenRa_Metabase/resources/icons/CEN_RA.png b/CenRa_Metabase/resources/icons/CEN_RA.png
deleted file mode 100644
index 95ead1c..0000000
Binary files a/CenRa_Metabase/resources/icons/CEN_RA.png and /dev/null differ
diff --git a/CenRa_Metabase/resources/icons/icon.png b/CenRa_Metabase/resources/icons/icon.png
deleted file mode 100644
index 96a568e..0000000
Binary files a/CenRa_Metabase/resources/icons/icon.png and /dev/null differ
diff --git a/CenRa_Metabase/resources/icons/icon_2.png b/CenRa_Metabase/resources/icons/icon_2.png
deleted file mode 100644
index 5e21f30..0000000
Binary files a/CenRa_Metabase/resources/icons/icon_2.png and /dev/null differ
diff --git a/CenRa_Metabase/resources/lecture_sql.py b/CenRa_Metabase/resources/lecture_sql.py
deleted file mode 100644
index 06d7405..0000000
Binary files a/CenRa_Metabase/resources/lecture_sql.py and /dev/null differ
diff --git a/CenRa_Metabase/resources/resources.py b/CenRa_Metabase/resources/resources.py
deleted file mode 100644
index c35f9ef..0000000
--- a/CenRa_Metabase/resources/resources.py
+++ /dev/null
@@ -1,161 +0,0 @@
-"""Tools to work with resource files."""
-
-import configparser
-import shutil
-import tempfile
-import base64
-import psycopg2
-import psycopg2.extras
-from os.path import abspath, join, pardir, dirname
-
-from qgis.PyQt import uic
-
-__copyright__ = "Copyright 2019, 3Liz"
-__license__ = "GPL version 3"
-__email__ = "info@3liz.org"
-__revision__ = "$Format:%H$"
-
-
-def plugin_path(*args):
- """Get the path to plugin root folder.
-
- :param args List of path elements e.g. ['img', 'logos', 'image.png']
- :type args: str
-
- :return: Absolute path to the plugin path.
- :rtype: str
- """
- path = dirname(dirname(__file__))
- path = abspath(abspath(join(path, pardir)))
- for item in args:
- path = abspath(join(path, item))
-
- return path
-
-
-def plugin_name():
- """Return the plugin name according to metadata.txt.
-
- :return: The plugin name.
- :rtype: basestring
- """
- metadata = metadata_config()
- name = metadata["general"]["name"]
- return name
-
-
-def metadata_config() -> configparser:
- """Get the INI config parser for the metadata file.
-
- :return: The config parser object.
- :rtype: ConfigParser
- """
- path = plugin_path("metadata.txt")
- config = configparser.ConfigParser()
- config.read(path, encoding='utf8')
- return config
-
-
-def plugin_test_data_path(*args, copy=False):
- """Get the path to the plugin test data path.
-
- :param args List of path elements e.g. ['img', 'logos', 'image.png']
- :type args: str
-
- :param copy: If the file must be copied into a temporary directory first.
- :type copy: bool
-
- :return: Absolute path to the resources folder.
- :rtype: str
- """
- path = abspath(abspath(join(plugin_path(), "test", "data")))
- for item in args:
- path = abspath(join(path, item))
-
- if copy:
- temp = tempfile.mkdtemp()
- shutil.copy(path, temp)
- return join(temp, args[-1])
- else:
- return path
-
-
-def resources_path(*args):
- """Get the path to our resources folder.
-
- :param args List of path elements e.g. ['img', 'logos', 'image.png']
- :type args: str
-
- :return: Absolute path to the resources folder.
- :rtype: str
- """
- path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\resources")))
- for item in args:
- path = abspath(join(path, item))
- return path
-
-
-def load_ui(*args):
- """Get compile UI file.
-
- :param args List of path elements e.g. ['img', 'logos', 'image.png']
- :type args: str
-
- :return: Compiled UI file.
- """
- ui_class, _ = uic.loadUiType(resources_path("ui", *args))
-
- return ui_class
-
-def login_base(take=None):
- from CenRa_Metabase.resources.PythonSQL import host,port,dbname,password,os_user
- first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
- first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
- res_ident = first_cur.fetchone()
- mdp = base64.b64decode(str(res_ident[0])).decode('utf-8')
- user = res_ident[1]
-
- con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
- cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_conn.close()
-
- if take:
- return cur,con
- else:
- return cur
-def send_issues(url,titre,body,labels):
- import requests
- import json
- import os
- import qgis
-
- usr = os.environ['USERNAME']
- token = '9d0a4e0bea561710e0728f161f7edf4e5201e112'
- url=url+'?token='+token
-
- headers = {'Authorization': 'token ' + token,'accept': 'application/json','Content-Type': 'application/json'}
-
-
- payload = {'title': titre, 'body': body, 'labels': labels}
-
- r = requests.post(url, data=json.dumps(payload), headers=headers)
- print(r.text)
- return r
-
-def maj_verif(NAME):
- import qgis
- import urllib
-
- url = qgis.utils.pluginMetadata(NAME,'repository')
- URL = url+'/raw/branch/main/plugins.xml'
-# print(URL)
- version = qgis.utils.pluginMetadata(NAME,'version')
- len_version = len(version)
- version_web = str(urllib.request.urlopen(URL).read())
- plugin_num = version_web.find(NAME)
- valeur_version_web = version_web.find('',plugin_num)+9
- version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
-
- if version_plugin == version:
- iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
\ No newline at end of file
diff --git a/CenRa_Metabase/resources/ui/CenRa_IssuesSend.ui b/CenRa_Metabase/resources/ui/CenRa_IssuesSend.ui
deleted file mode 100644
index 2154351..0000000
--- a/CenRa_Metabase/resources/ui/CenRa_IssuesSend.ui
+++ /dev/null
@@ -1,332 +0,0 @@
-
-
- CenRa_IssuesSend
-
-
-
- 0
- 0
- 810
- 587
-
-
-
- CEN-RA Metabase
-
-
-
- icon.svgicon.svg
-
-
-
-
- 0
- 550
- 811
- 31
-
-
-
- -
-
-
- Annuler
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Envoyer
-
-
-
-
-
-
-
-
- 10
- 10
- 791
- 531
-
-
-
- Issues
-
-
-
-
- 240
- 40
- 321
- 41
-
-
-
- Qt::AlignCenter
-
-
-
-
-
- 10
- 101
- 571
- 421
-
-
-
-
-
-
- 589
- 100
- 191
- 431
-
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
-
- 9
- 9
- 341
- 411
-
-
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Bug
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Aide
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Question
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Amélioration
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Autre
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
-
-
-
-
- 250
- 20
- 51
- 21
-
-
-
-
- Arial
- 14
-
-
-
- Titre:
-
-
-
-
-
- 20
- 70
- 91
- 31
-
-
-
-
- Arial
- 12
-
-
-
- Messages:
-
-
-
-
-
- 600
- 70
- 91
- 31
-
-
-
-
- Arial
- 12
-
-
-
- Sujet:
-
-
-
-
-
- ok_button
- annuler_button
-
-
-
-
diff --git a/CenRa_Metabase/resources/ui/CenRa_Metabase_dockwidget_base.ui b/CenRa_Metabase/resources/ui/CenRa_Metabase_dockwidget_base.ui
deleted file mode 100644
index f7c76a7..0000000
--- a/CenRa_Metabase/resources/ui/CenRa_Metabase_dockwidget_base.ui
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
- CenRa_MetabaseDockWidgetBase
-
-
-
- 0
- 0
- 329
- 515
-
-
-
- CenRa MetaBase
-
-
-
- -
-
-
-
-
-
- ...
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- ...
-
-
- Qt::NoArrow
-
-
-
- -
-
-
- ...
-
-
-
- -
-
-
- help
-
-
-
-
-
- -
-
-
-
- about:blank
-
-
-
-
-
-
-
-
-
- QWebView
- QWidget
-
-
-
-
-
-
diff --git a/CenRa_Metabase/resources/ui/CenRa_Metabase_editorwidget_base.ui b/CenRa_Metabase/resources/ui/CenRa_Metabase_editorwidget_base.ui
deleted file mode 100644
index 3ab0455..0000000
--- a/CenRa_Metabase/resources/ui/CenRa_Metabase_editorwidget_base.ui
+++ /dev/null
@@ -1,1912 +0,0 @@
-
-
- CenRa_Metabase_editorwidget_base
-
-
-
- 0
- 0
- 818
- 741
-
-
-
- CEN-RA Metabase
-
-
-
- icon.svgicon.svg
-
-
-
-
- 0
- 0
- 821
- 711
-
-
-
-
- Myriad Pro Black
- 10
- 75
- false
- true
-
-
-
- Qt::DefaultContextMenu
-
-
- Qt::LeftToRight
-
-
- false
-
-
- QTabWidget::North
-
-
- QTabWidget::Rounded
-
-
- 0
-
-
-
- 40
- 40
-
-
-
- true
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
-
- Identification
-
-
-
-
- 30
- 110
- 751
- 99
-
-
-
- -
-
-
- Description
-
-
-
- -
-
-
-
-
-
-
-
- 30
- 220
- 751
- 101
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 20
- 20
-
-
-
-
- -
-
-
- Categories :
-
-
-
- -
-
-
- QAbstractItemView::NoEditTriggers
-
-
-
- -
-
-
- true
-
-
- QAbstractItemView::NoEditTriggers
-
-
- QAbstractItemView::SingleSelection
-
-
- QAbstractItemView::SelectItems
-
-
-
-
-
-
-
-
- 30
- 330
- 751
- 101
-
-
-
- -
-
-
- Thèmes :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 10
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- QAbstractItemView::NoEditTriggers
-
-
-
- -
-
-
- QAbstractItemView::NoEditTriggers
-
-
-
-
-
-
-
-
- 30
- 440
- 751
- 101
-
-
-
- -
-
-
- -
-
-
- Mots-clés :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
- 30
- 550
- 751
- 51
-
-
-
- -
-
-
- Dernier mise à jour :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- true
-
-
- QAbstractSpinBox::NoButtons
-
-
-
- 2024
- 12
- 26
-
-
-
- QDateTimeEdit::MonthSection
-
-
- dd/MM/yyyy
-
-
- true
-
-
- 1
-
-
- Qt::UTC
-
-
-
-
-
-
-
-
- 30
- 30
- 751
- 61
-
-
-
- -
-
-
- -
-
-
- Titre :
-
-
-
-
-
-
-
-
- 30
- 620
- 751
- 51
-
-
-
- -
-
-
- Langue :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
- Spatial properties
-
-
-
-
- 220
- 20
- 540
- 39
-
-
-
-
-
-
- 34
- 20
- 170
- 39
-
-
-
- Niveau :
-
-
-
-
-
- 34
- 70
- 170
- 39
-
-
-
- Echelle minimum :
-
-
-
-
-
- 220
- 70
- 540
- 39
-
-
-
-
-
-
- 34
- 120
- 170
- 39
-
-
-
- Echelle maximum :
-
-
-
-
-
- 220
- 120
- 540
- 39
-
-
-
-
-
-
- 34
- 170
- 170
- 39
-
-
-
- Nombre d'entités :
-
-
-
-
- false
-
-
-
- 220
- 170
- 540
- 39
-
-
-
-
-
-
- 34
- 220
- 170
- 39
-
-
-
- Type de géométrie :
-
-
-
-
- false
-
-
-
- 220
- 220
- 540
- 39
-
-
-
-
-
- false
-
-
-
- 220
- 320
- 540
- 39
-
-
-
-
-
-
- 34
- 270
- 170
- 39
-
-
-
- Nom de projection :
-
-
-
-
-
- 34
- 370
- 170
- 39
-
-
-
- Emprise :
-
-
-
-
-
- 34
- 320
- 170
- 39
-
-
-
- ID de projection :
-
-
-
-
- false
-
-
-
- 220
- 270
- 540
- 39
-
-
-
-
-
- false
-
-
-
- 221
- 370
- 540
- 39
-
-
-
-
-
-
- Publication
-
-
-
-
- 30
- 390
- 751
- 61
-
-
-
- -
-
-
- Restriction :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
- 30
- 210
- 751
- 61
-
-
-
- -
-
-
- Licence :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
- 30
- 30
- 751
- 61
-
-
-
- -
-
-
- Date :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- true
-
-
- QAbstractSpinBox::NoButtons
-
-
-
- 2024
- 12
- 24
-
-
-
- QDateTimeEdit::MonthSection
-
-
- dd/MM/yyyy
-
-
- true
-
-
- 1
-
-
- Qt::UTC
-
-
-
-
-
-
-
-
- 30
- 300
- 751
- 61
-
-
-
- -
-
-
- Licence attribué :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
- 30
- 120
- 751
- 61
-
-
-
- -
-
-
- Fréquence de mise à jour :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
- Lien
-
-
-
-
- 10
- 120
- 791
- 511
-
-
-
- -
-
-
- QAbstractItemView::NoEditTriggers
-
-
-
-
-
-
-
-
- 20
- 20
- 771
- 61
-
-
-
-
- 1
-
-
- 1
-
-
- 1
-
-
- 1
-
- -
-
-
- Taille :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- -
-
-
- Type :
-
-
-
- -
-
-
- -
-
-
- -
-
-
- URL :
-
-
-
- -
-
-
- Type MIME :
-
-
-
- -
-
-
- Format :
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Ajouter
-
-
-
- -
-
-
- -
-
-
-
-
-
-
-
- 10
- 640
- 791
- 31
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Delete
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
- 10
- 90
- 790
- 3
-
-
-
- Qt::Horizontal
-
-
-
-
-
- 10
- 20
- 790
- 3
-
-
-
- Qt::Horizontal
-
-
-
-
-
- 10
- 20
- 3
- 70
-
-
-
- Qt::Vertical
-
-
-
-
-
- 800
- 20
- 3
- 70
-
-
-
- Qt::Vertical
-
-
-
-
-
- Contacts
-
-
-
-
- 20
- 20
- 771
- 61
-
-
-
- -
-
-
- Nom :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- -
-
-
- Ajouter
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Email :
-
-
-
- -
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Organisation :
-
-
-
- -
-
-
- Telephone
-
-
-
- -
-
-
- Rôle :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
-
-
- 10
- 120
- 791
- 511
-
-
-
- -
-
-
- QAbstractItemView::NoEditTriggers
-
-
-
-
-
-
-
-
- 10
- 640
- 791
- 31
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Delete
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
- 800
- 20
- 3
- 70
-
-
-
- Qt::Vertical
-
-
-
-
-
- 10
- 20
- 790
- 3
-
-
-
- Qt::Horizontal
-
-
-
-
-
- 10
- 90
- 790
- 3
-
-
-
- Qt::Horizontal
-
-
-
-
-
- 10
- 20
- 3
- 70
-
-
-
- Qt::Vertical
-
-
-
-
-
- Metadata
-
-
-
-
- 30
- 30
- 751
- 61
-
-
-
- -
-
-
- Table :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- false
-
-
-
-
-
-
-
-
- 30
- 300
- 751
- 61
-
-
-
- -
-
-
- Date de modification :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- true
-
-
- QAbstractSpinBox::NoButtons
-
-
-
- 2024
- 12
- 25
-
-
-
- QDateTimeEdit::MonthSection
-
-
- dd/MM/yyyy
-
-
- true
-
-
- 1
-
-
- Qt::UTC
-
-
-
-
-
-
-
-
- 30
- 390
- 751
- 61
-
-
-
- -
-
-
- Encodage :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
-
-
-
-
- 30
- 210
- 751
- 61
-
-
-
- -
-
-
- Date de création :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- true
-
-
- QAbstractSpinBox::NoButtons
-
-
-
- 2024
- 12
- 25
-
-
-
- QDateTimeEdit::MonthSection
-
-
- dd/MM/yyyy
-
-
- true
-
-
- 1
-
-
- Qt::UTC
-
-
-
-
-
-
-
-
- 30
- 120
- 751
- 61
-
-
-
- -
-
-
- Schema :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- false
-
-
-
-
-
-
-
-
- 30
- 480
- 751
- 61
-
-
-
- -
-
-
- UUID :
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- false
-
-
-
-
-
-
-
-
-
-
- 0
- 710
- 821
- 31
-
-
-
- -
-
-
- Annuler
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- OK
-
-
-
-
-
-
-
-
- 780
- 20
- 25
- 19
-
-
-
- ...
-
-
-
- 32
- 32
-
-
-
- Qt::NoArrow
-
-
-
-
-
- 780
- 2
- 25
- 19
-
-
-
- ...
-
-
-
- 32
- 32
-
-
-
- Qt::NoArrow
-
-
-
-
- titre_line
- description_text
- ok_button
- annuler_button
- tabWidget
- langue_box
- niveau_plain
- echelle_min_plain
- echelle_max_plain
- nbr_layers
- typegeom_plaintext
- crscode_plaintext
- crsname_plaintext
- extend_plaintext
- restriction_box
- licence_box
- licence_attrib_box
- frequence_box
- table_lien
- add_lien_button
- format_box
- mime_box
- type_box
- delete_lien_button
- organisation_box
- add_contact_button
- role_box
- table_contact
- delete_contact_button
- table_ligne
- encodage_box
- schema_ligne
- uuid_ligne
- mots_cles_text
-
-
-
-
diff --git a/CenRa_Metabase/resources/xml/dcat.xml b/CenRa_Metabase/resources/xml/dcat.xml
deleted file mode 100644
index 852508d..0000000
--- a/CenRa_Metabase/resources/xml/dcat.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
- CEN-RA DCAT RDF catalog
- {language}
- CEN-RA Metadata
-
-
-
- {content}
-
-
-
-
-
-
diff --git a/CenRa_Metabase/resources/xml/distribution.xml b/CenRa_Metabase/resources/xml/distribution.xml
deleted file mode 100644
index 6aa24c5..0000000
--- a/CenRa_Metabase/resources/xml/distribution.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CenRa_Metabase/resources/xml/publisher.xml b/CenRa_Metabase/resources/xml/publisher.xml
deleted file mode 100644
index 3179d73..0000000
--- a/CenRa_Metabase/resources/xml/publisher.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CenRa_POSTGIS/README.md b/CenRa_POSTGIS/README.md
index 1837028..f22be1a 100644
--- a/CenRa_POSTGIS/README.md
+++ b/CenRa_POSTGIS/README.md
@@ -1 +1,34 @@
-# CenRa_POSTGIS
\ No newline at end of file
+Plugin Builder Results
+
+Your plugin CenRa was created in:
+ C:\Users\gcostes\.qgis2\python\plugins\CenRa
+
+Your QGIS plugin directory is located at:
+ C:/Users/gcostes/.qgis2/python/plugins
+
+What's Next:
+
+ * Copy the entire directory containing your new plugin to the QGIS plugin
+ directory
+
+ * Compile the ui file using pyuic4
+
+ * Compile the resources file using pyrcc4
+
+ * Test the plugin by enabling it in the QGIS plugin manager
+
+ * Customize it by editing the implementation file:
+ cenra.py
+
+ * Create your own custom icon, replacing the default icon.png
+
+ * Modify your user interface by opening cenra.ui
+ in Qt Designer (don't forget to compile it with pyuic4 after changing it)
+
+ * You can use the Makefile to compile your Ui and resource files when
+ you make changes. This requires GNU make (gmake)
+
+For more information, see the PyQGIS Developer Cookbook at:
+http://www.qgis.org/pyqgis-cookbook/index.html
+
+(C) 2011-2014 GeoApt LLC - geoapt.com
diff --git a/CenRa_POSTGIS/cenra.py b/CenRa_POSTGIS/cenra.py
index 9331a43..1576332 100644
--- a/CenRa_POSTGIS/cenra.py
+++ b/CenRa_POSTGIS/cenra.py
@@ -24,6 +24,7 @@ from __future__ import absolute_import
from builtins import next
from builtins import str
from builtins import object
+import qgis
from qgis.PyQt.QtCore import QSettings
from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog
from qgis.PyQt.QtGui import QIcon
@@ -31,6 +32,7 @@ from PyQt5.QtCore import *
from PyQt5.QtGui import *
from qgis.core import *
from qgis.core import QgsDataSourceUri
+from .forms.about_form import PostgisAboutDialog
# Initialize Qt resources from file resources.py
from . import resources_rc
# Import the code for the dialog
@@ -67,6 +69,15 @@ class CenRa(object):
self.dlg = CenRaDialog()
self.dlgAjout = table_postgisDialog()
maj_verif('CenRa_POSTGIS')
+
+ version = qgis.utils.pluginMetadata('CenRa_POSTGIS','version')
+ # Display About window on first use
+ s = QSettings()
+ versionUse = s.value("postgis/version", 1, type=str)
+ if str(versionUse) != str(version) :
+ s.setValue("postgis/version", str(version))
+ self.open_about_dialog()
+
def initGui(self):
self.toolBar = self.iface.addToolBar("CEN-RA")
self.toolBar.setObjectName("CEN-RA")
@@ -122,6 +133,10 @@ class CenRa(object):
self.cenra_ajout.triggered.connect(self.ajout)
self.cenra_help.triggered.connect(self.doHelp)
+ def open_about_dialog(self):
+ dialog = PostgisAboutDialog(self.iface)
+ dialog.exec_()
+
def unload(self):
# Remove the plugin menu item and icon
self.iface.removePluginMenu(u"&CENRA", self.action)
diff --git a/CenRa_POSTGIS/metadata.txt b/CenRa_POSTGIS/metadata.txt
index 6dd3d74..4cb2418 100644
--- a/CenRa_POSTGIS/metadata.txt
+++ b/CenRa_POSTGIS/metadata.txt
@@ -12,7 +12,7 @@
name=CenRa_POSTGIS
qgisMinimumVersion=3.0
description=Permet de crée un dossier dans la base PostGis
-version=1.6
+version=1.8
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=Traduction en Qgis v3.x
+changelog=CenRa_POSTGIS:
13/09/2024 - Version 1.8:
- Ajoute d'un changelog et vérification de mise à jour.
# tags are comma separated with spaces allowed
tags=cenra, postgis, database
diff --git a/CenRa_POSTGIS/resources.py b/CenRa_POSTGIS/resources.py
deleted file mode 100644
index c35f9ef..0000000
--- a/CenRa_POSTGIS/resources.py
+++ /dev/null
@@ -1,161 +0,0 @@
-"""Tools to work with resource files."""
-
-import configparser
-import shutil
-import tempfile
-import base64
-import psycopg2
-import psycopg2.extras
-from os.path import abspath, join, pardir, dirname
-
-from qgis.PyQt import uic
-
-__copyright__ = "Copyright 2019, 3Liz"
-__license__ = "GPL version 3"
-__email__ = "info@3liz.org"
-__revision__ = "$Format:%H$"
-
-
-def plugin_path(*args):
- """Get the path to plugin root folder.
-
- :param args List of path elements e.g. ['img', 'logos', 'image.png']
- :type args: str
-
- :return: Absolute path to the plugin path.
- :rtype: str
- """
- path = dirname(dirname(__file__))
- path = abspath(abspath(join(path, pardir)))
- for item in args:
- path = abspath(join(path, item))
-
- return path
-
-
-def plugin_name():
- """Return the plugin name according to metadata.txt.
-
- :return: The plugin name.
- :rtype: basestring
- """
- metadata = metadata_config()
- name = metadata["general"]["name"]
- return name
-
-
-def metadata_config() -> configparser:
- """Get the INI config parser for the metadata file.
-
- :return: The config parser object.
- :rtype: ConfigParser
- """
- path = plugin_path("metadata.txt")
- config = configparser.ConfigParser()
- config.read(path, encoding='utf8')
- return config
-
-
-def plugin_test_data_path(*args, copy=False):
- """Get the path to the plugin test data path.
-
- :param args List of path elements e.g. ['img', 'logos', 'image.png']
- :type args: str
-
- :param copy: If the file must be copied into a temporary directory first.
- :type copy: bool
-
- :return: Absolute path to the resources folder.
- :rtype: str
- """
- path = abspath(abspath(join(plugin_path(), "test", "data")))
- for item in args:
- path = abspath(join(path, item))
-
- if copy:
- temp = tempfile.mkdtemp()
- shutil.copy(path, temp)
- return join(temp, args[-1])
- else:
- return path
-
-
-def resources_path(*args):
- """Get the path to our resources folder.
-
- :param args List of path elements e.g. ['img', 'logos', 'image.png']
- :type args: str
-
- :return: Absolute path to the resources folder.
- :rtype: str
- """
- path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\resources")))
- for item in args:
- path = abspath(join(path, item))
- return path
-
-
-def load_ui(*args):
- """Get compile UI file.
-
- :param args List of path elements e.g. ['img', 'logos', 'image.png']
- :type args: str
-
- :return: Compiled UI file.
- """
- ui_class, _ = uic.loadUiType(resources_path("ui", *args))
-
- return ui_class
-
-def login_base(take=None):
- from CenRa_Metabase.resources.PythonSQL import host,port,dbname,password,os_user
- first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
- first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
- res_ident = first_cur.fetchone()
- mdp = base64.b64decode(str(res_ident[0])).decode('utf-8')
- user = res_ident[1]
-
- con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
- cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
- first_conn.close()
-
- if take:
- return cur,con
- else:
- return cur
-def send_issues(url,titre,body,labels):
- import requests
- import json
- import os
- import qgis
-
- usr = os.environ['USERNAME']
- token = '9d0a4e0bea561710e0728f161f7edf4e5201e112'
- url=url+'?token='+token
-
- headers = {'Authorization': 'token ' + token,'accept': 'application/json','Content-Type': 'application/json'}
-
-
- payload = {'title': titre, 'body': body, 'labels': labels}
-
- r = requests.post(url, data=json.dumps(payload), headers=headers)
- print(r.text)
- return r
-
-def maj_verif(NAME):
- import qgis
- import urllib
-
- url = qgis.utils.pluginMetadata(NAME,'repository')
- URL = url+'/raw/branch/main/plugins.xml'
-# print(URL)
- version = qgis.utils.pluginMetadata(NAME,'version')
- len_version = len(version)
- version_web = str(urllib.request.urlopen(URL).read())
- plugin_num = version_web.find(NAME)
- valeur_version_web = version_web.find('',plugin_num)+9
- version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
-
- if version_plugin == version:
- iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
\ No newline at end of file
diff --git a/CenRa_POSTGIS/tools/resources.py b/CenRa_POSTGIS/tools/resources.py
index 26eeef8..f862488 100644
--- a/CenRa_POSTGIS/tools/resources.py
+++ b/CenRa_POSTGIS/tools/resources.py
@@ -116,8 +116,8 @@ def login_base(take=None):
mdp = base64.b64decode(str(res_ident[0])).decode('utf-8')
user = res_ident[1]
- #con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
- con = psycopg2.connect("host=" + '100.100.100.81' + " port=" + port + " dbname="+'postgres'+" user=" + 'tlaveille' + " password=" + 'tlaveille')
+ con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=" + user + " password=" + mdp)
+
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
first_conn.close()
@@ -139,26 +139,45 @@ def send_issues(url,titre,body,labels):
payload = {'title': titre, 'body': body, 'labels': labels}
-
- r = requests.post(url, data=json.dumps(payload), headers=headers)
- print(r.text)
+ try:
+ urllib.request.urlopen('https://google.com')
+ binar = True
+ except:
+ binar = False
+ r = ''
+ if binar:
+ r = requests.post(url, data=json.dumps(payload), headers=headers)
return r
def maj_verif(NAME):
import qgis
- import urllib
- from qgis.utils import iface
+ import urllib.request
+ iface = qgis.utils.iface
from qgis.core import Qgis
url = qgis.utils.pluginMetadata(NAME,'repository')
- URL = url+'/raw/branch/main/plugins.xml'
+ #URL = url+'/raw/branch/main/plugins.xml'
+ URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
# print(URL)
version = qgis.utils.pluginMetadata(NAME,'version')
len_version = len(version)
- version_web = str(urllib.request.urlopen(URL).read())
- plugin_num = version_web.find(NAME)
- valeur_version_web = version_web.find('',plugin_num)+9
- version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
+ try:
+ urllib.request.urlopen('https://google.com')
+ binar = True
+ except:
+ binar = False
+ if binar:
+ version_web = str(urllib.request.urlopen(URL).read())
+ plugin_num = version_web.find(NAME)
+ valeur_version_web = version_web.find('',plugin_num)+9
+ version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
+ if version_plugin != version:
+ iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
+ else:
+ iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
- if version_plugin == version:
- qgis.utils.iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
\ No newline at end of file
+def devlog(NAME):
+ import qgis
+ devmaj = ''
+ devmaj = devmaj+qgis.utils.pluginMetadata(NAME,'changelog')
+ return devmaj
diff --git a/CenRa_SICEN/README.md b/CenRa_SICEN/README.md
index 10012ef..8e967b1 100644
--- a/CenRa_SICEN/README.md
+++ b/CenRa_SICEN/README.md
@@ -1 +1,34 @@
-# CenRa_SICEN
\ No newline at end of file
+Plugin Builder Results
+
+Your plugin SICEN was created in:
+ C:\Users\gcostes\.qgis2\python\plugins\SICEN
+
+Your QGIS plugin directory is located at:
+ C:/Users/gcostes/.qgis2/python/plugins
+
+What's Next:
+
+ * Copy the entire directory containing your new plugin to the QGIS plugin
+ directory
+
+ * Compile the ui file using pyuic4
+
+ * Compile the resources file using pyrcc4
+
+ * Test the plugin by enabling it in the QGIS plugin manager
+
+ * Customize it by editing the implementation file:
+ sicen.py
+
+ * Create your own custom icon, replacing the default icon.png
+
+ * Modify your user interface by opening sicen.ui
+ in Qt Designer (don't forget to compile it with pyuic4 after changing it)
+
+ * You can use the Makefile to compile your Ui and resource files when
+ you make changes. This requires GNU make (gmake)
+
+For more information, see the PyQGIS Developer Cookbook at:
+http://www.qgis.org/pyqgis-cookbook/index.html
+
+(C) 2011-2014 GeoApt LLC - geoapt.com
diff --git a/CenRa_SICEN/metadata.txt b/CenRa_SICEN/metadata.txt
index 68187c1..34377fa 100644
--- a/CenRa_SICEN/metadata.txt
+++ b/CenRa_SICEN/metadata.txt
@@ -12,7 +12,7 @@
name=CenRa SICEN
qgisMinimumVersion=3.0
description=Filtre des données saisies dans SICEN et export d'une liste d'espèces.
-version=1.4
+version=1.7
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=Traduction en Qgis v3.x
+changelog=CenRa_SICEN:
13/09/2024 - Version 1.7:
- Il est maintenant possible de sélectionné plusieurs entité pour le filtre par Emprise.- Ajoute d'un changelog.- Ajoute une vérification de mise à jour.
# tags are comma separated with spaces allowed
tags=cenra, postgis, sicen
diff --git a/CenRa_SICEN/sicen.py b/CenRa_SICEN/sicen.py
index 1a5a6b8..7d3ee4a 100644
--- a/CenRa_SICEN/sicen.py
+++ b/CenRa_SICEN/sicen.py
@@ -52,6 +52,8 @@ import qgis
import datetime
import csv
+from .forms.about_form import SicenAboutDialog
+
import psycopg2
import psycopg2.extras
import base64
@@ -59,6 +61,7 @@ import base64
import os
#import sys
+
class SICEN(object):
def __init__(self, iface):
@@ -81,6 +84,14 @@ class SICEN(object):
self.dlg = SICENDialog()
maj_verif('CenRa_SICEN')
+ version = qgis.utils.pluginMetadata('CenRa_SICEN','version')
+ # Display About window on first use
+ s = QSettings()
+ versionUse = s.value("sicen/version", 1, type=str)
+ if str(versionUse) != str(version) :
+ s.setValue("sicen/version", str(version))
+ self.open_about_dialog()
+
def initGui(self):
self.toolBar = self.iface.addToolBar("SICEN")
self.toolBar.setObjectName("SICEN")
@@ -123,6 +134,10 @@ class SICEN(object):
self.sicen_ouverture.triggered.connect(self.ouverture)
self.sicen_export.triggered.connect(self.export)
+ def open_about_dialog(self):
+ dialog = SicenAboutDialog(self.iface)
+ dialog.exec_()
+
def unload(self):
# Remove the plugin menu item and icon
self.iface.removePluginMenu(u"&SICEN", self.action)
@@ -561,13 +576,16 @@ class SICEN(object):
else :
selection = layer.selectedFeatures()
- if layer.selectedFeatureCount() == 1 :
+ if layer.selectedFeatureCount() >= 1 :
+ GEOM = ''
for feature in selection:
geom = feature.geometry()
- poly = geom.asWkt()
-
+ poly = "ST_GeomFromText('"+geom.asWkt()+"',2154),"
+ GEOM = GEOM + poly
+ poly = GEOM[0:-1]
+ #print(poly)
buffer = self.dlg.buffer.text()
- reqwhere_geom = " ST_intersects(geometrie,ST_Buffer(ST_geomFromText('" + poly + "',2154), " + buffer + " ))"
+ reqwhere_geom = " ST_intersects(geometrie,ST_Buffer(ST_Collect(array[" + poly + "]), " + buffer + " ))"
# Requete finale
reqwhere_final = '(' + reqwhere_obs + ')' + 'AND' + reqwhere_insee + 'AND' + reqwhere_ordre + 'AND' + reqwhere_sp + 'AND' + '(' + reqwhere_pat + ')' + 'AND' + reqwhere_regne + 'AND' + reqwhere_date + 'AND' + reqwhere_geom
@@ -596,6 +614,7 @@ class SICEN(object):
### Centroide
if reqwhere_final.find('()') != -1 :
reqwhere_final = ''
+ print(reqwhere_final)
uri.setDataSource("_agregation_ra", "observations_centroide", "geometrie", reqwhere_final, "gid")
layer = self.iface.addVectorLayer(uri.uri(), table_name + '_centroides', "postgres")
diff --git a/CenRa_SICEN/tools/resources.py b/CenRa_SICEN/tools/resources.py
index 90b8b31..7305a8c 100644
--- a/CenRa_SICEN/tools/resources.py
+++ b/CenRa_SICEN/tools/resources.py
@@ -89,7 +89,7 @@ def resources_path(*args):
:return: Absolute path to the resources folder.
:rtype: str
"""
- path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\resources")))
+ path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\tools")))
for item in args:
path = abspath(join(path, item))
return path
@@ -108,7 +108,7 @@ def load_ui(*args):
return ui_class
def login_base(take=None):
- from CenRa_Metabase.resources.PythonSQL import host,port,dbname,password,os_user
+ from .tools.PythonSQL import host,port,dbname,password,os_user
first_conn = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbname+" user=first_cnx password=" + password)
first_cur = first_conn.cursor(cursor_factory = psycopg2.extras.DictCursor)
first_cur.execute("SELECT mdp_w, login_w FROM pg_catalog.pg_user t1, admin_sig.vm_users_sig t2 WHERE t2.oid = t1.usesysid AND (login_w = '" + os_user + "' OR login_w = '" + os_user + "')")
@@ -139,26 +139,46 @@ def send_issues(url,titre,body,labels):
payload = {'title': titre, 'body': body, 'labels': labels}
-
- r = requests.post(url, data=json.dumps(payload), headers=headers)
- print(r.text)
+ try:
+ urllib.request.urlopen('https://google.com')
+ binar = True
+ except:
+ binar = False
+ r = ''
+ if binar:
+ r = requests.post(url, data=json.dumps(payload), headers=headers)
return r
def maj_verif(NAME):
import qgis
- import urllib
+ import urllib.request
iface = qgis.utils.iface
from qgis.core import Qgis
url = qgis.utils.pluginMetadata(NAME,'repository')
- URL = url+'/raw/branch/main/plugins.xml'
+ #URL = url+'/raw/branch/main/plugins.xml'
+ URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
# print(URL)
version = qgis.utils.pluginMetadata(NAME,'version')
len_version = len(version)
- version_web = str(urllib.request.urlopen(URL).read())
- plugin_num = version_web.find(NAME)
- valeur_version_web = version_web.find('',plugin_num)+9
- version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
+ try:
+ urllib.request.urlopen('https://google.com')
+ binar = True
+ except:
+ binar = False
+ if binar:
+ version_web = str(urllib.request.urlopen(URL).read())
+ plugin_num = version_web.find(NAME)
+ valeur_version_web = version_web.find('',plugin_num)+9
+ version_plugin = version_web[valeur_version_web:valeur_version_web+len_version]
+ if version_plugin != version:
+ iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
+ else:
+ iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
+ return version_plugin
- if version_plugin == version:
- qgis.utils.iface.messageBar().pushMessage("MAJ :", "Des mise à jour de plugin sont disponibles.", level=Qgis.Info, duration=30)
\ No newline at end of file
+def devlog(NAME):
+ import qgis
+ devmaj = ''
+ devmaj = devmaj+qgis.utils.pluginMetadata(NAME,'changelog')
+ return devmaj
\ No newline at end of file