Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4851339008 | ||
|
|
f2d11a64e4 | ||
|
|
4c52c85efb | ||
|
|
3ef37aa696 | ||
|
|
3b0758ea5c | ||
|
|
852301a537 | ||
|
|
b3451773be | ||
|
|
72a4a8a7b7 | ||
|
|
c809c12c9f | ||
|
|
bc538524fb | ||
|
|
23f21a4c39 | ||
|
|
2b00cf9106 | ||
|
|
ad49b80b5a | ||
|
|
dbe918cfcf | ||
|
|
f692414698 | ||
|
|
75ec1c0191 | ||
|
|
ca79b96958 | ||
|
|
ce85b09e11 | ||
|
|
8e84d39165 | ||
|
|
72e91a527a | ||
|
|
b3eeb2d60c | ||
|
|
ea6fb7c870 | ||
|
|
1aee5d90d7 | ||
|
|
901d1b9441 | ||
|
|
cd4d320614 | ||
|
|
c7ff62c717 | ||
|
|
49b78e58ac | ||
|
|
1a17bb7d7c | ||
|
|
e2e062ed12 | ||
|
|
a90a45a0b9 | ||
|
|
80a563357d | ||
|
|
be3a082f93 | ||
|
|
cbe6952c9a | ||
|
|
bbb41400e5 | ||
|
|
d92744fe6b | ||
|
|
a7d7ea83f4 | ||
|
|
622a54e7b9 | ||
|
|
55b0826248 | ||
|
|
3141ccb15c | ||
|
|
3301c1395d | ||
|
|
7c46818923 | ||
|
|
b05a047a87 | ||
|
|
65b24ff13d | ||
|
|
ec175643bc | ||
|
|
08dda9ebb0 | ||
|
|
1fbfb009cf | ||
|
|
1c6eaa82be | ||
|
|
50902b8664 | ||
|
|
3490c51112 | ||
|
|
f79642c826 | ||
|
|
f59fac229e | ||
|
|
a3cf4248cf | ||
|
|
94d4ff85ab | ||
|
|
947a6ddd18 | ||
|
|
cf4cfc4636 | ||
|
|
ea796cf346 | ||
|
|
a37e46cfc9 | ||
|
|
9129ad279b | ||
|
|
a02ab6376e | ||
|
|
69da8e8e82 | ||
|
|
161505e4a1 | ||
|
|
873a2a0ec7 | ||
|
|
df07e9ffdb | ||
|
|
36f1145d81 | ||
|
|
9519dee924 | ||
|
|
0e2e8a555d | ||
|
|
bff19fd919 | ||
|
|
ff71cdf577 | ||
|
|
a7c2f6c169 | ||
|
|
2377238e8c | ||
|
|
bd82fb6745 | ||
|
|
a08679f0fa | ||
|
|
66e0ddc496 | ||
|
|
99f059b649 | ||
|
|
87a1b82ee9 | ||
|
|
7c38bc1326 | ||
|
|
36e55f268c | ||
|
|
7dd203f520 | ||
|
|
7fceab83bb | ||
|
|
ef182560a6 | ||
|
|
1b7803a33f | ||
|
|
32a4f593a8 | ||
|
|
97c7702312 | ||
|
|
972e815f1e | ||
|
|
17d56dd4dc | ||
|
|
d25ce2b893 | ||
|
|
5570519e0d | ||
|
|
7a3f223024 | ||
|
|
5e71a891d0 | ||
|
|
0f6b4224c3 | ||
|
|
d2cc8e2802 | ||
|
|
c1b771cef6 | ||
|
|
1458982089 | ||
|
|
af7a63e728 | ||
|
|
89b5e326d1 | ||
|
|
94eaa2e272 | ||
|
|
e6d7917a35 | ||
|
|
da1309f415 | ||
|
|
e566ce6015 | ||
|
|
6169664ae4 | ||
|
|
654a8f579f |
@@ -16,4 +16,6 @@
|
||||
|
||||
#ReIgnore
|
||||
**/__pycache__
|
||||
**/test/
|
||||
**/test/
|
||||
PythonSQL.py
|
||||
StyleLayer.py
|
||||
@@ -27,17 +27,24 @@ import os
|
||||
from .tools.resources import (
|
||||
plugin_path,
|
||||
resources_path,
|
||||
pyperclip,
|
||||
maj_verif,
|
||||
)
|
||||
from .canvas_editor import AutoMap_Editor
|
||||
from .about_form import AutoMapAboutDialog
|
||||
pyperclip()
|
||||
|
||||
from .canvas_editor import AutoMap_Editor
|
||||
from .style_invoke import AutoMap_Style
|
||||
from .about_form import AboutDialog
|
||||
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
|
||||
class PgAutoMap:
|
||||
def __init__(self):
|
||||
""" Constructor. """
|
||||
self.canvas_editor = None
|
||||
self.style_dock = None
|
||||
# self.issues = None
|
||||
self.provider = None
|
||||
self.locator_filter = None
|
||||
@@ -73,10 +80,16 @@ class PgAutoMap:
|
||||
if not self.canvas_editor:
|
||||
self.canvas_editor = AutoMap_Editor()
|
||||
|
||||
|
||||
self.automap_action = QAction(icon, 'CenRa_AutoMap',None)
|
||||
self.toolBar.addAction(self.automap_action)
|
||||
self.automap_action.triggered.connect(self.open_editor)
|
||||
|
||||
if not self.style_dock:
|
||||
self.style_dock = AutoMap_Style()
|
||||
|
||||
if os.environ['USERNAME'] == 'tlaveille' or os.environ['USERNAME'] == 'lpoulin' or os.environ['USERNAME'] == 'rclement':
|
||||
iface.addDockWidget(Qt.DockWidgetArea(0x1), self.style_dock)
|
||||
|
||||
'''
|
||||
if not self.locator_filter:
|
||||
self.locator_filter = LocatorFilter(iface)
|
||||
@@ -114,8 +127,8 @@ class PgAutoMap:
|
||||
"""
|
||||
About dialog
|
||||
"""
|
||||
dialog = AutoMapAboutDialog(iface)
|
||||
dialog.exec_()
|
||||
dialog = AboutDialog(iface)
|
||||
dialog.exec()
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
@@ -2,3 +2,5 @@
|
||||
---
|
||||
Outil de création de mise en page,
|
||||
Permet de préprogramé des mise en page pour les mêtre à disposition des collégue.
|
||||
|
||||
> [Point de départ de création du plugin](https://github.com/CEN-Nouvelle-Aquitaine/MapCEN)
|
||||
@@ -12,12 +12,12 @@ ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
os.path.join(
|
||||
str(Path(__file__).resolve().parent),
|
||||
'tools/ui',
|
||||
'CenRa_AutoMap_about_form.ui'
|
||||
'CenRa_about_form.ui'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class AutoMapAboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
class AboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
import os
|
||||
from PyQt5.QtCore import QSettings
|
||||
|
||||
from collections import namedtuple
|
||||
from enum import Enum
|
||||
from functools import partial
|
||||
@@ -44,10 +44,12 @@ from qgis.core import (
|
||||
from qgis.PyQt.QtCore import QLocale, QUrl, QDateTime, Qt
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon, QColor, QFont, QMovie
|
||||
from qgis.PyQt.QtPrintSupport import QPrinter
|
||||
from qgis.PyQt.QtWebKitWidgets import QWebPage
|
||||
#from qgis.PyQt.QtWebKitWidgets import QWebPage
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
QDialog,
|
||||
QAction,
|
||||
QMessageBox,
|
||||
QPushButton,
|
||||
QDockWidget,
|
||||
QFileDialog,
|
||||
QInputDialog,
|
||||
@@ -57,22 +59,22 @@ from qgis.PyQt.QtWidgets import (
|
||||
QTableWidgetItem,
|
||||
QVBoxLayout,
|
||||
)
|
||||
from PyQt5 import QtGui
|
||||
|
||||
from qgis.PyQt.QtCore import QSettings
|
||||
from qgis.PyQt import QtGui
|
||||
from qgis.PyQt import QtWidgets
|
||||
|
||||
|
||||
from qgis.PyQt.QtXml import QDomDocument
|
||||
from qgis.utils import iface
|
||||
import glob
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
login_base,
|
||||
send_issues,
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
from .tools.mises_en_pages import carto_standard
|
||||
from .tools.mises_en_pages import full_page
|
||||
from .tools.mises_en_pages import demo
|
||||
|
||||
from datetime import date
|
||||
|
||||
EDITOR_CLASS = load_ui('CenRa_AutoMap_base.ui')
|
||||
@@ -123,8 +125,9 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
for i in plugin_dir[1:]:
|
||||
ix = ix+1
|
||||
path = path+'/'+i
|
||||
self.tabWidget.setStyleSheet('background-image: url('+path+'/tools/bg/Capture.png);')
|
||||
#self.tabWidget.setStyleSheet('background-image: url('+path+'/tools/bg/Capture.png);')
|
||||
|
||||
self.verticalScrollBar.hide()
|
||||
self.commandLinkButton.clicked.connect(self.chargement_qpt)
|
||||
self.radioButton_9.clicked.connect(self.statu_atlas)
|
||||
self.radioButton_10.clicked.connect(self.statu_source)
|
||||
@@ -135,6 +138,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.commandLinkButton_2.clicked.connect(self.load_ortho)
|
||||
self.commandLinkButton_3.clicked.connect(self.load_osm)
|
||||
self.CustomeLogo.clicked.connect(self.deflogoteck)
|
||||
self.verticalScrollBar.valueChanged.connect(self.moveFrame)
|
||||
|
||||
## On ajoute le nom des templates à la liste déroulante de l'onglet "mises en page" :
|
||||
mises_en_page = []
|
||||
@@ -194,6 +198,14 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.hide_source()
|
||||
self.hide_atlas()
|
||||
|
||||
def wheelEvent(self,event):
|
||||
if (event.angleDelta().y() >= 1):
|
||||
vsb = self.verticalScrollBar.value()+20
|
||||
else:
|
||||
vsb = self.verticalScrollBar.value()-20
|
||||
self.verticalScrollBar.setValue(vsb)
|
||||
def moveFrame(self):
|
||||
self.frame.move(self.frame.x(),self.verticalScrollBar.value())
|
||||
def update_logo_library(self):
|
||||
self.mComboBox_4.clear()
|
||||
logo_library = []
|
||||
@@ -325,6 +337,8 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.comboBox_6.clear()
|
||||
self.comboBox_7.clear()
|
||||
|
||||
if (self.s.value("automap/prenom_nom", "1", type=str) != "1"):
|
||||
self.lineEdit_5.setText(self.s.value("automap/prenom_nom", 1, type=str))
|
||||
couches = []
|
||||
couche_vecteur = ['']
|
||||
mapThemes = ['']
|
||||
@@ -438,7 +452,18 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
doc = QDomDocument()
|
||||
doc.setContent(template_content)
|
||||
self.layout.loadFromTemplate(doc, QgsReadWriteContext(), True)
|
||||
self.layout.setName(layout_name)
|
||||
|
||||
try:
|
||||
cutLayout = layout_name.index("¶")
|
||||
except:
|
||||
cutLayout = 0
|
||||
|
||||
if cutLayout >= 1:
|
||||
self.layout.setName(layout_name)
|
||||
titre_layout_name=layout_name[:cutLayout]
|
||||
else:
|
||||
self.layout.setName(layout_name)
|
||||
titre_layout_name = layout_name
|
||||
|
||||
if self.radioButton_6.isChecked() and self.radioButton_7.isChecked():
|
||||
logo_div = A4_size['Portrait']['RIGHT']
|
||||
@@ -480,11 +505,12 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.position_map.setItemRotation(self.template_parameters['Carte_2_rotate'])
|
||||
self.position_map.attemptResize(self.template_parameters['Carte_2_size'])
|
||||
self.position_map.attemptMove(self.template_parameters['Carte_2_locals'])
|
||||
overviewitem = QgsLayoutItemMapOverviewStack(self.position_map)
|
||||
map_overview = self.position_map.overview()
|
||||
map_overview.setLinkedMap(self.map_modele_test)
|
||||
map_overview.setCentered(True)
|
||||
overviewitem.addOverview(map_overview)
|
||||
self.position_map.overview().setLinkedMap(self.map_modele_test)
|
||||
#overviewitem = QgsLayoutItemMapOverviewStack(self.position_map)
|
||||
#map_overview = self.position_map.overview()
|
||||
#map_overview.setLinkedMap(self.map_modele_test)
|
||||
#map_overview.setCentered(True)
|
||||
#overviewitem.addOverview(map_overview)
|
||||
|
||||
self.position_map.refresh()
|
||||
self.map_modele_test.setFrameEnabled(True)
|
||||
@@ -502,9 +528,9 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
## Ajout d'un titre à la mise en page
|
||||
title = QgsLayoutItemLabel(self.layout)
|
||||
self.layout.addLayoutItem(title)
|
||||
titre = layout_name
|
||||
titre = titre_layout_name
|
||||
title.setText(titre)
|
||||
title.setFont(QFont("Calibri", 15, QFont.Bold))
|
||||
title.setFont(QFont("Calibri", 15, False))
|
||||
title.setItemRotation(self.template_parameters['Titre_rotate'])
|
||||
title.attemptResize(self.template_parameters['Titre_size'])
|
||||
title.attemptMove(self.template_parameters['Titre_locals'])
|
||||
@@ -513,8 +539,8 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
title.setBackgroundColor(QColor(255, 255, 255, 130))
|
||||
self.layout.addItem(title)
|
||||
# title.adjustSizeToText() on n'utilise plutot setFixedSize pour pouvoir centrer le titre de manière plus optimale ici
|
||||
title.setHAlign(Qt.AlignHCenter)
|
||||
title.setVAlign(Qt.AlignVCenter)
|
||||
title.setHAlign(Qt.AlignmentFlag(0x0004))
|
||||
title.setVAlign(Qt.AlignmentFlag(0x0080))
|
||||
|
||||
|
||||
## Ajout d'un sous titre à la mise en page
|
||||
@@ -524,7 +550,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
if self.radioButton_9.isChecked() == 1:
|
||||
titre = titre + ' [%' + self.comboBox_4.currentText() + '%]'
|
||||
subtitle.setText(titre)
|
||||
subtitle.setFont(QFont("MS Shell Dlg 2", 10))
|
||||
subtitle.setFont(QFont("Calibri", 10))
|
||||
subtitle.setItemRotation(self.template_parameters['Sous_titre_rotate'])
|
||||
subtitle.attemptResize(self.template_parameters['Sous_titre_size'])
|
||||
subtitle.attemptMove(self.template_parameters['Sous_titre_locals'])
|
||||
@@ -532,8 +558,8 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
subtitle.setBackgroundEnabled(True)
|
||||
subtitle.setBackgroundColor(QColor(255, 255, 255, 130))
|
||||
self.layout.addItem(subtitle)
|
||||
subtitle.setHAlign(Qt.AlignHCenter)
|
||||
subtitle.setVAlign(Qt.AlignVCenter)
|
||||
subtitle.setHAlign(Qt.AlignmentFlag(0x0004))
|
||||
subtitle.setVAlign(Qt.AlignmentFlag(0x0080))
|
||||
|
||||
|
||||
## Ajout du logo CEN NA en haut à gauche de la page
|
||||
@@ -593,7 +619,8 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
layertreelayer = root.findLayer(layer.id())
|
||||
|
||||
# get the parent of the layer tree layer (layer tree root, or group)
|
||||
parent = layertreelayer.parent()
|
||||
if layertreelayer != None:
|
||||
parent = layertreelayer.parent()
|
||||
|
||||
# if the parent is a group and has a name, find it and remove the layer
|
||||
if isinstance(parent, QgsLayerTreeGroup) and parent.name():
|
||||
@@ -630,6 +657,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.scalebarnumeric_qpt.setNumberOfSegments(2)
|
||||
self.scalebarnumeric_qpt.setNumberOfSegmentsLeft(0)
|
||||
|
||||
self.scalebarnumeric_qpt.setFont(QFont("Calibri", 12))
|
||||
self.scalebarnumeric_qpt.attemptMove(self.template_parameters['Echelle_locals'])
|
||||
self.scalebarnumeric_qpt.attemptResize(self.template_parameters['Echelle_size'])
|
||||
self.scalebarnumeric_qpt.setItemRotation(self.template_parameters['Echelle_rotate'])
|
||||
@@ -649,6 +677,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.scalebar_qpt.setNumberOfSegments(2)
|
||||
self.scalebar_qpt.setNumberOfSegmentsLeft(0)
|
||||
|
||||
self.scalebar_qpt.setFont(QFont("Calibri", 12))
|
||||
self.scalebar_qpt.attemptMove(self.template_parameters['Echelle_2_locals'])
|
||||
self.scalebar_qpt.attemptResize(self.template_parameters['Echelle_2_size'])
|
||||
self.scalebar_qpt.setItemRotation(self.template_parameters['Echelle_2_rotate'])
|
||||
@@ -666,30 +695,44 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
north.attemptMove(self.template_parameters['Arrow_locals'])
|
||||
north.attemptResize(self.template_parameters['Arrow_size'])
|
||||
north.setItemRotation(self.template_parameters['Arrow_rotate'])
|
||||
north.setBackgroundEnabled(True)
|
||||
north.setBackgroundColor(QColor(255, 255, 255, 130))
|
||||
|
||||
if self.radioButton_10.isChecked() == 1:
|
||||
info_text = ["Source : " + self.mComboBox_3.currentText()][0]
|
||||
text_source = ' '
|
||||
for Item_mComboBox_3 in self.mComboBox_3.checkedItems():
|
||||
text_source = text_source+Item_mComboBox_3+','
|
||||
text_source = text_source[:-1]
|
||||
info_text = ["Source :" + text_source][0]
|
||||
else:
|
||||
info_text = ["Source : " + self.lineEdit_4.text()][0]
|
||||
# ajout note info:
|
||||
info = ["Réalisation : " + "CEN Rhône-Alpes (" + date.today().strftime(
|
||||
"%d/%m/%Y") + ")"]
|
||||
if self.radioButton_14.isChecked() == 1:
|
||||
self.s.setValue("automap/prenom_nom",self.lineEdit_5.text())
|
||||
prenom_nom = self.s.value("automap/prenom_nom", 1, type=str)
|
||||
info = ["Réalisation : " + "CEN Rhône-Alpes (" + date.today().strftime("%d/%m/%Y") + ") par "+prenom_nom]
|
||||
else:
|
||||
info = ["Réalisation : " + "CEN Rhône-Alpes (" + date.today().strftime("%d/%m/%Y") + ")"]
|
||||
credit_text = QgsLayoutItemLabel(self.layout)
|
||||
credit_text.setText(info[0])
|
||||
credit_text.setFont(QFont("Calibri", 9))
|
||||
credit_text.setHAlign(Qt.AlignRight)
|
||||
credit_text.setVAlign(Qt.AlignVCenter)
|
||||
credit_text.setHAlign(Qt.AlignmentFlag(0x0002))
|
||||
credit_text.setVAlign(Qt.AlignmentFlag(0x0080))
|
||||
credit_text.setBackgroundEnabled(True)
|
||||
credit_text.setBackgroundColor(QColor(255, 255, 255, 130))
|
||||
credit_text2 = QgsLayoutItemLabel(self.layout)
|
||||
credit_text2.setText(info_text)
|
||||
credit_text2.setFont(QFont("Calibri", 9))
|
||||
credit_text2.setHAlign(Qt.AlignRight)
|
||||
credit_text2.setVAlign(Qt.AlignVCenter)
|
||||
credit_text2.setHAlign(Qt.AlignmentFlag(0x0002))
|
||||
credit_text2.setVAlign(Qt.AlignmentFlag(0x0080))
|
||||
credit_text.setItemRotation(self.template_parameters['Credit_rotate'])
|
||||
credit_text.attemptResize(self.template_parameters['Credit_size'])
|
||||
credit_text.attemptMove(self.template_parameters['Credit_locals'])
|
||||
credit_text2.setItemRotation(self.template_parameters['Source_rotate'])
|
||||
credit_text2.attemptResize(self.template_parameters['Source_size'])
|
||||
credit_text2.attemptMove(self.template_parameters['Source_locals'])
|
||||
credit_text2.setBackgroundEnabled(True)
|
||||
credit_text2.setBackgroundColor(QColor(255, 255, 255, 130))
|
||||
self.layout.addLayoutItem(credit_text)
|
||||
self.layout.addLayoutItem(credit_text2)
|
||||
|
||||
@@ -701,7 +744,8 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
logo_credit.setMode(QgsLayoutItemPicture.FormatRaster)
|
||||
cur_x = self.template_parameters['Logo_2_locals'].x()
|
||||
logo_credit.attemptMove(self.template_parameters['Logo_2_locals'])
|
||||
logo_credit.setPictureAnchor(4)
|
||||
print(logo_credit.pictureAnchor())
|
||||
#logo_credit.setPictureAnchor(4)
|
||||
self.template_parameters['Logo_2_locals'].setX(cur_x+(logo_div/len_item))
|
||||
logo_credit.setFixedSize(self.template_parameters['Logo_2_size'])
|
||||
if logo_run[0] == ' ':
|
||||
@@ -719,10 +763,34 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
existing_layout = project.layoutManager().layoutByName(self.layout.name())
|
||||
if existing_layout:
|
||||
if self.radioButton_12.isChecked() != 1:
|
||||
project.layoutManager().removeLayout(existing_layout)
|
||||
self.QMBquestion = QMessageBox()
|
||||
self.QMBquestion.setWindowTitle(u"Attention !")
|
||||
self.QMBquestion.setIcon(QMessageBox.Icon.Warning)
|
||||
self.QMBquestion.setText("Mise en page existante, la mise en page va être écrasée !")
|
||||
self.QMBquestion.setStandardButtons(QMessageBox.StandardButton(0x00004000)|QMessageBox.StandardButton(0x00010000))
|
||||
self.QMBquestion.addButton(QPushButton('Autre mise en page'),QMessageBox.ButtonRole(0))
|
||||
self.QMBquestion = self.QMBquestion.exec()
|
||||
|
||||
result = project.layoutManager().addLayout(self.layout)
|
||||
#if self.radioButton_12.isChecked() != 1:
|
||||
if self.QMBquestion == QMessageBox.StandardButton(0x00004000):
|
||||
project.layoutManager().removeLayout(existing_layout)
|
||||
result = project.layoutManager().addLayout(self.layout)
|
||||
elif self.QMBquestion != QMessageBox.StandardButton(0x00010000):
|
||||
LayoutCOUNT=0
|
||||
arrayManager = []
|
||||
for AddArrayManager in project.layoutManager().layouts():
|
||||
arrayManager.append(AddArrayManager.name())
|
||||
arrayManager.sort()
|
||||
for LayoutNAME in arrayManager:
|
||||
if LayoutNAME == layout_name:
|
||||
LayoutCOUNT = LayoutCOUNT+1
|
||||
if LayoutNAME == layout_name+"¶"+str(LayoutCOUNT):
|
||||
LayoutCOUNT=LayoutCOUNT+1
|
||||
layout_name = (layout_name+"¶"+str(LayoutCOUNT))
|
||||
self.layout.setName(layout_name)
|
||||
|
||||
else:
|
||||
existing_layout = True
|
||||
|
||||
|
||||
|
||||
@@ -735,8 +803,22 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
fichier_mise_en_page = layout_name
|
||||
layout_modifie = QgsProject.instance().layoutManager().layoutByName(fichier_mise_en_page)
|
||||
iface.openLayoutDesigner(layout_modifie)
|
||||
self.close()
|
||||
try:
|
||||
if (self.QMBquestion == QMessageBox.AcceptRole):
|
||||
TryMessage = (self.QMBquestion == QMessageBox.AcceptRole)
|
||||
elif (self.QMBquestion == QMessageBox.Yes):
|
||||
TryMessage = (self.QMBquestion == QMessageBox.Yes)
|
||||
else:
|
||||
TryMessage = False
|
||||
del self.QMBquestion
|
||||
except:
|
||||
TryMessage = True
|
||||
|
||||
if TryMessage == True:
|
||||
iface.openLayoutDesigner(layout_modifie)
|
||||
self.close()
|
||||
else:
|
||||
self.activateWindow()
|
||||
|
||||
def actualisation_mise_en_page(self):
|
||||
values_page = self.comboBox.currentText()
|
||||
@@ -757,12 +839,9 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
pc = self.layout.pageCollection()
|
||||
pc.pages()[0].setPageSize('A3', QgsLayoutItemPage.Landscape)
|
||||
|
||||
if values_page == "demo.py":
|
||||
self.template_parameters = demo.fletch_canvas(self)
|
||||
if values_page == "carto_standard.py":
|
||||
self.template_parameters = carto_standard.fletch_canvas(self)
|
||||
if values_page == "full_page.py":
|
||||
self.template_parameters = full_page.fletch_canvas(self)
|
||||
values_page_import = values_page[:-3]
|
||||
eval("exec('from .tools.mises_en_pages import '+values_page_import)")
|
||||
eval("exec('self.template_parameters = '+ values_page_import + '.fletch_canvas(self)')")
|
||||
|
||||
def bar_echelle_auto(self, echelle, bar_echelle):
|
||||
|
||||
@@ -771,7 +850,6 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
bar_echelle.setUnits(QgsUnitTypes.DistanceKilometers)
|
||||
bar_echelle.setUnitLabel("km")
|
||||
bar_echelle.setUnitsPerSegment(round((echelle.scale()*0.04)/1000))
|
||||
|
||||
else:
|
||||
bar_echelle.setUnits(QgsUnitTypes.DistanceMeters)
|
||||
bar_echelle.setUnitLabel("m")
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
[general]
|
||||
name=CenRa_AutoMap
|
||||
qgisMinimumVersion=3.0
|
||||
supportsQt6=True
|
||||
description=CenRa_AutoMap
|
||||
version=1.7
|
||||
version=2.0
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
@@ -21,7 +22,7 @@ tracker=https://gitea.cenra-outils.org/api/v1/repos/CEN-RA/Plugin_QGIS/issues
|
||||
|
||||
hasProcessingProvider=no
|
||||
# Uncomment the following line and add your changelog:
|
||||
changelog=<h2>CenRa_AutoMap:</h2></br><p><h3>21/10/2024 - Version 1.7: </h3> - Epurations du code.</p></br><p><h3>07/10/2024 - Version 1.6: </h3> - Option de bibliotheque de logo custome.</p></br><p><h3>03/10/2024 - Version 1.5: </h3> - Remonte la fênetre dans la pille.</br> - Gestion du nombre de colonne dans la légend.</br></p></br><p><h3>02/10/2024 - Version 1.4: </h3> - Mise en page plein écrant.</br></p></br><p><h3>01/10/2024 - Version 1.3: </h3> - Récupération du titre et sous-titre pour mise en page existente.</br> - Integration de bibliotheque de logo.</br> - Integration de gestionaire pour les source de donnée.</br> - Mise en place d'une bar d'echelle adaptative. </br></p></br><p><h3>30/09/2024 - Version 1.2: </h3> - Activation du thème. </br> - Ajouter une carte de suivie. </br><p></br><h3>27/09/2024 - Version 1.1: </h3> - Ajout d'une liste déroulante pour les sources de données. </br>- Bouton pour ajouter des fonts de carte customisés. </br>- Fonctionnalité de génération d'atlas. </p></br><p><h3>26/09/2024 - Version 1.0: </h3> - Lancement du plugin CenRa_AutoMap avec une seul mise en page. </p></br>
|
||||
changelog=<h2>CenRa_AUTOMAP:</h2></br><p><h3>19/05/2025 - Version 2.0: </h3> Compatible PyQt5 et PyQt6</p></br><p><h3>11/04/2025 - Version 1.7: </h3> - Correctif d'orthographe.</p></br><p><h3>09/04/2025 - Version 1.6: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 1.5: </h3> - Optimisation pour le TT.</p></br><p><h3>03/04/2025 - Version 1.4: </h3> - Mise a jour de securite.</p></br><p><h3>20/03/2025 - Version 1.3: </h3> - Fenêtre redimensionnable avec déplaçable avec la mollette sourit.</p></br><p><h3>25/02/2025 - Version 1.2: </h3> - DockWidget pour ouverture de couche avec theme.</p></br><p><h3>28/01/2025 - Version 1.1: </h3> - Multi-Composeur pris en charge.</p></br><p><h3>27/01/2025 - Version 1.0: </h3> - Version releases.</br> - Ajoute un message d'avertissement au moment d'écraser la mise en page.</br> - Ajoute prénom et nom dans la réalisation.</br> - Utilisation de Calibri.</p></br><p><h3>13/01/2025 - Version 0.1.10: </h3> - Correctif.</p></br><p><h3>07/01/2025 - Version 0.1.9: </h3> - ByPass du certif ssl ci erreur.</p></br><p><h3>19/12/2024 - Version 0.1.8: </h3> - Nouvelle mise en page.</br> - Incrémentation automatique de nouveau modele de mise en page. </br> - Correctif de bug.</p></br><p><h3>21/10/2024 - Version 0.1.7: </h3> - Epurations du code.</p></br><p><h3>07/10/2024 - Version 0.1.6: </h3> - Option de bibliotheque de logo custome.</p></br><p><h3>03/10/2024 - Version 0.1.5: </h3> - Remonte la fênetre dans la pille.</br> - Gestion du nombre de colonne dans la légend.</br></p></br><p><h3>02/10/2024 - Version 0.1.4: </h3> - Mise en page plein écrant.</br></p></br><p><h3>01/10/2024 - Version 0.1.3: </h3> - Récupération du titre et sous-titre pour mise en page existente.</br> - Integration de bibliotheque de logo.</br> - Integration de gestionaire pour les source de donnée.</br> - Mise en place d'une bar d'echelle adaptative. </br></p></br><p><h3>30/09/2024 - Version 0.1.2: </h3> - Activation du thème. </br> - Ajouter une carte de suivie. </br><p></br><h3>27/09/2024 - Version 0.1.1: </h3> - Ajout d'une liste déroulante pour les sources de données. </br>- Bouton pour ajouter des fonts de carte customisés. </br>- Fonctionnalité de génération d'atlas. </p></br><p><h3>26/09/2024 - Version 0.1.0: </h3> - Lancement du plugin CenRa_AutoMap avec une seul mise en page. </p></br>
|
||||
|
||||
# Tags are comma separated with spaces allowed
|
||||
tags=python
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
import logging
|
||||
import os
|
||||
from collections import namedtuple
|
||||
from enum import Enum
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from xml.dom.minidom import parseString
|
||||
from qgis.gui import *
|
||||
import qgis
|
||||
from importlib import import_module
|
||||
from qgis.core import (
|
||||
NULL,
|
||||
QgsApplication,
|
||||
QgsScaleBarSettings,
|
||||
QgsDataSourceUri,
|
||||
QgsProject,
|
||||
QgsProviderConnectionException,
|
||||
QgsProviderRegistry,
|
||||
QgsRasterLayer,
|
||||
QgsSettings,
|
||||
QgsVectorLayer,
|
||||
QgsGeometry,
|
||||
QgsPrintLayout,
|
||||
QgsReadWriteContext,
|
||||
QgsLayoutItemMap,
|
||||
QgsLayoutItemPage,
|
||||
QgsLayoutSize,
|
||||
QgsUnitTypes,
|
||||
QgsLayoutPoint,
|
||||
QgsLayoutItemLabel,
|
||||
QgsLayoutItemPicture,
|
||||
QgsLayoutItemLegend,
|
||||
QgsLegendStyle,
|
||||
QgsLayoutItemScaleBar,
|
||||
QgsLayerTreeGroup,
|
||||
QgsCoordinateReferenceSystem,
|
||||
QgsCoordinateTransform,
|
||||
QgsLayerTree,
|
||||
QgsLayoutTableColumn,
|
||||
QgsRectangle,
|
||||
QgsLayoutItemMapOverviewStack,
|
||||
QgsMapThemeCollection,
|
||||
)
|
||||
from qgis.PyQt.QtCore import QLocale, QUrl, QDateTime, Qt
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon, QColor, QFont, QMovie
|
||||
from qgis.PyQt.QtPrintSupport import QPrinter
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
QDockWidget,
|
||||
QAction,
|
||||
QMessageBox,
|
||||
QPushButton,
|
||||
QDockWidget,
|
||||
QFileDialog,
|
||||
QInputDialog,
|
||||
QMenu,
|
||||
QToolButton,
|
||||
QTableWidget,
|
||||
QTableWidgetItem,
|
||||
QVBoxLayout,
|
||||
)
|
||||
import psycopg2
|
||||
try:
|
||||
from PyQt5.QtCore import QSettings
|
||||
from PyQt5 import QtGui
|
||||
from PyQt5 import QtWidgets
|
||||
except:
|
||||
from PyQt6.QtCore import QSettings
|
||||
from PyQt6 import QtGui
|
||||
from PyQt6 import QtWidgets
|
||||
from qgis.PyQt.QtXml import QDomDocument
|
||||
from qgis.utils import iface
|
||||
import glob
|
||||
try:
|
||||
|
||||
Enabled = True
|
||||
from .tools.StyleLayer import *
|
||||
except:
|
||||
Enabled = False
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
send_issues,
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
from datetime import date
|
||||
|
||||
EDITOR_CLASS = load_ui('CenRa_AutoMapStyle_base.ui')
|
||||
LOGGER = logging.getLogger('CenRa_AutoMapStyle')
|
||||
|
||||
class AutoMap_Style(QDockWidget, EDITOR_CLASS):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
_ = parent
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self.settings = QgsSettings()
|
||||
self.s = QSettings()
|
||||
|
||||
self.toolButton.setIcon(QtGui.QIcon(resources_path('icons','loader.png')))
|
||||
|
||||
self.loadComboBox()
|
||||
self.toolButton.clicked.connect(self.loadStyle)
|
||||
|
||||
def loadComboBox(self):
|
||||
style = self.comboBox
|
||||
style.clear()
|
||||
style.addItem('')
|
||||
style.addItem('Foncier')
|
||||
style.addItem('Administratif')
|
||||
|
||||
def loadStyle(self):
|
||||
style = self.comboBox.currentText()
|
||||
if style == 'Foncier':
|
||||
self.loadFoncier()
|
||||
if style == 'Administratif':
|
||||
self.loadAdministratif()
|
||||
|
||||
def loginfo(self):
|
||||
InputDialog = QInputDialog()
|
||||
mdp = InputDialog.getText(None,'Foncier','Mot de pass base foncier:')
|
||||
return mdp
|
||||
|
||||
def loadAdministratif(self):
|
||||
mtc = QgsProject.instance().mapThemeCollection()
|
||||
theme_name = 'Administratif'
|
||||
theme_state = mtc.mapThemeState(theme_name)
|
||||
|
||||
mdp = self.loginfo()[0]
|
||||
if mdp != '':
|
||||
# couche = [['_form_power_rename','_form_power_rename_contour_2025'],['_42_bois_du_roy','_42_bois_du_roy_habitat_2021']]
|
||||
couche = [['administratif','departements2024','gid'],['administratif','v_communes','id']]
|
||||
for schema_table in couche:
|
||||
schema = schema_table[0]
|
||||
table = schema_table[1]
|
||||
key = schema_table[2]
|
||||
uri = QgsDataSourceUri()
|
||||
uri.setConnection(host ,port ,dbname ,os_user ,mdp)
|
||||
# nom du schéma à remplacer: "hydrographie" à supprimer et mettre "couches_collaboratives" lorsqu'on aura regroupé les couches à modifier dans un même schéma
|
||||
uri.setDataSource(schema, table, "geom")
|
||||
uri.setKeyColumn(key)
|
||||
layer = QgsVectorLayer(uri.uri(), table, "postgres")
|
||||
if layer.isValid() == True:
|
||||
layerName = layer.name()
|
||||
listStyle = layer.listStylesInDatabase()
|
||||
try:
|
||||
StyleExist = True
|
||||
indexStyle = (listStyle[2].index(layerName))
|
||||
except:
|
||||
StyleExist = False
|
||||
if StyleExist:
|
||||
StyleId = (listStyle[1][indexStyle])
|
||||
styleTuple = layer.getStyleFromDatabase(StyleId)
|
||||
styleqml = styleTuple[0]
|
||||
styledoc = QDomDocument()
|
||||
styledoc.setContent(styleqml)
|
||||
layer.importNamedStyle(styledoc)
|
||||
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
|
||||
layer_record = QgsMapThemeCollection.MapThemeLayerRecord(layer)
|
||||
theme_state.addLayerRecord(layer_record)
|
||||
mtc.insert(theme_name, theme_state)
|
||||
|
||||
def loadFoncier(self):
|
||||
mtc = QgsProject.instance().mapThemeCollection()
|
||||
theme_name = 'Foncier'
|
||||
theme_state = mtc.mapThemeState(theme_name)
|
||||
|
||||
mdp = self.loginfo()[0]
|
||||
if mdp != '':
|
||||
# couche = [['_form_power_rename','_form_power_rename_contour_2025'],['_42_bois_du_roy','_42_bois_du_roy_habitat_2021']]
|
||||
couche = [['sites','v_sites_parcelles'],['sites','v_sites'],['inventaires','suivi_zh'],['inventaires','suivi_ps']]
|
||||
for schema_table in couche:
|
||||
schema = schema_table[0]
|
||||
table = schema_table[1]
|
||||
uri = QgsDataSourceUri()
|
||||
uri.setConnection(host ,port ,dbname ,os_user ,mdp)
|
||||
# nom du schéma à remplacer: "hydrographie" à supprimer et mettre "couches_collaboratives" lorsqu'on aura regroupé les couches à modifier dans un même schéma
|
||||
uri.setDataSource(schema, table, "geom")
|
||||
uri.setKeyColumn('gid')
|
||||
layer = QgsVectorLayer(uri.uri(), table, "postgres")
|
||||
if layer.isValid() == True:
|
||||
layerName = layer.name()
|
||||
listStyle = layer.listStylesInDatabase()
|
||||
try:
|
||||
StyleExist = True
|
||||
indexStyle = (listStyle[2].index(layerName))
|
||||
except:
|
||||
StyleExist = False
|
||||
if StyleExist:
|
||||
StyleId = (listStyle[1][indexStyle])
|
||||
styleTuple = layer.getStyleFromDatabase(StyleId)
|
||||
styleqml = styleTuple[0]
|
||||
styledoc = QDomDocument()
|
||||
styledoc.setContent(styleqml)
|
||||
layer.importNamedStyle(styledoc)
|
||||
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
|
||||
layer_record = QgsMapThemeCollection.MapThemeLayerRecord(layer)
|
||||
theme_state.addLayerRecord(layer_record)
|
||||
mtc.insert(theme_name, theme_state)
|
||||
@@ -1,34 +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.81"
|
||||
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'
|
||||
if os_user == 'Administrateur':
|
||||
os_user='stage'
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -15,154 +15,154 @@ def fletch_canvas(self):
|
||||
|
||||
if page_rotate == 'Portrait':
|
||||
if values_page == 'A4':
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(50, 50, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(2.5, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(199, 175, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(198.85714285714286,175, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(5, 25, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(200, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(200, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(5, 12, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(46, 16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(5, 275, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0.0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(50.0,50, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(5, 25, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0.0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(198.85714285714286,90, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(5, 205, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(55, 5, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(145, 228, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(145, 215, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(12, 12, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(193, 214, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(205, 125, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(104, 201, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_rotate'] = 270
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(50, 50, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(2.5, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(285, 260, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(46, 16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0.0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(12.0,12, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(191, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0.0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(54.857142857142854,5, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(145, 229, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0.0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(46.0,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(5, 395, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(5, 284, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(50, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(207, 310, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(50, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(207, 298, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(8.4, 12.5, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(273, 297, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(291.5, 123, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(189, 284, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_rotate'] = 270
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
self.template_parameters['Logo_rotate'] = 0.0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(198.85714285714286,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0.0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(100.0,4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(205, 158.0, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 270.0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(100.0,4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(104, 200, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0.0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(198.85714285714286,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(5, 12, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0.0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(54.857142857142854,15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(145, 215, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0.0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(50.0,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(5, 275, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0.0
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(280,247, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(7, 35, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0.0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(70,70, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(7, 35, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0.0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(280,127, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(7, 289, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0.0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(17,17, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(269, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0.0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(77,7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(205, 323, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0.0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(65,23, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(7, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0.0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(280,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(7, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0.0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(141,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(289, 223, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 270.0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(141,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(147, 282, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0.0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(280,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(7, 17, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0.0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(77,21, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(205, 303, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0.0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(70,28, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(7, 388, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0.0
|
||||
|
||||
if page_rotate == 'Landscape':
|
||||
if values_page == 'A4':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(285, 145, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(285.14285714285717,145, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(100, 100, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0.0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(100.0,100, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(286, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(46, 16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0.0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(285.14285714285717,41, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(6, 168, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0.0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(13.142857142857142,12, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(277, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0.0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(54.857142857142854,15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(232, 193, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0.0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(46.0,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(5, 185, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(5, 168, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(207, 193, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(207, 180, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(8.4, 12.5, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(273, 182, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(291.5, 123, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(189, 168.5, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_rotate'] = 270
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
self.template_parameters['Logo_rotate'] = 0.0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(286.0,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0.0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(100.0,4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(291, 127.0, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 270.0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(100.0,4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(189, 169, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0.0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(286.0,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(5, 12, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0.0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(54.857142857142854,15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(232, 179, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0.0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(50.0,50, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(6, 118, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0.0
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(408.5, 222, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(5, 23.5, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(100, 100, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(409, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(409, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(5, 10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(46, 16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(5, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(5, 275, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(5, 249, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(323, 282, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(55, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(323, 270, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(8.4, 12.5, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(402, 270, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(415, 123, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(313, 247, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_rotate'] = 270
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(402,205, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(8, 32, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0.0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(141,141, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(8, 32, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0.0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(402,58, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(8, 237, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0.0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(19,17, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(391, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0.0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(77,21, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(327, 272, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0.0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(65,23, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(7, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0.0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(403,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(7, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0.0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(141,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(410, 179, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 270.0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(141,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(267, 238, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0.0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(403,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(7, 17, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0.0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(77,21, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(327, 252, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0.0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(70,70, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(8, 166, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0.0
|
||||
|
||||
return self.template_parameters
|
||||
@@ -1,167 +0,0 @@
|
||||
|
||||
from qgis.core import (
|
||||
QgsLayoutSize,
|
||||
QgsUnitTypes,
|
||||
QgsLayoutPoint,
|
||||
)
|
||||
def fletch_canvas(self):
|
||||
if self.radioButton_6.isChecked():
|
||||
values_page = 'A4'
|
||||
else:
|
||||
values_page = 'A3'
|
||||
if self.radioButton_7.isChecked():
|
||||
page_rotate = 'Portrait'
|
||||
else:
|
||||
page_rotate = 'Landscape'
|
||||
|
||||
if page_rotate == 'Portrait':
|
||||
if values_page == 'A4':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(200.0,200, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(6, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(80.0,80, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(126, 210, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(86.0,86, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(6, 208, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(14.285714285714286,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(189, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(51.42857142857143,7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(9, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(45.714285714285715,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(3, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(154.28571428571428,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(51, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(51.42857142857143,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(151, 210, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(51.42857142857143,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(229, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(125.71428571428571,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(60, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(51.42857142857143,13, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(9, 184, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(28.571428571428573,29, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(9, 151, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(282,282, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(8, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(113,113, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(178, 296, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(121,121, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(8, 293, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(20,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(267, 28, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(73,10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(13, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(64,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(4, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(218,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(72, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(73,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(213, 296, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(73,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(323, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(177,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(85, 28, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(73,18, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(13, 259, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(40,40, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(13, 213, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if page_rotate == 'Landscape':
|
||||
if values_page == 'A4':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(200.0,200, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(6, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(85.71428571428571,69, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(209, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(85.71428571428571,131, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(209, 74, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(14.285714285714286,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(189, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(51.42857142857143,7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(9, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(45.714285714285715,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(3, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(154.28571428571428,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(51, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(51.42857142857143,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(151, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(51.42857142857143,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(229, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(125.71428571428571,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(60, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(51.42857142857143,13, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(9, 184, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(28.571428571428573,29, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(9, 151, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(282,282, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(8, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(121,97, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(294, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(121,185, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(294, 105, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(20,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(266, 28, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(73,10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(12, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(64,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(4, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(218,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(73, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(73,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(214, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(73,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(322, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(177,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(85, 28, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(73,18, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(12, 260, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(40,40, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(12, 214, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
return self.template_parameters
|
||||
@@ -25,7 +25,7 @@ def fletch_canvas(self):
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(200, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = 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_locals'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(50, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(5, 275, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
|
||||
@@ -91,7 +91,7 @@ def fletch_canvas(self):
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
|
||||
if page_rotate == 'Landscape':
|
||||
if values_page == 'A4':
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(100, 100, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(420, 297, QgsUnitTypes.LayoutMillimeters)
|
||||
@@ -128,7 +128,7 @@ def fletch_canvas(self):
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if values_page == 'A3':
|
||||
if values_page == 'A4':
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(100, 100, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(6, 23, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(297, 210, QgsUnitTypes.LayoutMillimeters)
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
|
||||
from qgis.core import (
|
||||
QgsLayoutSize,
|
||||
QgsUnitTypes,
|
||||
QgsLayoutPoint,
|
||||
)
|
||||
def fletch_canvas(self):
|
||||
if self.radioButton_6.isChecked():
|
||||
values_page = 'A4'
|
||||
else:
|
||||
values_page = 'A3'
|
||||
if self.radioButton_7.isChecked():
|
||||
page_rotate = 'Portrait'
|
||||
else:
|
||||
page_rotate = 'Landscape'
|
||||
|
||||
if page_rotate == 'Portrait':
|
||||
if values_page == 'A4':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(168.0,262, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(41, 1, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(78.85714285714286,70, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(130, 1, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(168.0,32, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(41, 264, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(14.285714285714286,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(13, 254, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(38.857142857142854,7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(1, 289, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(34.857142857142854,10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(3, 139, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(38.857142857142854,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(1, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(74.85714285714286,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(43, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(104.0,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(104, 256, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(38.857142857142854,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(1, 14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(38.857142857142854,13, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(1, 276, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(30.0,30, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(41, 233, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(237,369, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(58, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(111,99, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(183, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(237,45, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(58, 372, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(20,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(19, 358, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(55,10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(2, 408, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(49,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(4, 196, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(55,15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(2, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(106,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(60, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(147,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(147, 361, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(55,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(2, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(55,19, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(2, 389, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(42,42, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(58, 329, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if page_rotate == 'Landscape':
|
||||
if values_page == 'A4':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(254.85714285714286,175, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(41, 1, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(78.85714285714286,70, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(217, 1, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(254.85714285714286,32, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(41, 177, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(14.285714285714286,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(13, 168, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(38.857142857142854,7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(1, 202, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(34.857142857142854,10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(3, 94, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(38.857142857142854,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(1, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(74.85714285714286,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(43, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(104.0,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(190, 169, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(38.857142857142854,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(1, 14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(38.857142857142854,13, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(1, 189, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(30.0,30, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(41, 146, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(359,247, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(58, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(111,99, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(306, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(359,45, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(58, 250, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(20,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(19, 237, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(55,10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(2, 285, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(49,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(4, 133, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(55,15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(2, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(106,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(60, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(147,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(268, 238, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(55,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(2, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(55,19, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(2, 267, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(42,42, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(58, 206, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
return self.template_parameters
|
||||
@@ -4,6 +4,7 @@ import configparser
|
||||
import shutil
|
||||
import tempfile
|
||||
import base64
|
||||
import os
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
from os.path import abspath, join, pardir, dirname
|
||||
@@ -107,25 +108,15 @@ def load_ui(*args):
|
||||
|
||||
return ui_class
|
||||
|
||||
def login_base(take=None):
|
||||
from CenRa_METABASE.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 + "')")
|
||||
res_ident = first_cur.fetchone()
|
||||
def pyperclip():
|
||||
dst = dirname(dirname(__file__))+"\\tools\\"
|
||||
if os.access('N:/',os.R_OK):
|
||||
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/StyleLayer.py'
|
||||
try:
|
||||
shutil.copy(src, dst)
|
||||
except:
|
||||
print('404')
|
||||
|
||||
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
|
||||
@@ -158,7 +149,7 @@ def maj_verif(NAME):
|
||||
|
||||
url = qgis.utils.pluginMetadata(NAME,'repository')
|
||||
#URL = url+'/raw/branch/main/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
|
||||
# print(URL)
|
||||
version = qgis.utils.pluginMetadata(NAME,'version')
|
||||
len_version = len(version)
|
||||
@@ -168,12 +159,15 @@ def maj_verif(NAME):
|
||||
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('<version>',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)
|
||||
try:
|
||||
version_web = str(urllib.request.urlopen(URL).read())
|
||||
plugin_num = version_web.find(NAME)
|
||||
valeur_version_web = version_web.find('<version>',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)
|
||||
except:
|
||||
print("error gitea version ssl")
|
||||
else:
|
||||
iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CenRa_AutoMapStyle</class>
|
||||
<widget class="QDockWidget" name="CenRa_AutoMapStyle">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>48</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="floating">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CenRa_AutoMap</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Style:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SICEN</string>
|
||||
<string>Journal des modifications</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
@@ -29,9 +29,6 @@
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -41,7 +38,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>547</height>
|
||||
<height>570</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
@@ -56,7 +53,7 @@
|
||||
<property name="title">
|
||||
<string>DevLog</string>
|
||||
</property>
|
||||
<widget class="QWebView" name="viewer" native="true">
|
||||
<widget class="QTextBrowser" name="viewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
@@ -65,11 +62,6 @@
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="url" stdset="0">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -78,19 +70,12 @@
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::NoButton</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtWebKitWidgets/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -12,17 +12,19 @@ import qgis
|
||||
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
import socket
|
||||
import os
|
||||
from .tools.resources import (
|
||||
plugin_path,
|
||||
pyperclip,
|
||||
resources_path,
|
||||
maj_verif,
|
||||
)
|
||||
pyperclip()
|
||||
from .copie_editor import Copie_Editor
|
||||
from .about_form import CopieAboutDialog
|
||||
from .about_form import AboutDialog
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
class PgCopie:
|
||||
def __init__(self):
|
||||
@@ -40,7 +42,7 @@ class PgCopie:
|
||||
maj_verif(NAME)
|
||||
|
||||
# Display About window on first use
|
||||
version = qgis.utils.pluginMetadata('CenRa_Copie','version')
|
||||
version = qgis.utils.pluginMetadata('CenRa_COPIE','version')
|
||||
s = QSettings()
|
||||
versionUse = s.value("copie/version", 1, type=str)
|
||||
if str(versionUse) != str(version) :
|
||||
@@ -66,13 +68,17 @@ class PgCopie:
|
||||
self.copie_editor = QAction(icon, 'Copie',None)
|
||||
self.toolBar.addAction(self.copie_editor)
|
||||
self.copie_editor.triggered.connect(self.open_editor)
|
||||
self.copie_editor.setEnabled(False)
|
||||
IPAddr=socket.gethostbyname(socket.gethostname())
|
||||
if os.access('N:/',os.R_OK):
|
||||
self.copie_editor.setEnabled(True)
|
||||
|
||||
def open_about_dialog(self):
|
||||
"""
|
||||
About dialog
|
||||
"""
|
||||
dialog = CopieAboutDialog(iface)
|
||||
dialog.exec_()
|
||||
dialog = AboutDialog(iface)
|
||||
dialog.exec()
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
@@ -17,7 +17,7 @@ ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
)
|
||||
|
||||
|
||||
class CopieAboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
class AboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
|
||||
|
||||
@@ -9,17 +9,23 @@ import qgis
|
||||
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 PyQt5 import QtGui
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
from qgis.PyQt.QtGui import *
|
||||
from qgis.PyQt import QtGui
|
||||
|
||||
from qgis.core import *
|
||||
from qgis.core import QgsDataSourceUri
|
||||
import os
|
||||
|
||||
from .tools.PythonSQL import *
|
||||
try:
|
||||
from .tools.PythonSQL import login_base
|
||||
except:
|
||||
print('Pas de fichier PythonSQL')
|
||||
from .tools.SQLRequet import *
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
login_base,
|
||||
send_issues,
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
@@ -62,21 +68,22 @@ class Copie_Editor(QDialog, EDITOR_CLASS):
|
||||
# tablename
|
||||
source_tablename = [s for s in list_sources if "table" in s][0].split('"')[3]
|
||||
|
||||
|
||||
account = login_base("account")
|
||||
sigdb = account[5]
|
||||
|
||||
|
||||
if source_db != sigdb:
|
||||
#self.iface.messageBar().pushMessage(u"Un référentiel ne peut être copié, utilisez les filtres !", level=QgsMessageBar.CRITICAL, duration=10)
|
||||
self.iface.messageBar().pushMessage("Ooops", u"Vous ne pouvez copier des couches que dans sigXX", level=Qgis.Critical, duration=5)
|
||||
|
||||
else :
|
||||
|
||||
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()
|
||||
else:
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
|
||||
# Creation de la liste des schemas de la base de donnees
|
||||
SQL = """WITH list_schema AS (
|
||||
@@ -109,21 +116,21 @@ class Copie_Editor(QDialog, EDITOR_CLASS):
|
||||
# show the dialog
|
||||
self.show()
|
||||
# Run the dialog event loop
|
||||
result = self.exec_()
|
||||
result = self.exec()
|
||||
# See if OK was pressed
|
||||
if result:
|
||||
#******************************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()
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
|
||||
# Récupération de la couche active
|
||||
layer = self.iface.activeLayer()
|
||||
|
||||
@@ -158,7 +165,6 @@ class Copie_Editor(QDialog, EDITOR_CLASS):
|
||||
else :
|
||||
SQL_table = "CREATE TABLE " + schema + "." + tablename + " AS SELECT * FROM " + source_schema + "." + source_tablename
|
||||
|
||||
|
||||
SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename + "_pkey" + " PRIMARY KEY (gid)"
|
||||
SQL_sequence_01 = "CREATE SEQUENCE " + schema + "." + tablename + "_gid_seq" + " INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1;"
|
||||
SQL_sequence_02 = "ALTER TABLE " + schema + "." + tablename + " ALTER COLUMN gid SET DEFAULT nextval(\'" + schema + "." + tablename + "_gid_seq\'::regclass);"
|
||||
@@ -169,7 +175,7 @@ class Copie_Editor(QDialog, EDITOR_CLASS):
|
||||
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();"
|
||||
SQL_trigger_coordonnees = "CREATE TRIGGER coordonnees" + tablename + " BEFORE INSERT OR UPDATE ON " + schema + "." + tablename + " FOR EACH ROW EXECUTE PROCEDURE ref.coordonnees();"
|
||||
|
||||
cur.execute(SQL_table)
|
||||
cur.execute(SQL_pkey)
|
||||
@@ -178,6 +184,13 @@ class Copie_Editor(QDialog, EDITOR_CLASS):
|
||||
cur.execute(SQL_sequence_03)
|
||||
cur.execute(SQL_sequence_04)
|
||||
|
||||
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+ tablename+"','gid')"
|
||||
cur.execute(RETURNE)
|
||||
sequence_name = cur.fetchone()[0]
|
||||
print(sequence_name)
|
||||
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 "+sequence_name+" TO grp_qgis;"
|
||||
cur.execute(SQL_GRANT_TABLE)
|
||||
|
||||
if layer.wkbType() == QgsWkbTypes.PointGeometry :
|
||||
cur.execute(SQL_trigger_coordonnees)
|
||||
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
[general]
|
||||
name=CenRA_COPIE
|
||||
qgisMinimumVersion=3.0
|
||||
supportsQt6=True
|
||||
description=Permet la copie d'une table dans une base PostGis
|
||||
version=2.0
|
||||
version=3.0
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
@@ -19,7 +20,7 @@ email=si_besoin@cen-rhonealpes.fr
|
||||
# Recommended items:
|
||||
|
||||
# Uncomment the following line and add your changelog:
|
||||
changelog=<h2>CenRa_COPIE:</h2></br><p><h3>22/10/2024 - Version 2:</h3>- Refonte du code.</p></br><p><h3>13/09/2024 - Version 1.5:</h3>- Ajoute d'un changelog et vérification de mise à jour.</p>
|
||||
changelog=<h2>CenRa_COPIE:</h2></br><p><h3>19/05/2025 - Version 3.0: </h3> Compatible PyQt5 et PyQt6</p></br><p><h3>11/04/2025 - Version 2.5: </h3> - Correctif de bug.</p></br><p><h3>09/04/2025 - Version 2.4: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 2.3: </h3> - Optimisation pour le TT.</p></br><p><h3>03/04/2025 - Version 2.2: </h3> - Mise a jour de securite.</p></br><p><h3>07/01/2025 - Version 2.1: </h3> - ByPass du certif ssl ci erreur.</br></p><p><h3>22/10/2024 - Version 2:</h3>- Refonte du code.</p></br><p><h3>13/09/2024 - Version 1.5:</h3>- Ajoute d'un changelog et vérification de mise à jour.</p>
|
||||
|
||||
# Tags are comma separated with spaces allowed
|
||||
tags=cenra, database, table
|
||||
|
||||
@@ -1,172 +1,141 @@
|
||||
import sys
|
||||
import socket
|
||||
import os
|
||||
IPAddr=socket.gethostbyname(socket.gethostname())
|
||||
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'
|
||||
|
||||
geom = "geom"
|
||||
champ_travaux_prevus_multipolygon="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
champ_travaux_prevus_multilinestring="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))"""
|
||||
champ_travaux_prevus_point = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, x_wgs84 double precision, y_wgs84 double precision, date_creation date, date_maj date, geom geometry(Point,2154))"""
|
||||
|
||||
champ_viergePolygone = """(gid serial NOT NULL, commentaire text, surface_m2 double precision, surface_ha double precision, geom geometry(MultiPolygon,2154))"""
|
||||
champ_viergeLigne = """(gid serial NOT NULL, commentaire text, longueur_m double precision, longueur_km double precision, geom geometry(MultiLineString,2154))"""
|
||||
champ_viergePoint = """(gid serial NOT NULL, commentaire text, x_wgs84 double precision, y_wgs84 double precision, geom geometry(Point,2154))"""
|
||||
|
||||
champ_habitat = """(gid serial NOT NULL, cd_cb_01 text, lb_cb97_fr_01 text, occupation_01 integer, cd_cb_02 text, lb_cb97_fr_02 text, occupation_02 integer, cd_cb_03 text, lb_cb97_fr_03 text, occupation_03 integer, milieu_code text, milieu_libelle text, surface_m2 double precision, surface_ha double precision, commentaire text, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
|
||||
champ_contour="""(gid serial NOT NULL, date_creation date, date_maj date, utilisateur character varying, dept character(2), nom character varying, surface_m2 double precision, surface_ha double precision, type_site character varying, type_milieu character varying, date_premier_pg integer, date_debut_pg integer, date_fin_pg integer, referent character varying, gestion_deleguee character varying, terrain_militaire character(3), ens character(3), zh character(3), adapt_pmr character(3), inform character(3), guide character(3), ouverture_public character(3), obs character(3), anim character(3), n2000_anim character(3), contrat_n2000_conseil character(3), n2000_op character(3), contrat_n2000_benef character(3), contrat_agri character(3), bc_habitat integer, bc_amphibien integer, bc_coleoptere integer, bc_crustace integer, bc_mammifere integer, bc_chiroptere integer, bc_mollusque integer, bc_odonate integer, bc_oiseau integer, bc_orthoptere integer, bc_poisson integer, bc_reptile integer, bc_rhopalocere integer, bc_heterocere integer, bc_autre_invertebre integer, bc_flore integer, bc_bryophyte integer, bc_champignon integer, suiv_analyse_sol character(3), suiv_piezo character(3), suiv_climat character(3), suiv_topo character(3), suiv_habitat character(3), suiv_amphibien character(3), suiv_coleoptere character(3), suiv_crustace character(3), suiv_mammifere character(3), suiv_chiroptere character(3), suiv_mollusque character(3), suiv_odonate character(3), suiv_oiseau character(3), suiv_orthoptere character(3), suiv_poisson character(3), suiv_reptile character(3), suiv_rhopalocere character(3), suiv_heterocere character(3), suiv_autre_invertebre character(3), suiv_flore character(3), suiv_bryophyte character(3), suiv_champignon character(3), suiv_analyse_eau character(3), suiv_phenologie character(3), suiv_frequentation character(3), suiv_paysager character(3), suiv_autre character(3), commentaire text, geom geometry(MultiPolygon,2154))
|
||||
"""
|
||||
|
||||
champ_vegethab_point = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(Point,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multilinestring = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiLineString,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multipolygon = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiPolygon,2154)
|
||||
)
|
||||
|
||||
geom = "geom"
|
||||
champ_travaux_prevus_multipolygon="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
champ_travaux_prevus_multilinestring="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))"""
|
||||
champ_travaux_prevus_point = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, x_wgs84 double precision, y_wgs84 double precision, date_creation date, date_maj date, geom geometry(Point,2154))"""
|
||||
|
||||
champ_viergePolygone = """(gid serial NOT NULL, commentaire text, surface_m2 double precision, surface_ha double precision, geom geometry(MultiPolygon,2154))"""
|
||||
champ_viergeLigne = """(gid serial NOT NULL, commentaire text, longueur_m double precision, longueur_km double precision, geom geometry(MultiLineString,2154))"""
|
||||
champ_viergePoint = """(gid serial NOT NULL, commentaire text, x_wgs84 double precision, y_wgs84 double precision, geom geometry(Point,2154))"""
|
||||
|
||||
champ_habitat = """(gid serial NOT NULL, cd_cb_01 text, lb_cb97_fr_01 text, occupation_01 integer, cd_cb_02 text, lb_cb97_fr_02 text, occupation_02 integer, cd_cb_03 text, lb_cb97_fr_03 text, occupation_03 integer, milieu_code text, milieu_libelle text, surface_m2 double precision, surface_ha double precision, commentaire text, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
|
||||
champ_contour="""(gid serial NOT NULL, date_creation date, date_maj date, utilisateur character varying, dept character(2), nom character varying, surface_m2 double precision, surface_ha double precision, type_site character varying, type_milieu character varying, date_premier_pg integer, date_debut_pg integer, date_fin_pg integer, referent character varying, gestion_deleguee character varying, terrain_militaire character(3), ens character(3), zh character(3), adapt_pmr character(3), inform character(3), guide character(3), ouverture_public character(3), obs character(3), anim character(3), n2000_anim character(3), contrat_n2000_conseil character(3), n2000_op character(3), contrat_n2000_benef character(3), contrat_agri character(3), bc_habitat integer, bc_amphibien integer, bc_coleoptere integer, bc_crustace integer, bc_mammifere integer, bc_chiroptere integer, bc_mollusque integer, bc_odonate integer, bc_oiseau integer, bc_orthoptere integer, bc_poisson integer, bc_reptile integer, bc_rhopalocere integer, bc_heterocere integer, bc_autre_invertebre integer, bc_flore integer, bc_bryophyte integer, bc_champignon integer, suiv_analyse_sol character(3), suiv_piezo character(3), suiv_climat character(3), suiv_topo character(3), suiv_habitat character(3), suiv_amphibien character(3), suiv_coleoptere character(3), suiv_crustace character(3), suiv_mammifere character(3), suiv_chiroptere character(3), suiv_mollusque character(3), suiv_odonate character(3), suiv_oiseau character(3), suiv_orthoptere character(3), suiv_poisson character(3), suiv_reptile character(3), suiv_rhopalocere character(3), suiv_heterocere character(3), suiv_autre_invertebre character(3), suiv_flore character(3), suiv_bryophyte character(3), suiv_champignon character(3), suiv_analyse_eau character(3), suiv_phenologie character(3), suiv_frequentation character(3), suiv_paysager character(3), suiv_autre character(3), commentaire text, geom geometry(MultiPolygon,2154))
|
||||
"""
|
||||
|
||||
champ_vegethab_point = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(Point,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multilinestring = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiLineString,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multipolygon = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiPolygon,2154)
|
||||
)
|
||||
"""
|
||||
@@ -6,6 +6,7 @@ import tempfile
|
||||
import base64
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
import os
|
||||
from os.path import abspath, join, pardir, dirname
|
||||
|
||||
from qgis.PyQt import uic
|
||||
@@ -89,7 +90,7 @@ def resources_path(*args):
|
||||
:return: Absolute path to the resources folder.
|
||||
:rtype: str
|
||||
"""
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_Copie\\tools")))
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_COPIE\\tools")))
|
||||
for item in args:
|
||||
path = abspath(join(path, item))
|
||||
return path
|
||||
@@ -107,24 +108,15 @@ def load_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]
|
||||
def pyperclip():
|
||||
dst = dirname(dirname(__file__))+"\\tools\\"
|
||||
if os.access('N:/',os.R_OK):
|
||||
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
|
||||
try:
|
||||
shutil.copy(src, dst)
|
||||
except:
|
||||
print('404')
|
||||
|
||||
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
|
||||
@@ -157,7 +149,7 @@ def maj_verif(NAME):
|
||||
|
||||
url = qgis.utils.pluginMetadata(NAME,'repository')
|
||||
#URL = url+'/raw/branch/main/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
|
||||
# print(URL)
|
||||
version = qgis.utils.pluginMetadata(NAME,'version')
|
||||
len_version = len(version)
|
||||
@@ -167,12 +159,15 @@ def maj_verif(NAME):
|
||||
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('<version>',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)
|
||||
try:
|
||||
version_web = str(urllib.request.urlopen(URL).read())
|
||||
plugin_num = version_web.find(NAME)
|
||||
valeur_version_web = version_web.find('<version>',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)
|
||||
except:
|
||||
print("error gitea version ssl")
|
||||
else:
|
||||
iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Metabase</string>
|
||||
<string>Journal des modifications</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
@@ -29,9 +29,6 @@
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -41,7 +38,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>547</height>
|
||||
<height>570</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
@@ -56,7 +53,7 @@
|
||||
<property name="title">
|
||||
<string>DevLog</string>
|
||||
</property>
|
||||
<widget class="QWebView" name="viewer" native="true">
|
||||
<widget class="QTextBrowser" name="viewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
@@ -65,11 +62,6 @@
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="url" stdset="0">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -78,19 +70,12 @@
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::NoButton</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtWebKitWidgets/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -12,17 +12,20 @@ import qgis
|
||||
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
import socket
|
||||
import os
|
||||
from .tools.resources import (
|
||||
plugin_path,
|
||||
pyperclip,
|
||||
resources_path,
|
||||
maj_verif,
|
||||
)
|
||||
pyperclip()
|
||||
from .flux_editor import Flux_Editor
|
||||
from .about_form import FluxAboutDialog
|
||||
from .about_form import AboutDialog
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
|
||||
class PgFlux:
|
||||
def __init__(self):
|
||||
@@ -40,7 +43,7 @@ class PgFlux:
|
||||
maj_verif(NAME)
|
||||
|
||||
# Display About window on first use
|
||||
version = qgis.utils.pluginMetadata('CenRa_Flux','version')
|
||||
version = qgis.utils.pluginMetadata('CenRa_FLUX','version')
|
||||
s = QSettings()
|
||||
versionUse = s.value("flux/version", 1, type=str)
|
||||
if str(versionUse) != str(version) :
|
||||
@@ -63,16 +66,20 @@ class PgFlux:
|
||||
if not self.action_editor:
|
||||
self.action_editor = Flux_Editor()
|
||||
|
||||
|
||||
self.flux_editor = QAction(icon, 'SigCEN',None)
|
||||
self.toolBar.addAction(self.flux_editor)
|
||||
self.flux_editor.triggered.connect(self.open_editor)
|
||||
self.flux_editor.setEnabled(False)
|
||||
if os.access('N:/',os.R_OK):
|
||||
self.flux_editor.setEnabled(True)
|
||||
|
||||
def open_about_dialog(self):
|
||||
"""
|
||||
About dialog
|
||||
"""
|
||||
dialog = CopieAboutDialog(iface)
|
||||
dialog.exec_()
|
||||
dialog = AboutDialog(iface)
|
||||
dialog.exec()
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
@@ -1,60 +1,6 @@
|
||||
# <p align="center">FluxCEN</p>
|
||||
|
||||
<img align="left" src=https://raw.githubusercontent.com/CEN-Nouvelle-Aquitaine/fluxcen/main/icon.png width="220"/>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
Le plugin QGIS FluxCEN permet d'accéder rapidement à un large éventail de flux WFS/WMS organisés par catégories et interrogeables sous forme de mots-clés.
|
||||
<br>
|
||||
<br>
|
||||
Il évite ainsi d'avoir à gérer dans QGIS une multitude de connexions.
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
## 🧐 Features
|
||||
- Sélection rapide des ressources par autocomplétion
|
||||
- Regroupement des flux au sein de catégories
|
||||
- Gestion des styles par défaut à l'ouverture dans QGIS pour les données WFS
|
||||
- Centralisation et gestion des flux simplifiée dans un fichier .csv
|
||||
- Code et ressources attachées gérées directement via le git
|
||||
- Prise en charge des flux Geoserver et Mapserver
|
||||
- Lien direct vers la fiche de métadonnées de la ressource
|
||||
|
||||
## Composition du fichier .csv
|
||||
|
||||
* service : type de service utilisé (WFS ou WMS)
|
||||
* categorie : categorie de la couche pour affichage et recherche dans le plugin
|
||||
* Nom_couche_plugin : nom de la couche qui s'affichera dans le plugin
|
||||
* nom_technique : nom technique de la couche utilisé sur le serveur source (caché dans le plugin)
|
||||
* url : URL du serveur pour accéder à la couche
|
||||
* source : Source de la donnée
|
||||
* style : nom du fichier de style pour affichage à l'ouverture dans QGIS
|
||||
* metadonnees : URL d'accès à la fiche de métadonnées liée à la resource
|
||||
|
||||
Exemple pour accéder à la BD ORTHO® :
|
||||
|
||||
| service | categorie | Nom_couche_plugin | nom_technique | url | source | style |
|
||||
| -------- | -------- | -------- | -------- | -------- |-------- | -------- |
|
||||
| WMS Raster| Fonds cartos | BD ORTHO® | HR.ORTHOIMAGERY.ORTHOPHOTOS |https://wxs.ign.fr/ortho/geoportail/r/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities| IGN | |
|
||||
|
||||
|
||||
|
||||
## Style des couches
|
||||
|
||||
Le dossier *styles_couches* stocke les styles QGIS au format .qml afin d'appliquer par défaut ce style à l'ouverture de la couche dans QGIS. L'ajout d'un style dans ce dossier nécessite de reporter le nom du fichier .qml dans le champ "style" du csv.
|
||||
|
||||
|
||||
## Accès aux données protégées
|
||||
|
||||
Si l'accès à la majorité des ressources reste public, certaines peuvent être protégées par un mot de passe (données métier confidentielles par exemple).
|
||||
|
||||
Cette authentification est gérée via le serveur cartographique qui génère les flux.
|
||||
Pour y accéder, il faut créer en amont une authentification dans QGIS. L'ouverture des données protégées se fera alors à partir de la première authentification enregistrée dans QGIS (pas de gestion multi-authentification pour le moment)
|
||||
|
||||
## Interface du plugin:
|
||||
|
||||
<img align="center" src=https://raw.githubusercontent.com/CEN-Nouvelle-Aquitaine/fluxcen/main/fluxcen_interface.PNG width="600"/>
|
||||
|
||||
> [Point de départ de création du plugin](https://github.com/CEN-Nouvelle-Aquitaine/MapCEN)
|
||||
|
||||
Le plugin QGIS CenRa_FLUX permet d'accéder rapidement à un large éventail de données organisés dans PostGIS par catégories et interrogeables sous forme de mots-clés.
|
||||
|
||||
Il évite ainsi d'avoir à gérer dans QGIS une multitude de connexions.
|
||||
@@ -17,7 +17,7 @@ ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
)
|
||||
|
||||
|
||||
class FluxAboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
class AboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
|
||||
|
||||
@@ -11,9 +11,15 @@ from qgis.PyQt.QtCore import QSettings
|
||||
from qgis.PyQt import QtWidgets
|
||||
from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog
|
||||
from qgis.PyQt.QtGui import QIcon
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5 import QtGui
|
||||
try:
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5 import QtGui
|
||||
except:
|
||||
from PyQt6.QtCore import *
|
||||
from PyQt6.QtGui import *
|
||||
from PyQt6 import QtGui
|
||||
|
||||
from qgis.core import *
|
||||
from qgis.core import QgsDataSourceUri
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
@@ -29,15 +35,20 @@ from qgis.PyQt.QtWidgets import (
|
||||
QMessageBox,
|
||||
QVBoxLayout,
|
||||
)
|
||||
from .tools.PythonSQL import *
|
||||
from .tools.SQLRequet import *
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
login_base,
|
||||
send_issues,
|
||||
)
|
||||
try:
|
||||
from .tools.PythonSQL import login_base
|
||||
except:
|
||||
print('Pas de fichier PythonSQL')
|
||||
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
from ast import literal_eval
|
||||
from qgis.utils import iface
|
||||
import os.path
|
||||
import webbrowser, os
|
||||
@@ -45,15 +56,136 @@ import psycopg2
|
||||
import psycopg2.extras
|
||||
import base64
|
||||
|
||||
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]
|
||||
first_conn.close()
|
||||
global DeBUG
|
||||
DeBUG = 0
|
||||
|
||||
try:
|
||||
account = login_base('account')
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
sigdb = account[5]
|
||||
refdb = account[6]
|
||||
|
||||
|
||||
|
||||
except:
|
||||
print('')
|
||||
EDITOR_CLASS = load_ui('CenRa_Flux_base.ui')
|
||||
html = '''<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
|
||||
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
|
||||
crossorigin=""/>
|
||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
|
||||
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
|
||||
crossorigin=""></script>
|
||||
<style>
|
||||
body { padding: 0; margin: 0; }
|
||||
html, body, #map { height: 100%; }
|
||||
.leaflet-control-layers-toggle {
|
||||
background-image: url(https://intranet.cenra-outils.org/Intranet/css/images/layers.png);
|
||||
}
|
||||
.legend_parc {
|
||||
border-radius: 15px;
|
||||
box-shadow: 2px 2px 3px 0 #6a6a6a;
|
||||
background-color: #fefafab3;
|
||||
opacity:0;
|
||||
}
|
||||
.legend_parc:hover{
|
||||
opacity:1;
|
||||
}
|
||||
.popup-with-no-events {
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
<script src="map.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<script>'''
|
||||
font = '''var OrthoIGN = L.tileLayer('https://wmts.geopf.fr/wmts?'+
|
||||
'&LAYER={ignLayer}&STYLE={style}&TILEMATRIXSET=PM'+
|
||||
'&SERVICE={service}&REQUEST=GetTile&VERSION=1.0.0'+
|
||||
'&FORMAT={format}&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}',
|
||||
{
|
||||
ignLayer: 'ORTHOIMAGERY.ORTHOPHOTOS',
|
||||
style: 'normal',
|
||||
service: 'WMTS',
|
||||
format: 'image/jpeg',
|
||||
minZoom: 0,
|
||||
maxZoom: 19,
|
||||
attribution: '© IGN'
|
||||
}).addTo(map);
|
||||
// Plan IGN avec une transparence de 50%
|
||||
var PlanIGN = L.tileLayer('https://wmts.geopf.fr/wmts?'+
|
||||
'&LAYER={ignLayer}&STYLE={style}&TILEMATRIXSET=PM'+
|
||||
'&SERVICE={service}&REQUEST=GetTile&VERSION=1.0.0'+
|
||||
'&FORMAT={format}&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}',
|
||||
{
|
||||
ignLayer: 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2',
|
||||
style: 'normal',
|
||||
service: 'WMTS',
|
||||
format: 'image/png',
|
||||
minZoom: 0,
|
||||
maxZoom: 19,
|
||||
attribution: '© IGN'
|
||||
});
|
||||
var baseMaps = {
|
||||
// "BDORTHO2" : bdortho,
|
||||
// "Openstreetmap": openStreetMap,
|
||||
// "Opentopomap": openTopoMap,
|
||||
"BDORTHO" : OrthoIGN,
|
||||
"PlanIGN": PlanIGN
|
||||
};
|
||||
var overlayMaps = {
|
||||
"Sites": Sites,
|
||||
//"Parcelle":JSON
|
||||
};
|
||||
L.control.layers(baseMaps,overlayMaps).addTo(map);
|
||||
var scale = L.control.scale({position: 'bottomleft', metric:true, imperial:false});
|
||||
scale.addTo(map);
|
||||
var legend = L.control({position: 'bottomleft'});
|
||||
|
||||
legend.onAdd = function (map) {
|
||||
var div = L.DomUtil.create('div', 'info legend_parc'),
|
||||
labels = [];
|
||||
labels.push('<i style="background:#73004c;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Acquisition')
|
||||
|
||||
labels.push('<i style="background:#ff00c5;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Acquis en partie BND')
|
||||
|
||||
labels.push('<i style="background:#f0ade1ab;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Acquisition pour partie')
|
||||
|
||||
labels.push('<i style="background:#73462e;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Acquisition / Convention')
|
||||
|
||||
labels.push('<i style="background:#e69800;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Convention')
|
||||
|
||||
labels.push('<i style="background:#ffd37f;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Convention en partie BND')
|
||||
|
||||
labels.push('<i style="background:#ffebaf;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Convention pour partie')
|
||||
|
||||
labels.push('<i style="background:#c8c8c8;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Autre')
|
||||
|
||||
labels.push('<i style="background:#f9ff08;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Projet en cours')
|
||||
|
||||
labels.push('<i style="background:#fe0000;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Problème de mise à jour')
|
||||
|
||||
labels.push('<i style="background:#000;width:18px;height:18px;float:left;margin-right:8px;opacity: 0.7;"></i> Pas de maitrise')
|
||||
|
||||
div.innerHTML = labels.join('<br>');
|
||||
return div;
|
||||
};
|
||||
|
||||
legend.addTo(map);
|
||||
</script>'''
|
||||
targetCrs = QgsCoordinateReferenceSystem('EPSG:4326')
|
||||
layerCrs = QgsCoordinateReferenceSystem('EPSG:2154')
|
||||
TranformCRS = QgsCoordinateTransform(layerCrs, targetCrs,QgsProject.instance())
|
||||
|
||||
class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
@@ -70,8 +202,9 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
self.commandLinkButton.setIcon(QtGui.QIcon(resources_path('ui','arrow-bottom.png')))
|
||||
self.commandLinkButton_2.setIcon(QtGui.QIcon(resources_path('ui','arrow-up.png')))
|
||||
|
||||
self.tableWidget.setSelectionBehavior(QTableWidget.SelectRows)
|
||||
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
#self.tableWidget.setSelectionBehavior(QTableWidget.selectRow)
|
||||
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger(0))
|
||||
self.toolButton.setIcon(QtGui.QIcon(resources_path('ui','find.png')))
|
||||
self.comboBox_2.addItem("SIG")
|
||||
self.comboBox_2.addItem('REF')
|
||||
self.comboBox.currentIndexChanged.connect(self.initialisation_flux)
|
||||
@@ -81,9 +214,20 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
self.commandLinkButton_2.clicked.connect(self.suppression_flux)
|
||||
self.tableWidget_2.itemDoubleClicked.connect(self.suppression_flux)
|
||||
self.comboBox_2.currentIndexChanged.connect(self.bd_source)
|
||||
self.checkBox.hide()
|
||||
self.checkBox.stateChanged.connect(self.modeCarte)
|
||||
self.toolButton.clicked.connect(self.getCanevas)
|
||||
layout = QVBoxLayout()
|
||||
self.lineEdit.textChanged.connect(self.filtre_dynamique)
|
||||
self.viewer.textChanged.connect(self.NewTitle)
|
||||
layout.addWidget(self.lineEdit)
|
||||
self.viewer.hide()
|
||||
self.DeBUG.addItem('')
|
||||
self.DeBUG.addItem('01')
|
||||
self.DeBUG.addItem('0726')
|
||||
self.DeBUG.addItem('4269')
|
||||
|
||||
self.DeBUG.hide()
|
||||
#self.lineEdit.mousePressEvent = self._mousePressEvent
|
||||
|
||||
#metadonnees_plugin = open(self.plugin_path + '/metadata.txt')
|
||||
@@ -92,6 +236,141 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
def raise_(self):
|
||||
"""Run method that performs all the real work"""
|
||||
self.bd_source()
|
||||
def ModeDeBUG(self):
|
||||
self.DeBUG.show()
|
||||
|
||||
def mousePressEvent(self, event):
|
||||
global DeBUG
|
||||
if 330 <= event.pos().x() <= 560 and 5 <= event.pos().y() <= 75:
|
||||
DeBUG = DeBUG+1
|
||||
if DeBUG == 3:
|
||||
DeBUG = 0
|
||||
self.ModeDeBUG()
|
||||
else:
|
||||
DeBUG = 0
|
||||
self.DeBUG.hide()
|
||||
|
||||
def NewTitle(self):
|
||||
if self.viewer.title() != '':
|
||||
Tsplit = ((self.viewer.title()).split('.'))
|
||||
print(Tsplit[0],Tsplit[1])
|
||||
self.openPostGIS(Tsplit[0],Tsplit[1])
|
||||
|
||||
def modeCarte(self):
|
||||
if self.checkBox.isChecked():
|
||||
self.viewer.show()
|
||||
|
||||
cur.execute("SELECT ST_AsGeoJSON(st_centroid(ST_Transform(geom,4326))) FROM _agregation_ra._agreg_contour")
|
||||
varcenter = literal_eval(cur.fetchall()[0][0])
|
||||
varcenter = [varcenter['coordinates'][1],varcenter['coordinates'][0]]
|
||||
|
||||
cur.execute("SELECT ST_AsGeoJSON(ST_Transform(st_collect(geom),4326)),tschema,tname FROM _agregation_ra._agreg_contour WHERE geom IS NOT NULL GROUP BY tschema,tname;" )
|
||||
varSite = cur.fetchall()
|
||||
cur.execute("SELECT ST_AsGeoJSON(ST_Transform(st_collect(geom),4326)),tschema,tname FROM _agregation_ra._agreg_travaux_prevus_poly WHERE geom IS NOT NULL GROUP BY tschema,tname;")
|
||||
varTravaux = cur.fetchall()
|
||||
cur.execute("SELECT ST_AsGeoJSON(ST_Transform(geom,4326)),milieu_libelle ,lb_eu_01,tschema,tname FROM _agregation_ra._agreg_eu_habitat WHERE geom IS NOT NULL;")
|
||||
varHabitat = cur.fetchall()
|
||||
|
||||
vargeomS = literal_eval(varSite[0][0])
|
||||
vargeomT = literal_eval(varTravaux[0][0])
|
||||
vargeomH = literal_eval(varHabitat[0][0])
|
||||
#new_objectS = self.SwitchGeom(vargeomS)
|
||||
#new_objectT = self.SwitchGeom(vargeomT)
|
||||
#new_objectH = self.SwitchGeom(vargeomH)
|
||||
|
||||
script = 'var map = L.map("map").setView('+str(varcenter)+', 13);'
|
||||
|
||||
id = 0
|
||||
varSiteJSON = '''var ParcelleJSON = {
|
||||
"type": "FeatureCollection",
|
||||
"features":['''
|
||||
for varP in varSite:
|
||||
id = id+1
|
||||
varSiteJSON = varSiteJSON+'{"properties": {"code": "'+str(varP[1])+'.'+str(varP[2])+'" },'+str(varP[0][1:])+','
|
||||
varSiteJSON = varSiteJSON[:-1]+''']};
|
||||
var Sites = L.geoJSON(ParcelleJSON,{
|
||||
style: function(feature) {
|
||||
switch (feature.geometry.properties.code) {
|
||||
case 'Ensemble de sites': return {fillColor: "#9a7863",color:"white",weight: 1,fillOpacity: 0.7};
|
||||
case 'Sous-site conservatoire': return {fillColor: "#e69800",color:"white",weight: 1,fillOpacity: 0.7};
|
||||
case 'Site non géré': return {fillColor: "#73004c",color:"white",weight: 1,fillOpacity: 0.7};
|
||||
case 'Animation territoriale': return {fillColor: "#ffebaf",color:"white",weight: 1,fillOpacity: 0.7};
|
||||
case 'Site conservatoire': return {fillColor: "#f9ff08",color:"white",weight: 1,fillOpacity: 0.7};
|
||||
default: return {fillColor: "#c8c8c8",color:"white",weight: 1,fillOpacity: 0.7};
|
||||
}
|
||||
},
|
||||
onEachFeature: function (feature,layer) {
|
||||
layer.on('click', function(e) {
|
||||
map.fitBounds(layer.getBounds());
|
||||
document.title = feature.properties.code.toString();
|
||||
});
|
||||
layer.on('mouseover', function(e) {
|
||||
layer.setStyle({
|
||||
weight: 5,
|
||||
color: '#fe0000',
|
||||
dashArray: '',
|
||||
});
|
||||
});
|
||||
//layer.on('mousemove', function(e) {
|
||||
//layer.openPopup(e.latlng);
|
||||
//});
|
||||
layer.on('mouseout', function(e) {
|
||||
layer.setStyle({
|
||||
color:"white",
|
||||
weight: 1,
|
||||
});
|
||||
});
|
||||
layer.bindTooltip(feature.properties.code.toString(), {
|
||||
sticky: true,
|
||||
permanent: false,
|
||||
direction: 'right',
|
||||
className: 'label_parc'
|
||||
});
|
||||
}
|
||||
}).addTo(map);'''
|
||||
id = 0
|
||||
varTravauxJSON = '''var TravauxJSON = {
|
||||
"type": "FeatureCollection",
|
||||
"features":['''
|
||||
for varT in varTravaux:
|
||||
id = id+1
|
||||
varTravauxJSON = varTravauxJSON+'{"properties": {"code": "'+str(varT[1])+'.'+str(varT[2])+'" },'+str(varT[0][1:])+','
|
||||
varTravauxJSON = varTravauxJSON[:-1]+''']};
|
||||
var Travaux = L.geoJSON(TravauxJSON,{
|
||||
onEachFeature: function (feature,layer) {
|
||||
layer.on('click', function(e) {
|
||||
map.fitBounds(layer.getBounds());
|
||||
document.title = feature.properties.code.toString();
|
||||
});
|
||||
layer.on('mouseover', function(e) {
|
||||
layer.setStyle({
|
||||
weight: 5,
|
||||
color: '#fe0000',
|
||||
dashArray: '',
|
||||
});
|
||||
});
|
||||
//layer.on('mousemove', function(e) {
|
||||
//layer.openPopup(e.latlng);
|
||||
//});
|
||||
layer.on('mouseout', function(e) {
|
||||
layer.setStyle({
|
||||
color:"white",
|
||||
weight: 1,
|
||||
});
|
||||
});
|
||||
layer.bindTooltip(feature.properties.code.toString(), {
|
||||
sticky: true,
|
||||
permanent: false,
|
||||
direction: 'right',
|
||||
className: 'label_parc'
|
||||
});
|
||||
}
|
||||
}).addTo(map);'''
|
||||
script = script+varSiteJSON+varTravauxJSON
|
||||
self.viewer.setHtml(html+script+font)
|
||||
|
||||
else:
|
||||
self.viewer.hide()
|
||||
|
||||
def bd_source(self):
|
||||
self.activateWindow()
|
||||
@@ -119,7 +398,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
# show the dialog
|
||||
self.show()
|
||||
# Run the dialog event loop
|
||||
result = self.exec_()
|
||||
result = self.exec()
|
||||
# See if OK was pressed
|
||||
if result:
|
||||
# Do something useful here - delete the line containing pass and
|
||||
@@ -143,7 +422,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
# show the dialog
|
||||
self.show()
|
||||
# Run the dialog event loop
|
||||
result = self.exec_()
|
||||
result = self.exec()
|
||||
# See if OK was pressed
|
||||
if result:
|
||||
# Do something useful here - delete the line containing pass and
|
||||
@@ -158,6 +437,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
def initialisation_flux(self):
|
||||
if dbtype == sigdb:
|
||||
# self.toolButton.setEnabled(1)
|
||||
if self.comboBox.currentText() == 'toutes les catégories':
|
||||
custom_list=schemaname_list
|
||||
elif self.comboBox.currentText() == 'travaux':
|
||||
@@ -182,7 +462,11 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
if dbtype == sigdb:
|
||||
type_val = str(value[0])[1:3]
|
||||
schema_name=str(value[0])[4:]
|
||||
table_name=str(value[1])
|
||||
table_name=str(value[1][len(value[0])+1:])
|
||||
if value[0] == value[1][:len(value[0])]:
|
||||
table_name=str(value[1][len(value[0])+1:])
|
||||
else:
|
||||
table_name=str(value[1])
|
||||
else:
|
||||
type_val = ''
|
||||
schema_name=str(value[0])
|
||||
@@ -190,7 +474,10 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
if type_val == 'fo':
|
||||
type_val=str(value[0])[1:5]
|
||||
schema_name=str(value[0])[6:]
|
||||
table_name=str(value[1])
|
||||
if value[0] == value[1][:len(value[0])]:
|
||||
table_name=str(value[1][len(value[0])+1:])
|
||||
else:
|
||||
table_name=str(value[1])
|
||||
elif type_val == 'ra':
|
||||
type_val='travaux'
|
||||
schema_name=str(value[0])
|
||||
@@ -211,6 +498,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
self.tableWidget.setColumnWidth(1, 300)
|
||||
self.tableWidget.setColumnWidth(2, 300)
|
||||
self.tableWidget.setHorizontalHeaderLabels(["Code","Schema","Table"])
|
||||
|
||||
def selection_flux(self):
|
||||
selected_row = 0
|
||||
selected_items = self.tableWidget.selectedItems()
|
||||
@@ -234,7 +522,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
def item_already_exists(self, new_item_text):
|
||||
# Assuming you want to compare items in the first column for uniqueness
|
||||
existing_items = self.tableWidget_2.findItems(new_item_text, QtCore.Qt.MatchExactly)
|
||||
existing_items = self.tableWidget_2.findItems(new_item_text, QtCore.Qt.MatchFlag(0))
|
||||
|
||||
# Check if there are any existing items with the same text in the first column
|
||||
return len(existing_items) > 0
|
||||
@@ -247,15 +535,24 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !",
|
||||
"Le nombre de flux à charger en une seule fois est limité à 5 pour des questions de performances. Souhaitez vous tout de même charger les " + str(
|
||||
self.tableWidget_2.rowCount()) + " flux sélectionnés ? (risque de plantage de QGIS)",
|
||||
QMessageBox.Yes | QMessageBox.No)
|
||||
if self.QMBquestion == QMessageBox.Yes:
|
||||
QMessageBox.StandardButton(0x00004000)|QMessageBox.StandardButton(0x00010000))
|
||||
if self.QMBquestion == QMessageBox.StandardButton(0x00004000):
|
||||
self.chargement_flux()
|
||||
|
||||
if self.QMBquestion == QMessageBox.No:
|
||||
if self.QMBquestion == QMessageBox.StandardButton(0x00001000):
|
||||
print("Annulation du chargement des couches")
|
||||
|
||||
if self.tableWidget_2.rowCount() <= 5:
|
||||
self.chargement_flux()
|
||||
def openPostGIS(self,schema,table):
|
||||
uri = QgsDataSourceUri()
|
||||
uri.setConnection(host ,port ,sigdb ,user ,mdp)
|
||||
uri.setDataSource(schema, table, "geom")
|
||||
uri.setKeyColumn('gid')
|
||||
uri.setSrid('2154')
|
||||
layer = QgsVectorLayer(uri.uri(), table, "postgres")
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
|
||||
def chargement_flux(self):
|
||||
|
||||
@@ -273,17 +570,23 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
return switcher.get(type, "nothing")
|
||||
|
||||
|
||||
|
||||
def displayOnWindows(type, uri, name):
|
||||
p = []
|
||||
|
||||
for row in range(0, self.tableWidget_2.rowCount()):
|
||||
color_rgba = 855030089
|
||||
if self.tableWidget_2.item(row, 0).background().color().rgba() != 855030089:
|
||||
## supression de la partie de l'url après le point d'interrogation
|
||||
if dbtype == sigdb:
|
||||
code = self.tableWidget_2.item(row,0).text()
|
||||
schema = '_'+code+'_'+self.tableWidget_2.item(row,1).text()
|
||||
if code == 'travaux' or code == 'agregation':
|
||||
schema = self.tableWidget_2.item(row,1).text()
|
||||
table = self.tableWidget_2.item(row,2).text()#.split("?", 1)[0]
|
||||
table = self.tableWidget_2.item(row,2).text()
|
||||
else:
|
||||
table = self.tableWidget_2.item(row,2).text()
|
||||
table = schema+'_'+table
|
||||
if dbtype == refdb:
|
||||
# code = self.tableWidget_2.item(row,0).text()
|
||||
schema = self.tableWidget_2.item(row,1).text()
|
||||
@@ -300,7 +603,6 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
geom_type ='SELECT right(st_geometrytype(geom),-3) as a FROM '+schema+'.'+table+' GROUP BY a'
|
||||
cur.execute(geom_type)
|
||||
list_typegeom = cur.fetchall()
|
||||
print(len(list_typegeom))
|
||||
if len(list_typegeom) > 1:
|
||||
for typegeom in list_typegeom:
|
||||
if typegeom[0] == 'MultiPolygon':
|
||||
@@ -324,9 +626,11 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
layer = QgsVectorLayer(uri.uri(), table, "postgres")
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
|
||||
else:
|
||||
self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !","La couche «" + str(self.tableWidget_2.item(row,1).text()) +' '+ str(self.tableWidget_2.item(row,2).text()) + "» ne ce trouve pas dans cette BD !",QMessageBox.StandardButton(0x00004000))
|
||||
def combobox_custom(self):
|
||||
if dbtype == sigdb:
|
||||
self.toolButton.setEnabled(1)
|
||||
self.comboBox.clear()
|
||||
self.comboBox.addItem("toutes les catégories")
|
||||
self.comboBox.addItem('00')
|
||||
@@ -339,6 +643,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
self.comboBox.addItem('travaux')
|
||||
self.comboBox.addItem('form')
|
||||
if dbtype == refdb:
|
||||
self.toolButton.setEnabled(0)
|
||||
custom_list=schemaname_distinct
|
||||
cur.execute(custom_list)
|
||||
list_schema = cur.fetchall()
|
||||
@@ -346,8 +651,10 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
self.comboBox.addItem("toutes les catégories")
|
||||
for baxval in list_schema:
|
||||
self.comboBox.addItem(baxval[0])
|
||||
def filtre_dynamique(self, filter_text):
|
||||
|
||||
def filtre_dynamique(self, filter_text):
|
||||
if filter_text.find(' ') >= 0:
|
||||
filter_text=filter_text.replace(" ","_")
|
||||
for i in range(self.tableWidget.rowCount()):
|
||||
for j in range(self.tableWidget.columnCount()):
|
||||
item = self.tableWidget.item(i, j)
|
||||
@@ -356,6 +663,64 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
|
||||
if not match:
|
||||
break
|
||||
|
||||
def getCanevas(self):
|
||||
poly = iface.mapCanvas().extent()
|
||||
geom = (str(poly.xMinimum())+','+str(poly.yMinimum())+','+str(poly.xMaximum())+','+str(poly.yMaximum()))
|
||||
|
||||
SQL_GEOM_CONTOUR = """SELECT DISTINCT tschema,tname FROM "_agregation_ra"."_agreg_contour" WHERE st_intersects(geom,ST_MakeEnvelope("""+geom+",2154)) ORDER BY tname"
|
||||
SQL_GEOM_HABITAT = """SELECT DISTINCT tschema,tname FROM "_agregation_ra"."_agreg_habitat" WHERE st_intersects(geom,ST_MakeEnvelope("""+geom+",2154)) ORDER BY tname"
|
||||
SQL_GEOM_EU_HABITAT = """SELECT DISTINCT tschema,tname FROM "_agregation_ra"."_agreg_eu_habitat" WHERE st_intersects(geom,ST_MakeEnvelope("""+geom+",2154)) ORDER BY tname"
|
||||
SQL_GEOM_TRAVAUX_PREVUS_LIGNE = """SELECT DISTINCT tschema,tname FROM "_agregation_ra"."_agreg_travaux_prevus_ligne" WHERE st_intersects(geom,ST_MakeEnvelope("""+geom+",2154)) ORDER BY tname"
|
||||
SQL_GEOM_TRAVAUX_PREVUS_POINT = """SELECT DISTINCT tschema,tname FROM "_agregation_ra"."_agreg_travaux_prevus_point" WHERE st_intersects(geom,ST_MakeEnvelope("""+geom+",2154)) ORDER BY tname"
|
||||
SQL_GEOM_TRAVAUX_PREVUS_POLY = """SELECT DISTINCT tschema,tname FROM "_agregation_ra"."_agreg_travaux_prevus_poly" WHERE st_intersects(geom,ST_MakeEnvelope("""+geom+",2154)) ORDER BY tname"
|
||||
|
||||
cur.execute(SQL_GEOM_CONTOUR)
|
||||
TableContour = cur.fetchall()
|
||||
cur.execute(SQL_GEOM_HABITAT)
|
||||
TableHabitat = cur.fetchall()
|
||||
cur.execute(SQL_GEOM_EU_HABITAT)
|
||||
TableEuHabitat = cur.fetchall()
|
||||
cur.execute(SQL_GEOM_TRAVAUX_PREVUS_LIGNE)
|
||||
TableTravauxLigne = cur.fetchall()
|
||||
cur.execute(SQL_GEOM_TRAVAUX_PREVUS_POINT)
|
||||
TableTravauxPoint = cur.fetchall()
|
||||
cur.execute(SQL_GEOM_TRAVAUX_PREVUS_POLY)
|
||||
TableTravauxPoly = cur.fetchall()
|
||||
|
||||
TableHaveGeom = sorted(TableContour+TableHabitat+TableEuHabitat+TableTravauxLigne+TableTravauxPoint+TableTravauxPoly)
|
||||
row_count = 0
|
||||
self.tableWidget.setRowCount(0)
|
||||
for e in TableHaveGeom:
|
||||
cur.execute("""SELECT DISTINCT count(*) FROM pg_catalog.pg_tables WHERE schemaname LIKE '"""+e[0]+"""' AND tablename LIKE '"""+e[1]+"""';""")
|
||||
TableSomme = cur.fetchall()[0][0]
|
||||
|
||||
if e[0][1:3] != 'fo':
|
||||
DepName = QTableWidgetItem(e[0][1:3])
|
||||
SchemaName = QTableWidgetItem(e[0][4:])
|
||||
else:
|
||||
DepName = QTableWidgetItem('form')
|
||||
SchemaName = QTableWidgetItem(e[0][6:])
|
||||
TableName = QTableWidgetItem(e[1][len(e[0])+1:])
|
||||
self.tableWidget.insertRow(row_count)
|
||||
self.tableWidget.setItem(row_count,0,DepName)
|
||||
self.tableWidget.setItem(row_count,1,SchemaName)
|
||||
self.tableWidget.setItem(row_count,2,TableName)
|
||||
if TableSomme == 0:
|
||||
for j in range(self.tableWidget.columnCount()):
|
||||
self.tableWidget.item(row_count, j).setBackground(QtGui.QColor(246, 185, 73,50))
|
||||
self.tableWidget.item(row_count,j).setToolTip('Couche dans une autre BD !')
|
||||
row_count = row_count+1
|
||||
if self.lineEdit.text() != 'Recherche par mots-clés':
|
||||
self.filtre_dynamique(self.lineEdit.text())
|
||||
|
||||
def SwitchGeom(self,vargeom):
|
||||
new_object = '['
|
||||
obj = vargeom['coordinates'][0][0]
|
||||
for obj_X in obj:
|
||||
new_object = new_object+'['+str(obj_X[1])+','+str(obj_X[0])+'],'
|
||||
new_object = new_object[:-1]+']'
|
||||
return(new_object)
|
||||
|
||||
def popup(self):
|
||||
|
||||
self.dialog = Popup() # +++ - self
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
[general]
|
||||
name=CenRa_FLUX
|
||||
qgisMinimumVersion=3.0
|
||||
supportsQt6=True
|
||||
description=Permet d'ouvrire une table dans la base PostGis
|
||||
version=2.1
|
||||
version=3.0
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
@@ -32,7 +33,7 @@ icon=icon.png
|
||||
# experimental flag
|
||||
experimental=False
|
||||
|
||||
changelog=<h1>CenRA_FLUX:</h1></br><p><h3>22/10/2024 - Version 2.1:</h3> - Correctif de bug.</br> - Evolution de la limit de 3 à 5. </br></p></br><p><h3>22/10/2024 - Version 2.0:</h3> - Reformatage du code.</br></p></br><p><h3>03/10/2024 - Version 1.14:</h3> - Remonte la fênetre dans la pille.</br></p><p><h3>13/09/2024 - Version 1.13:</h3>- MAJ sur le lien du changelog</br>- Bug-fix: Ouvre MultiPolygone et Polygon séparément.</p></br><p><h3>10/09/2024 - Version 1.11:</h3>- Ouverture de table contenant plusieurs géométries.</p></br><p><h3>26/08/2024 - Version 1.10:</h3>- Ajoute d'un changelog et vérification de mise à jour.</p>
|
||||
changelog=<h2>CenRa_FLUX:</h2></br><p><h3>19/05/2025 - Version 3.0: </h3> Compatible PyQt5 et PyQt6</p></br><p><h3>09/04/2025 - Version 2.9: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 2.8: </h3> - Optimisation pour le TT.</p></br><p><h3>07/04/2025 - Version 2.7: </h3> - mode debug.</p></br><p><h3>03/04/2025 - Version 2.6: </h3> - Mise a jour de securite.</p></br><p><h3>20/03/2025 - Version 2.5: </h3> - Visualisation distincte des couches ne se trouvant pas dans l'antenne.</p></br><p><h3>13/02/2025 - Version 2.4: </h3> - Ajoute redimensionnement et déplacement mollette.</p></br><p><h3>05/02/2025 - Version 2.3: </h3> - Bouton de visualisation des couches se trouvent uniquement dans le canva de la carte.</p></br><p><h3>07/01/2025 - Version 2.2: </h3> - ByPass du certif ssl ci erreur.</p></br><p><h3>22/10/2024 - Version 2.1:</h3> - Correctif de bug.</br> - Evolution de la limit de 3 à 5. </br></p></br><p><h3>22/10/2024 - Version 2.0:</h3> - Reformatage du code.</br></p></br><p><h3>03/10/2024 - Version 1.14:</h3> - Remonte la fênetre dans la pille.</br></p><p><h3>13/09/2024 - Version 1.13:</h3>- MAJ sur le lien du changelog</br>- Bug-fix: Ouvre MultiPolygone et Polygon séparément.</p></br><p><h3>10/09/2024 - Version 1.11:</h3>- Ouverture de table contenant plusieurs géométries.</p></br><p><h3>26/08/2024 - Version 1.10:</h3>- Ajoute d'un changelog et vérification de mise à jour.</p>
|
||||
|
||||
# deprecated flag (applies to the whole plugin, not just a single version)
|
||||
deprecated=False
|
||||
|
||||
@@ -1,185 +1,151 @@
|
||||
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'
|
||||
if os_user == 'Administrateur':
|
||||
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'
|
||||
order by schemaname;"""
|
||||
schemaname_list_ref="""SELECT schemaname,tablename 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'
|
||||
order by schemaname,tablename;"""
|
||||
schemaname_list="""(SELECT schemaname,tablename from pg_catalog.pg_tables
|
||||
where schemaname like 'trav%' or schemaname like '\_ag%' or schemaname like '\_00%' or schemaname like '\_01%' or schemaname like '\_07%' or schemaname like '\_26%' or schemaname like '\_form%' or schemaname like '\_42%' or schemaname like '\_69%' order by schemaname,tablename)
|
||||
UNION
|
||||
(SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews order by schemaname,tablename) order by schemaname,tablename;"""
|
||||
geom = "geom"
|
||||
champ_travaux_prevus_multipolygon="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
champ_travaux_prevus_multilinestring="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))"""
|
||||
champ_travaux_prevus_point = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, x_wgs84 double precision, y_wgs84 double precision, date_creation date, date_maj date, geom geometry(Point,2154))"""
|
||||
|
||||
champ_viergePolygone = """(gid serial NOT NULL, commentaire text, surface_m2 double precision, surface_ha double precision, geom geometry(MultiPolygon,2154))"""
|
||||
champ_viergeLigne = """(gid serial NOT NULL, commentaire text, longueur_m double precision, longueur_km double precision, geom geometry(MultiLineString,2154))"""
|
||||
champ_viergePoint = """(gid serial NOT NULL, commentaire text, x_wgs84 double precision, y_wgs84 double precision, geom geometry(Point,2154))"""
|
||||
|
||||
champ_habitat = """(gid serial NOT NULL, cd_cb_01 text, lb_cb97_fr_01 text, occupation_01 integer, cd_cb_02 text, lb_cb97_fr_02 text, occupation_02 integer, cd_cb_03 text, lb_cb97_fr_03 text, occupation_03 integer, milieu_code text, milieu_libelle text, surface_m2 double precision, surface_ha double precision, commentaire text, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
|
||||
champ_contour="""(gid serial NOT NULL, date_creation date, date_maj date, utilisateur character varying, dept character(2), nom character varying, surface_m2 double precision, surface_ha double precision, type_site character varying, type_milieu character varying, date_premier_pg integer, date_debut_pg integer, date_fin_pg integer, referent character varying, gestion_deleguee character varying, terrain_militaire character(3), ens character(3), zh character(3), adapt_pmr character(3), inform character(3), guide character(3), ouverture_public character(3), obs character(3), anim character(3), n2000_anim character(3), contrat_n2000_conseil character(3), n2000_op character(3), contrat_n2000_benef character(3), contrat_agri character(3), bc_habitat integer, bc_amphibien integer, bc_coleoptere integer, bc_crustace integer, bc_mammifere integer, bc_chiroptere integer, bc_mollusque integer, bc_odonate integer, bc_oiseau integer, bc_orthoptere integer, bc_poisson integer, bc_reptile integer, bc_rhopalocere integer, bc_heterocere integer, bc_autre_invertebre integer, bc_flore integer, bc_bryophyte integer, bc_champignon integer, suiv_analyse_sol character(3), suiv_piezo character(3), suiv_climat character(3), suiv_topo character(3), suiv_habitat character(3), suiv_amphibien character(3), suiv_coleoptere character(3), suiv_crustace character(3), suiv_mammifere character(3), suiv_chiroptere character(3), suiv_mollusque character(3), suiv_odonate character(3), suiv_oiseau character(3), suiv_orthoptere character(3), suiv_poisson character(3), suiv_reptile character(3), suiv_rhopalocere character(3), suiv_heterocere character(3), suiv_autre_invertebre character(3), suiv_flore character(3), suiv_bryophyte character(3), suiv_champignon character(3), suiv_analyse_eau character(3), suiv_phenologie character(3), suiv_frequentation character(3), suiv_paysager character(3), suiv_autre character(3), commentaire text, geom geometry(MultiPolygon,2154))
|
||||
"""
|
||||
|
||||
champ_vegethab_point = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(Point,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multilinestring = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiLineString,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multipolygon = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiPolygon,2154)
|
||||
)
|
||||
|
||||
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'
|
||||
order by schemaname;"""
|
||||
schemaname_list_ref="""SELECT schemaname,tablename 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'
|
||||
order by schemaname,tablename;"""
|
||||
schemaname_list="""(SELECT schemaname,tablename from pg_catalog.pg_tables
|
||||
where schemaname like 'trav%' or schemaname like '\_ag%' or schemaname like '\_00%' or schemaname like '\_01%' or schemaname like '\_07%' or schemaname like '\_26%' or schemaname like '\_form%' or schemaname like '\_42%' or schemaname like '\_69%' order by schemaname,tablename)
|
||||
UNION
|
||||
(SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews order by schemaname,tablename) order by schemaname,tablename;"""
|
||||
geom = "geom"
|
||||
champ_travaux_prevus_multipolygon="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
champ_travaux_prevus_multilinestring="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))"""
|
||||
champ_travaux_prevus_point = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, x_wgs84 double precision, y_wgs84 double precision, date_creation date, date_maj date, geom geometry(Point,2154))"""
|
||||
|
||||
champ_viergePolygone = """(gid serial NOT NULL, commentaire text, surface_m2 double precision, surface_ha double precision, geom geometry(MultiPolygon,2154))"""
|
||||
champ_viergeLigne = """(gid serial NOT NULL, commentaire text, longueur_m double precision, longueur_km double precision, geom geometry(MultiLineString,2154))"""
|
||||
champ_viergePoint = """(gid serial NOT NULL, commentaire text, x_wgs84 double precision, y_wgs84 double precision, geom geometry(Point,2154))"""
|
||||
|
||||
champ_habitat = """(gid serial NOT NULL, cd_cb_01 text, lb_cb97_fr_01 text, occupation_01 integer, cd_cb_02 text, lb_cb97_fr_02 text, occupation_02 integer, cd_cb_03 text, lb_cb97_fr_03 text, occupation_03 integer, milieu_code text, milieu_libelle text, surface_m2 double precision, surface_ha double precision, commentaire text, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
|
||||
champ_contour="""(gid serial NOT NULL, date_creation date, date_maj date, utilisateur character varying, dept character(2), nom character varying, surface_m2 double precision, surface_ha double precision, type_site character varying, type_milieu character varying, date_premier_pg integer, date_debut_pg integer, date_fin_pg integer, referent character varying, gestion_deleguee character varying, terrain_militaire character(3), ens character(3), zh character(3), adapt_pmr character(3), inform character(3), guide character(3), ouverture_public character(3), obs character(3), anim character(3), n2000_anim character(3), contrat_n2000_conseil character(3), n2000_op character(3), contrat_n2000_benef character(3), contrat_agri character(3), bc_habitat integer, bc_amphibien integer, bc_coleoptere integer, bc_crustace integer, bc_mammifere integer, bc_chiroptere integer, bc_mollusque integer, bc_odonate integer, bc_oiseau integer, bc_orthoptere integer, bc_poisson integer, bc_reptile integer, bc_rhopalocere integer, bc_heterocere integer, bc_autre_invertebre integer, bc_flore integer, bc_bryophyte integer, bc_champignon integer, suiv_analyse_sol character(3), suiv_piezo character(3), suiv_climat character(3), suiv_topo character(3), suiv_habitat character(3), suiv_amphibien character(3), suiv_coleoptere character(3), suiv_crustace character(3), suiv_mammifere character(3), suiv_chiroptere character(3), suiv_mollusque character(3), suiv_odonate character(3), suiv_oiseau character(3), suiv_orthoptere character(3), suiv_poisson character(3), suiv_reptile character(3), suiv_rhopalocere character(3), suiv_heterocere character(3), suiv_autre_invertebre character(3), suiv_flore character(3), suiv_bryophyte character(3), suiv_champignon character(3), suiv_analyse_eau character(3), suiv_phenologie character(3), suiv_frequentation character(3), suiv_paysager character(3), suiv_autre character(3), commentaire text, geom geometry(MultiPolygon,2154))
|
||||
"""
|
||||
|
||||
champ_vegethab_point = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(Point,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multilinestring = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiLineString,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multipolygon = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiPolygon,2154)
|
||||
)
|
||||
"""
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
import configparser
|
||||
import shutil
|
||||
import os
|
||||
import tempfile
|
||||
import base64
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
from os.path import abspath, join, pardir, dirname
|
||||
|
||||
from qgis.PyQt import uic
|
||||
@@ -79,6 +77,14 @@ def plugin_test_data_path(*args, copy=False):
|
||||
else:
|
||||
return path
|
||||
|
||||
def pyperclip():
|
||||
dst = dirname(dirname(__file__))+"\\tools\\"
|
||||
if os.access('N:/',os.R_OK):
|
||||
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
|
||||
try:
|
||||
shutil.copy(src, dst)
|
||||
except:
|
||||
print('404')
|
||||
|
||||
def resources_path(*args):
|
||||
"""Get the path to our resources folder.
|
||||
@@ -106,25 +112,6 @@ def load_ui(*args):
|
||||
ui_class, _ = uic.loadUiType(resources_path("ui", *args))
|
||||
|
||||
return ui_class
|
||||
|
||||
def login_base(take=None):
|
||||
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 + "')")
|
||||
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
|
||||
@@ -157,7 +144,7 @@ def maj_verif(NAME):
|
||||
|
||||
url = qgis.utils.pluginMetadata(NAME,'repository')
|
||||
#URL = url+'/raw/branch/main/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
|
||||
# print(URL)
|
||||
version = qgis.utils.pluginMetadata(NAME,'version')
|
||||
len_version = len(version)
|
||||
@@ -167,12 +154,15 @@ def maj_verif(NAME):
|
||||
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('<version>',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)
|
||||
try:
|
||||
version_web = str(urllib.request.urlopen(URL).read())
|
||||
plugin_num = version_web.find(NAME)
|
||||
valeur_version_web = version_web.find('<version>',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)
|
||||
except:
|
||||
print("error gitea version ssl")
|
||||
else:
|
||||
iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<resources>
|
||||
</resources>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@@ -65,8 +63,8 @@
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>20</y>
|
||||
<x>345</x>
|
||||
<y>10</y>
|
||||
<width>221</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
@@ -75,7 +73,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/plugins/CenRa_FLUX/logo.jpg</pixmap>
|
||||
<pixmap>:/plugins/CenRa_FLUX/logo.jpg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
@@ -139,7 +137,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/plugins/CenRa_FLUX/arrow-bottom.png</normaloff>:/plugins/CenRa_FLUX/arrow-bottom.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -162,7 +160,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/plugins/CenRa_FLUX/arrow-up.png</normaloff>:/plugins/CenRa_FLUX/arrow-up.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@@ -237,6 +235,18 @@
|
||||
<string>Flux sélectionné(s) à charger :</string>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>label_3</zorder>
|
||||
<zorder>comboBox</zorder>
|
||||
<zorder>comboBox_2</zorder>
|
||||
<zorder>pushButton_2</zorder>
|
||||
<zorder>tableWidget</zorder>
|
||||
<zorder>tableWidget_2</zorder>
|
||||
<zorder>commandLinkButton</zorder>
|
||||
<zorder>commandLinkButton_2</zorder>
|
||||
<zorder>lineEdit</zorder>
|
||||
<zorder>label</zorder>
|
||||
<zorder>label_2</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -9,243 +9,387 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>910</width>
|
||||
<height>800</height>
|
||||
<width>890</width>
|
||||
<height>810</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>910</width>
|
||||
<height>800</height>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>910</width>
|
||||
<height>800</height>
|
||||
<width>890</width>
|
||||
<height>810</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SIG CEN-RA</string>
|
||||
</property>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>130</y>
|
||||
<width>171</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>80</y>
|
||||
<width>171</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>345</x>
|
||||
<y>10</y>
|
||||
<width>221</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/plugins/CenRa_FLUX/logo.jpg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>750</y>
|
||||
<width>171</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Charger les couches</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>170</y>
|
||||
<width>850</width>
|
||||
<height>281</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="tableWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>550</y>
|
||||
<width>850</width>
|
||||
<height>181</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCommandLinkButton" name="commandLinkButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>400</x>
|
||||
<y>470</y>
|
||||
<width>61</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/plugins/CenRa_FLUX/arrow-bottom.png</normaloff>:/plugins/CenRa_FLUX/arrow-bottom.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCommandLinkButton" name="commandLinkButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>470</y>
|
||||
<width>61</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/plugins/CenRa_FLUX/arrow-up.png</normaloff>:/plugins/CenRa_FLUX/arrow-up.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>130</y>
|
||||
<width>171</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Recherche par mots-clés</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>150</y>
|
||||
<width>161</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Calibri</family>
|
||||
<pointsize>10</pointsize>
|
||||
<italic>false</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Liste des flux disponibles :</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>530</y>
|
||||
<width>171</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Calibri</family>
|
||||
<pointsize>10</pointsize>
|
||||
<italic>false</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flux sélectionné(s) à charger :</string>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>label_3</zorder>
|
||||
<zorder>comboBox</zorder>
|
||||
<zorder>comboBox_2</zorder>
|
||||
<zorder>pushButton_2</zorder>
|
||||
<zorder>tableWidget</zorder>
|
||||
<zorder>tableWidget_2</zorder>
|
||||
<zorder>commandLinkButton</zorder>
|
||||
<zorder>commandLinkButton_2</zorder>
|
||||
<zorder>lineEdit</zorder>
|
||||
<zorder>label</zorder>
|
||||
<zorder>label_2</zorder>
|
||||
<item row="0" column="0">
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>890</width>
|
||||
<height>810</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhNoEditMenu|Qt::ImhNoTextHandles</set>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>890</width>
|
||||
<height>810</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>890</width>
|
||||
<height>810</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QCommandLinkButton" name="commandLinkButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>450</x>
|
||||
<y>470</y>
|
||||
<width>61</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/plugins/CenRa_FLUX/arrow-up.png</normaloff>:/plugins/CenRa_FLUX/arrow-up.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>750</y>
|
||||
<width>171</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Charger les couches</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>150</y>
|
||||
<width>161</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Calibri</family>
|
||||
<pointsize>10</pointsize>
|
||||
<italic>false</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Liste des flux disponibles :</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="tableWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>550</y>
|
||||
<width>851</width>
|
||||
<height>181</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhNoEditMenu|Qt::ImhNoTextHandles</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>130</y>
|
||||
<width>171</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>470</x>
|
||||
<y>130</y>
|
||||
<width>171</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Recherche par mots-clés</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>660</x>
|
||||
<y>130</y>
|
||||
<width>21</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>170</y>
|
||||
<width>850</width>
|
||||
<height>281</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>530</y>
|
||||
<width>171</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Calibri</family>
|
||||
<pointsize>10</pointsize>
|
||||
<italic>false</italic>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Flux sélectionné(s) à charger :</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>335</x>
|
||||
<y>10</y>
|
||||
<width>221</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>:/plugins/CenRa_FLUX/logo.jpg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>80</y>
|
||||
<width>171</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCommandLinkButton" name="commandLinkButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>470</y>
|
||||
<width>61</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/plugins/CenRa_FLUX/arrow-bottom.png</normaloff>:/plugins/CenRa_FLUX/arrow-bottom.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>830</x>
|
||||
<y>20</y>
|
||||
<width>70</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="DeBUG">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>71</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextBrowser" name="viewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>10</y>
|
||||
<width>731</width>
|
||||
<height>731</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgba(255, 255, 255,0.50);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Metabase</string>
|
||||
<string>Journal des modifications</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
@@ -29,9 +29,6 @@
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -41,7 +38,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>547</height>
|
||||
<height>570</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
@@ -56,7 +53,7 @@
|
||||
<property name="title">
|
||||
<string>DevLog</string>
|
||||
</property>
|
||||
<widget class="QWebView" name="viewer" native="true">
|
||||
<widget class="QTextBrowser" name="viewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
@@ -65,11 +62,6 @@
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="url" stdset="0">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -78,19 +70,12 @@
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::NoButton</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtWebKitWidgets/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -1,220 +1,220 @@
|
||||
__copyright__ = "Copyright 2021, 3Liz"
|
||||
__license__ = "GPL version 3"
|
||||
__email__ = "info@3liz.org"
|
||||
|
||||
|
||||
from qgis.core import QgsApplication
|
||||
from qgis.PyQt.QtCore import QCoreApplication, Qt, QTranslator, QUrl
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon
|
||||
from qgis.PyQt.QtWidgets import QAction, QMessageBox
|
||||
from qgis.utils import iface
|
||||
import qgis
|
||||
|
||||
|
||||
#include <QSettings>
|
||||
'''
|
||||
from pg_metadata.connection_manager import (
|
||||
store_connections,
|
||||
validate_connections_names,
|
||||
)
|
||||
|
||||
|
||||
from pg_metadata.locator import LocatorFilter
|
||||
from pg_metadata.processing.provider import PgMetadataProvider
|
||||
from pg_metadata.qgis_plugin_tools.tools.custom_logging import setup_logger
|
||||
'''
|
||||
import os
|
||||
from .tools.resources import (
|
||||
plugin_path,
|
||||
resources_path,
|
||||
maj_verif,
|
||||
)
|
||||
from .dock import CenRa_Metabase
|
||||
from .editor import Metabase_Editor
|
||||
from .about_form import MetabaseAboutDialog
|
||||
#from CenRa_Metabase.issues import CenRa_Issues
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
|
||||
|
||||
|
||||
class PgMetadata:
|
||||
def __init__(self):
|
||||
""" Constructor. """
|
||||
self.dock = None
|
||||
self.editor = None
|
||||
# self.issues = None
|
||||
self.provider = None
|
||||
self.locator_filter = None
|
||||
self.dock_action = None
|
||||
self.help_action = None
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
end_find = plugin_dir.rfind('\\')+1
|
||||
global NAME
|
||||
NAME = plugin_dir[end_find:]
|
||||
maj_verif(NAME)
|
||||
|
||||
# Display About window on first use
|
||||
version = qgis.utils.pluginMetadata('CenRa_METABASE','version')
|
||||
s = QSettings()
|
||||
versionUse = s.value("metadata/version", 1, type=str)
|
||||
if str(versionUse) != str(version) :
|
||||
s.setValue("metadata/version", str(version))
|
||||
print(versionUse,version)
|
||||
self.open_about_dialog()
|
||||
# setup_logger('pg_metadata')
|
||||
|
||||
#locale, file_path = setup_translation(
|
||||
# folder=plugin_path("i18n"), file_pattern="CenRa_Metabase_{}.qm")
|
||||
#if file_path:
|
||||
# self.translator = QTranslator()
|
||||
# self.translator.load(file_path)
|
||||
# noinspection PyCallByClass,PyArgumentList
|
||||
# QCoreApplication.installTranslator(self.translator)
|
||||
|
||||
# noinspection PyPep8Naming
|
||||
#def initProcessing(self):
|
||||
#""" Add the QGIS Processing provider. """
|
||||
#if not self.provider:
|
||||
#self.provider = PgMetadataProvider()
|
||||
#QgsApplication.processingRegistry().addProvider(self.provider)
|
||||
|
||||
# noinspection PyPep8Naming
|
||||
def initGui(self):
|
||||
""" Build the plugin GUI. """
|
||||
#self.initProcessing()
|
||||
|
||||
#self.check_invalid_connection_names()
|
||||
|
||||
self.toolBar = iface.addToolBar("CenRa_Metabase")
|
||||
self.toolBar.setObjectName("CenRa_Metabase")
|
||||
|
||||
icon = QIcon(resources_path('icons', 'icon.png'))
|
||||
icon2 = QIcon(resources_path('icons', 'icon_2.png'))
|
||||
|
||||
# Open the online help
|
||||
self.help_action = QAction(icon, 'CenRa_Metabase', iface.mainWindow())
|
||||
iface.pluginHelpMenu().addAction(self.help_action)
|
||||
self.help_action.triggered.connect(self.open_help)
|
||||
if not self.editor:
|
||||
self.editor = Metabase_Editor()
|
||||
|
||||
|
||||
self.editor_action = QAction(icon2, 'CenRa_Metabase',None)
|
||||
self.toolBar.addAction(self.editor_action)
|
||||
self.editor_action.triggered.connect(self.open_editor)
|
||||
|
||||
if not self.dock:
|
||||
self.dock = CenRa_Metabase()
|
||||
iface.addDockWidget(Qt.RightDockWidgetArea, self.dock)
|
||||
|
||||
# Open/close the dock from plugin menu
|
||||
self.dock_action = QAction(icon, 'CenRa_Metabase', iface.mainWindow())
|
||||
iface.pluginMenu().addAction(self.dock_action)
|
||||
self.dock_action.triggered.connect(self.open_dock)
|
||||
# if not self.issues:
|
||||
# self.issues = CenRa_Issues()
|
||||
|
||||
|
||||
# self.issues_action = QAction(icon, 'CenRa_Metabase',None)
|
||||
# self.toolBar.addAction(self.issues_action)
|
||||
# self.issues_action.triggered.connect(self.open_issues)
|
||||
'''
|
||||
if not self.locator_filter:
|
||||
self.locator_filter = LocatorFilter(iface)
|
||||
iface.registerLocatorFilter(self.locator_filter)
|
||||
|
||||
@staticmethod
|
||||
def check_invalid_connection_names():
|
||||
""" Check for invalid connection names in the QgsSettings. """
|
||||
valid, invalid = validate_connections_names()
|
||||
n_invalid = len(invalid)
|
||||
|
||||
if n_invalid == 0:
|
||||
return
|
||||
|
||||
invalid_text = ', '.join(invalid)
|
||||
msg = QMessageBox()
|
||||
msg.setIcon(QMessageBox.Warning)
|
||||
msg.setWindowTitle(tr('PgMetadata: Database connection(s) not available'))
|
||||
msg.setText(tr(
|
||||
f'{n_invalid} connection(s) listed in PgMetadata’s settings are invalid or '
|
||||
f'no longer available: {invalid_text}'))
|
||||
msg.setInformativeText(tr(
|
||||
'Do you want to remove these connection(s) from the PgMetadata settings? '
|
||||
'(You can also do this later with the “Set Connections” tool.)'))
|
||||
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
|
||||
clicked = msg.exec()
|
||||
|
||||
if clicked == QMessageBox.Yes:
|
||||
iface.messageBar().pushSuccess('PgMetadata', tr(f'{n_invalid} invalid connection(s) removed.'))
|
||||
store_connections(valid)
|
||||
if clicked == QMessageBox.No:
|
||||
iface.messageBar().pushInfo('PgMetadata', tr(f'Keeping {n_invalid} invalid connections.'))
|
||||
'''
|
||||
def open_about_dialog(self):
|
||||
"""
|
||||
About dialog
|
||||
"""
|
||||
dialog = MetabaseAboutDialog(iface)
|
||||
dialog.exec_()
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
def open_dock(self):
|
||||
""" Open the dock. """
|
||||
self.dock.show()
|
||||
self.dock.raise_()
|
||||
|
||||
def open_editor(self):
|
||||
self.editor.show()
|
||||
self.editor.raise_()
|
||||
|
||||
# def open_issues(self):
|
||||
# self.issues.show()
|
||||
# self.issues.raise_()
|
||||
|
||||
def unload(self):
|
||||
""" Unload the plugin. """
|
||||
if self.editor:
|
||||
iface.removePluginMenu('CenRa_Metabase',self.editor_action)
|
||||
#self.editor.removeToolBarIcon(self.editor_action)
|
||||
|
||||
|
||||
|
||||
if self.dock:
|
||||
iface.removeDockWidget(self.dock)
|
||||
self.dock.deleteLater()
|
||||
|
||||
if self.provider:
|
||||
QgsApplication.processingRegistry().removeProvider(self.provider)
|
||||
del self.provider
|
||||
|
||||
if self.locator_filter:
|
||||
iface.deregisterLocatorFilter(self.locator_filter)
|
||||
del self.locator_filter
|
||||
|
||||
if self.dock_action:
|
||||
iface.pluginMenu().removeAction(self.dock_action)
|
||||
del self.dock_action
|
||||
|
||||
if self.help_action:
|
||||
iface.pluginHelpMenu().removeAction(self.help_action)
|
||||
del self.help_action
|
||||
|
||||
@staticmethod
|
||||
def run_tests(pattern='test_*.py', package=None):
|
||||
"""Run the test inside QGIS."""
|
||||
try:
|
||||
from pathlib import Path
|
||||
|
||||
from pg_metadata.qgis_plugin_tools.infrastructure.test_runner import (
|
||||
test_package,
|
||||
)
|
||||
if package is None:
|
||||
package = '{}.__init__'.format(Path(__file__).parent.name)
|
||||
test_package(package, pattern)
|
||||
except (AttributeError, ModuleNotFoundError):
|
||||
message = 'Could not load tests. Are you using a production package?'
|
||||
print(message) # NOQA
|
||||
__copyright__ = "Copyright 2021, 3Liz"
|
||||
__license__ = "GPL version 3"
|
||||
__email__ = "info@3liz.org"
|
||||
|
||||
|
||||
from qgis.core import QgsApplication
|
||||
from qgis.PyQt.QtCore import QCoreApplication, Qt, QTranslator, QUrl
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon
|
||||
from qgis.PyQt.QtWidgets import QAction, QMessageBox
|
||||
from qgis.utils import iface
|
||||
import qgis
|
||||
|
||||
|
||||
#include <QSettings>
|
||||
'''
|
||||
from pg_metadata.connection_manager import (
|
||||
store_connections,
|
||||
validate_connections_names,
|
||||
)
|
||||
|
||||
|
||||
from pg_metadata.locator import LocatorFilter
|
||||
from pg_metadata.processing.provider import PgMetadataProvider
|
||||
from pg_metadata.qgis_plugin_tools.tools.custom_logging import setup_logger
|
||||
'''
|
||||
import os
|
||||
from .tools.resources import (
|
||||
plugin_path,
|
||||
pyperclip,
|
||||
resources_path,
|
||||
maj_verif,
|
||||
)
|
||||
pyperclip()
|
||||
from .dock import CenRa_Metabase
|
||||
from .editor import Metabase_Editor
|
||||
from .about_form import MetabaseAboutDialog
|
||||
#from CenRa_Metabase.issues import CenRa_Issues
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
|
||||
class PgMetadata:
|
||||
def __init__(self):
|
||||
""" Constructor. """
|
||||
self.dock = None
|
||||
self.editor = None
|
||||
# self.issues = None
|
||||
self.provider = None
|
||||
self.locator_filter = None
|
||||
self.dock_action = None
|
||||
self.help_action = None
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
end_find = plugin_dir.rfind('\\')+1
|
||||
global NAME
|
||||
NAME = plugin_dir[end_find:]
|
||||
maj_verif(NAME)
|
||||
|
||||
# Display About window on first use
|
||||
version = qgis.utils.pluginMetadata('CenRa_METABASE','version')
|
||||
s = QSettings()
|
||||
versionUse = s.value("metadata/version", 1, type=str)
|
||||
if str(versionUse) != str(version) :
|
||||
s.setValue("metadata/version", str(version))
|
||||
print(versionUse,version)
|
||||
self.open_about_dialog()
|
||||
# setup_logger('pg_metadata')
|
||||
|
||||
#locale, file_path = setup_translation(
|
||||
# folder=plugin_path("i18n"), file_pattern="CenRa_Metabase_{}.qm")
|
||||
#if file_path:
|
||||
# self.translator = QTranslator()
|
||||
# self.translator.load(file_path)
|
||||
# noinspection PyCallByClass,PyArgumentList
|
||||
# QCoreApplication.installTranslator(self.translator)
|
||||
|
||||
# noinspection PyPep8Naming
|
||||
#def initProcessing(self):
|
||||
#""" Add the QGIS Processing provider. """
|
||||
#if not self.provider:
|
||||
#self.provider = PgMetadataProvider()
|
||||
#QgsApplication.processingRegistry().addProvider(self.provider)
|
||||
|
||||
# noinspection PyPep8Naming
|
||||
def initGui(self):
|
||||
""" Build the plugin GUI. """
|
||||
#self.initProcessing()
|
||||
|
||||
#self.check_invalid_connection_names()
|
||||
|
||||
self.toolBar = iface.addToolBar("CenRa_Metabase")
|
||||
self.toolBar.setObjectName("CenRa_Metabase")
|
||||
|
||||
icon = QIcon(resources_path('icons', 'icon.png'))
|
||||
icon2 = QIcon(resources_path('icons', 'icon_2.png'))
|
||||
|
||||
# Open the online help
|
||||
self.help_action = QAction(icon, 'CenRa_Metabase', iface.mainWindow())
|
||||
iface.pluginHelpMenu().addAction(self.help_action)
|
||||
self.help_action.triggered.connect(self.open_help)
|
||||
if not self.editor:
|
||||
self.editor = Metabase_Editor()
|
||||
|
||||
|
||||
self.editor_action = QAction(icon2, 'CenRa_Metabase',None)
|
||||
self.toolBar.addAction(self.editor_action)
|
||||
self.editor_action.triggered.connect(self.open_editor)
|
||||
|
||||
if not self.dock:
|
||||
self.dock = CenRa_Metabase()
|
||||
iface.addDockWidget(Qt.DockWidgetArea(0x2), self.dock)
|
||||
|
||||
# Open/close the dock from plugin menu
|
||||
self.dock_action = QAction(icon, 'CenRa_Metabase', iface.mainWindow())
|
||||
iface.pluginMenu().addAction(self.dock_action)
|
||||
self.dock_action.triggered.connect(self.open_dock)
|
||||
# if not self.issues:
|
||||
# self.issues = CenRa_Issues()
|
||||
|
||||
|
||||
# self.issues_action = QAction(icon, 'CenRa_Metabase',None)
|
||||
# self.toolBar.addAction(self.issues_action)
|
||||
# self.issues_action.triggered.connect(self.open_issues)
|
||||
'''
|
||||
if not self.locator_filter:
|
||||
self.locator_filter = LocatorFilter(iface)
|
||||
iface.registerLocatorFilter(self.locator_filter)
|
||||
|
||||
@staticmethod
|
||||
def check_invalid_connection_names():
|
||||
""" Check for invalid connection names in the QgsSettings. """
|
||||
valid, invalid = validate_connections_names()
|
||||
n_invalid = len(invalid)
|
||||
|
||||
if n_invalid == 0:
|
||||
return
|
||||
|
||||
invalid_text = ', '.join(invalid)
|
||||
msg = QMessageBox()
|
||||
msg.setIcon(QMessageBox.Warning)
|
||||
msg.setWindowTitle(tr('PgMetadata: Database connection(s) not available'))
|
||||
msg.setText(tr(
|
||||
f'{n_invalid} connection(s) listed in PgMetadata’s settings are invalid or '
|
||||
f'no longer available: {invalid_text}'))
|
||||
msg.setInformativeText(tr(
|
||||
'Do you want to remove these connection(s) from the PgMetadata settings? '
|
||||
'(You can also do this later with the “Set Connections” tool.)'))
|
||||
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
|
||||
clicked = msg.exec()
|
||||
|
||||
if clicked == QMessageBox.Yes:
|
||||
iface.messageBar().pushSuccess('PgMetadata', tr(f'{n_invalid} invalid connection(s) removed.'))
|
||||
store_connections(valid)
|
||||
if clicked == QMessageBox.No:
|
||||
iface.messageBar().pushInfo('PgMetadata', tr(f'Keeping {n_invalid} invalid connections.'))
|
||||
'''
|
||||
def open_about_dialog(self):
|
||||
"""
|
||||
About dialog
|
||||
"""
|
||||
dialog = MetabaseAboutDialog(iface)
|
||||
dialog.exec()
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
def open_dock(self):
|
||||
""" Open the dock. """
|
||||
self.dock.show()
|
||||
self.dock.raise_()
|
||||
|
||||
def open_editor(self):
|
||||
self.editor.show()
|
||||
self.editor.raise_()
|
||||
|
||||
# def open_issues(self):
|
||||
# self.issues.show()
|
||||
# self.issues.raise_()
|
||||
|
||||
def unload(self):
|
||||
""" Unload the plugin. """
|
||||
#if self.editor:
|
||||
#iface.removePluginMenu('CenRa_Metabase',self.editor_action)
|
||||
#self.editor.removeToolBarIcon(self.editor_action)
|
||||
|
||||
if self.dock:
|
||||
iface.removeDockWidget(self.dock)
|
||||
self.dock.deleteLater()
|
||||
|
||||
if self.provider:
|
||||
QgsApplication.processingRegistry().removeProvider(self.provider)
|
||||
del self.provider
|
||||
|
||||
if self.locator_filter:
|
||||
iface.deregisterLocatorFilter(self.locator_filter)
|
||||
del self.locator_filter
|
||||
|
||||
if self.help_action:
|
||||
iface.pluginHelpMenu().removeAction(self.help_action)
|
||||
del self.help_action
|
||||
|
||||
if self.dock_action:
|
||||
iface.pluginMenu().removeAction(self.dock_action)
|
||||
del self.dock_action
|
||||
|
||||
|
||||
@staticmethod
|
||||
def run_tests(pattern='test_*.py', package=None):
|
||||
"""Run the test inside QGIS."""
|
||||
try:
|
||||
from pathlib import Path
|
||||
|
||||
from pg_metadata.qgis_plugin_tools.infrastructure.test_runner import (
|
||||
test_package,
|
||||
)
|
||||
if package is None:
|
||||
package = '{}.__init__'.format(Path(__file__).parent.name)
|
||||
test_package(package, pattern)
|
||||
except (AttributeError, ModuleNotFoundError):
|
||||
message = 'Could not load tests. Are you using a production package?'
|
||||
print(message) # NOQA
|
||||
@@ -12,11 +12,10 @@ ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
os.path.join(
|
||||
str(Path(__file__).resolve().parent),
|
||||
'tools/ui',
|
||||
'CenRa_Metabase_about_form.ui'
|
||||
'CenRa_about_form.ui'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class MetabaseAboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
@@ -1,488 +1,498 @@
|
||||
"""Dock file."""
|
||||
|
||||
__copyright__ = 'Copyright 2020, 3Liz'
|
||||
__license__ = 'GPL version 3'
|
||||
__email__ = 'info@3liz.org'
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from collections import namedtuple
|
||||
from enum import Enum
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from xml.dom.minidom import parseString
|
||||
|
||||
from qgis.core import (
|
||||
NULL,
|
||||
QgsApplication,
|
||||
QgsDataSourceUri,
|
||||
QgsProject,
|
||||
QgsProviderConnectionException,
|
||||
QgsProviderRegistry,
|
||||
QgsRasterLayer,
|
||||
QgsSettings,
|
||||
QgsVectorLayer,
|
||||
)
|
||||
from qgis.PyQt.QtCore import QLocale, QUrl
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon
|
||||
from qgis.PyQt.QtPrintSupport import QPrinter
|
||||
from qgis.PyQt.QtWebKitWidgets import QWebPage
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
QDialog,
|
||||
QAction,
|
||||
QDockWidget,
|
||||
QFileDialog,
|
||||
QInputDialog,
|
||||
QMenu,
|
||||
QToolButton,
|
||||
)
|
||||
from qgis.gui import *
|
||||
from qgis.utils import iface
|
||||
'''
|
||||
from pg_metadata.connection_manager import (
|
||||
check_pgmetadata_is_installed,
|
||||
connections_list,
|
||||
settings_connections_names,
|
||||
)
|
||||
'''
|
||||
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
login_base,
|
||||
)
|
||||
|
||||
DOCK_CLASS = load_ui('CenRa_Metabase_dockwidget_base.ui')
|
||||
LOGGER = logging.getLogger('CenRa_Metabase')
|
||||
|
||||
|
||||
class Format(namedtuple('Format', ['label', 'ext'])):
|
||||
""" Format available for exporting metadata. """
|
||||
pass
|
||||
|
||||
|
||||
class OutputFormats(Format, Enum):
|
||||
""" Output format for a metadata sheet. """
|
||||
PDF = Format(label='PDF', ext='pdf')
|
||||
HTML = Format(label='HTML', ext='html')
|
||||
DCAT = Format(label='DCAT', ext='xml')
|
||||
|
||||
|
||||
class CenRa_Metabase(QDockWidget, DOCK_CLASS):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
_ = parent
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self.settings = QgsSettings()
|
||||
|
||||
self.current_datasource_uri = None
|
||||
self.current_connection = None
|
||||
|
||||
self.viewer.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
|
||||
self.viewer.page().linkClicked.connect(self.open_link)
|
||||
|
||||
# Help button
|
||||
self.external_help.setText('')
|
||||
self.external_help.setIcon(QIcon(QgsApplication.iconPath('mActionHelpContents.svg')))
|
||||
self.external_help.clicked.connect(self.open_external_help)
|
||||
|
||||
# Flat table button
|
||||
self.flatten_dataset_table.setText('')
|
||||
#self.flatten_dataset_table.setToolTip(tr("Add the catalog table"))
|
||||
self.flatten_dataset_table.setIcon(QgsApplication.getThemeIcon("/mActionAddHtml.svg"))
|
||||
#self.flatten_dataset_table.clicked.connect(self.add_flatten_dataset_table)
|
||||
|
||||
# Settings menu
|
||||
self.config.setAutoRaise(True)
|
||||
#self.config.setToolTip(tr("Settings"))
|
||||
self.config.setPopupMode(QToolButton.InstantPopup)
|
||||
self.config.setIcon(QgsApplication.getThemeIcon("/mActionOptions.svg"))
|
||||
|
||||
self.auto_open_dock_action = QAction(
|
||||
("Dommage, cette option n'existe pas encore."),
|
||||
iface.mainWindow())
|
||||
self.auto_open_dock_action.setCheckable(True)
|
||||
self.auto_open_dock_action.setChecked(
|
||||
self.settings.value("pgmetadata/auto_open_dock", True, type=bool)
|
||||
)
|
||||
self.auto_open_dock_action.triggered.connect(self.save_auto_open_dock)
|
||||
menu = QMenu()
|
||||
menu.addAction(self.auto_open_dock_action)
|
||||
self.config.setMenu(menu)
|
||||
|
||||
# Setting PDF/HTML menu
|
||||
self.save_button.setAutoRaise(True)
|
||||
#self.save_button.setToolTip(tr("Save metadata"))
|
||||
self.save_button.setPopupMode(QToolButton.InstantPopup)
|
||||
self.save_button.setIcon(QIcon(QgsApplication.iconPath('mActionFileSave.svg')))
|
||||
|
||||
self.save_as_pdf = QAction(
|
||||
('Enregistrer en PDF') + '…',
|
||||
iface.mainWindow())
|
||||
self.save_as_pdf.triggered.connect(partial(self.export_dock_content, OutputFormats.PDF))
|
||||
|
||||
self.save_as_html = QAction(
|
||||
('Enregistrer en HTML') + '…',
|
||||
iface.mainWindow())
|
||||
self.save_as_html.triggered.connect(partial(self.export_dock_content, OutputFormats.HTML))
|
||||
self.save_as_dcat = QAction(
|
||||
('Enregistrer en DCAT') + '…',
|
||||
iface.mainWindow())
|
||||
self.save_as_dcat.triggered.connect(partial(self.export_dock_content, OutputFormats.DCAT))
|
||||
|
||||
self.menu_save = QMenu()
|
||||
self.menu_save.addAction(self.save_as_pdf)
|
||||
self.menu_save.addAction(self.save_as_html)
|
||||
self.menu_save.addAction(self.save_as_dcat)
|
||||
self.save_button.setMenu(self.menu_save)
|
||||
self.save_button.setEnabled(False)
|
||||
|
||||
self.metadata = QgsProviderRegistry.instance().providerMetadata('postgres')
|
||||
|
||||
# Display message in the dock
|
||||
#if not settings_connections_names():
|
||||
#self.default_html_content_not_installed()
|
||||
#else:
|
||||
self.default_html_content_not_pg_layer()
|
||||
|
||||
iface.layerTreeView().currentLayerChanged.connect(self.layer_changed)
|
||||
|
||||
if iface.activeLayer():
|
||||
layer=iface.activeLayer()
|
||||
iface.layerTreeView().setCurrentLayer(None)
|
||||
iface.layerTreeView().setCurrentLayer(layer)
|
||||
|
||||
def export_dock_content(self, output_format: OutputFormats):
|
||||
""" Export the current displayed metadata sheet to the given format. """
|
||||
layer_name = iface.activeLayer().name()
|
||||
|
||||
file_path = os.path.join(
|
||||
os.environ['USERPROFILE'],
|
||||
'Desktop\\{name}.{ext}'.format(name=layer_name, ext=output_format.ext)
|
||||
)
|
||||
output_file = QFileDialog.getSaveFileName(
|
||||
self,
|
||||
("Enregistrer en {format}").format(format=output_format.label),
|
||||
file_path,
|
||||
"{label} (*.{ext})".format(
|
||||
label=output_format.label,
|
||||
ext=output_format.ext,
|
||||
)
|
||||
)
|
||||
if output_file[0] == '':
|
||||
return
|
||||
|
||||
self.settings.setValue("UI/lastFileNameWidgetDir", os.path.dirname(output_file[0]))
|
||||
|
||||
output_file_path = output_file[0]
|
||||
parent_folder = str(Path(output_file_path).parent)
|
||||
|
||||
if output_format == OutputFormats.PDF:
|
||||
printer = QPrinter()
|
||||
printer.setOutputFormat(QPrinter.PdfFormat)
|
||||
printer.setPageMargins(20, 20, 20, 20, QPrinter.Millimeter)
|
||||
printer.setOutputFileName(output_file_path)
|
||||
self.viewer.print(printer)
|
||||
iface.messageBar().pushSuccess(
|
||||
("Export PDF"),
|
||||
(
|
||||
"The metadata has been exported as PDF successfully in "
|
||||
"<a href=\"{}\">{}</a>").format(parent_folder, output_file_path)
|
||||
)
|
||||
|
||||
elif output_format in [OutputFormats.HTML,OutputFormats.DCAT]:
|
||||
if output_format == OutputFormats.HTML:
|
||||
data_str = self.viewer.page().currentFrame().toHtml()
|
||||
else:
|
||||
layer = iface.activeLayer()
|
||||
uri = layer.dataProvider().uri()
|
||||
dataall = self.sql_info(uri)
|
||||
data = self.sql_to_xml(dataall)
|
||||
|
||||
with open(resources_path('xml', 'dcat.xml'), encoding='utf8') as xml_file:
|
||||
xml_template = xml_file.read()
|
||||
|
||||
xml = parseString(xml_template.format(language=data[0][0], content=data[0][1]))
|
||||
|
||||
data_str = xml.toprettyxml()
|
||||
|
||||
with open(output_file[0], "w", encoding='utf8') as file_writer:
|
||||
file_writer.write(data_str)
|
||||
iface.messageBar().pushSuccess(
|
||||
("Export") + ' ' + output_format.label,
|
||||
(
|
||||
"The metadata has been exported as {format} successfully in "
|
||||
"<a href=\"{folder}\">{path}</a>").format(
|
||||
format=output_format.label, folder=parent_folder, path=output_file_path)
|
||||
)
|
||||
|
||||
def save_auto_open_dock(self):
|
||||
""" Save settings about the dock. """
|
||||
self.settings.setValue("pgmetadata/auto_open_dock", self.auto_open_dock_action.isChecked())
|
||||
def sql_to_xml(self,dataall):
|
||||
distribution=''
|
||||
for y in dataall[1]:
|
||||
distribution = distribution + (
|
||||
'<dcat:distribution>'+
|
||||
'<dcat:Distribution>'+
|
||||
'<dct:title>{data}</dct:title>'.format(data=y[0])+
|
||||
'<dcat:downloadURL>{data}</dcat:downloadURL>'.format(data=y[1])+
|
||||
'<dcat:mediaType>{data}</dcat:mediaType>'.format(data=y[2])+
|
||||
'<dct:format>{data}</dct:format>'.format(data=y[3])+
|
||||
'<dct:bytesize>{data}</dct:bytesize>'.format(data=y[4])+
|
||||
'</dcat:Distribution>'+
|
||||
'</dcat:distribution>')
|
||||
publisher=''
|
||||
for z in dataall[2]:
|
||||
publisher = publisher + (
|
||||
'<dct:publisher>'+
|
||||
'<foaf:Organization>'+
|
||||
'<foaf:name>{data}</foaf:name>'.format(data=z[1])+
|
||||
'<foaf:mbox>{data}</foaf:mbox>'.format(data=z[3])+
|
||||
'</foaf:Organization>'+
|
||||
'</dct:publisher>')
|
||||
data_str = [[dataall[0][26],
|
||||
'<dct:identifier>{data}</dct:identifier>'.format(data=dataall[0][1])+
|
||||
'<dct:title>{data}</dct:title>'.format(data=dataall[0][4])+
|
||||
'<dct:description>{data}</dct:description>'.format(data=dataall[0][5])+
|
||||
'<dct:language>{data}</dct:language>'.format(data=dataall[0][26])+
|
||||
'<dct:spatial>{data}</dct:spatial>'.format(data=dataall[0][28])+
|
||||
'<dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">{data}</dct:created>'.format(data=dataall[0][20])+
|
||||
'<dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">{data}</dct:issued>'.format(data=dataall[0][11])+
|
||||
'<dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">{data}</dct:modified>'.format(data=dataall[0][21])+
|
||||
'<dct:license>{data}</dct:license>'.format(data=dataall[0][13])+
|
||||
distribution+
|
||||
publisher+
|
||||
'<dcat:theme>{data}</dcat:theme>'.format(data=", ".join(str(x) for x in dataall[0][24]))+
|
||||
'<dcat:keyword>{data}</dcat:keyword>'.format(data=", ".join(str(x) for x in dataall[0][6]))+
|
||||
'<dct:accrualPeriodicity>{data}</dct:accrualPeriodicity>'.format(data=dataall[0][12])]]
|
||||
|
||||
return data_str
|
||||
|
||||
@staticmethod
|
||||
def sql_for_layer(uri, output_format: OutputFormats):
|
||||
""" Get the SQL query for a given layer and output format. """
|
||||
locale = QgsSettings().value("locale/userLocale", QLocale().name())
|
||||
locale = locale.split('_')[0].lower()
|
||||
|
||||
if output_format == [OutputFormats.HTML,OutputFormats.DCAT]:
|
||||
sql = (
|
||||
"SELECT pgmetadata.get_dataset_item_html_content('{schema}', '{table}', '{locale}');"
|
||||
).format(schema=uri.schema(), table=uri.table(), locale=locale)
|
||||
else:
|
||||
raise NotImplementedError('Output format is not yet implemented.')
|
||||
|
||||
return sql
|
||||
|
||||
def layer_changed(self, layer):
|
||||
""" When the layer has changed in the legend, we must check this new layer. """
|
||||
self.current_datasource_uri = None
|
||||
self.current_connection = None
|
||||
self.ce_trouve_dans_psql(layer)
|
||||
|
||||
|
||||
def add_flatten_dataset_table(self):
|
||||
""" Add a flatten dataset table with all links and contacts. """
|
||||
'''
|
||||
connections, message = connections_list()
|
||||
if not connections:
|
||||
LOGGER.critical(message)
|
||||
self.set_html_content('PgMetadata', message)
|
||||
return
|
||||
|
||||
if len(connections) > 1:
|
||||
dialog = QInputDialog()
|
||||
dialog.setComboBoxItems(connections)
|
||||
dialog.setWindowTitle(tr("Database"))
|
||||
dialog.setLabelText(tr("Choose the database to add the catalog"))
|
||||
if not dialog.exec_():
|
||||
return
|
||||
connection_name = dialog.textValue()
|
||||
else:
|
||||
connection_name = connections[0]
|
||||
|
||||
metadata = QgsProviderRegistry.instance().providerMetadata('postgres')
|
||||
connection = metadata.findConnection(connection_name)
|
||||
|
||||
locale = QgsSettings().value("locale/userLocale", QLocale().name())
|
||||
locale = locale.split('_')[0].lower()
|
||||
|
||||
uri = QgsDataSourceUri(connection.uri())
|
||||
uri.setTable(f'(SELECT * FROM pgmetadata.export_datasets_as_flat_table(\'{locale}\'))')
|
||||
uri.setKeyColumn('uid')
|
||||
|
||||
layer = QgsVectorLayer(uri.uri(), '{} - {}'.format(tr("Catalog"), connection_name), 'postgres')
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
'''
|
||||
|
||||
@staticmethod
|
||||
def open_external_help():
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
@staticmethod
|
||||
def open_link(url):
|
||||
QDesktopServices.openUrl(url)
|
||||
|
||||
def set_html_content(self, title=None, body=None):
|
||||
""" Set the content in the dock. """
|
||||
#link_logo=resources_path('icons', 'CEN_RA.png')
|
||||
css_file = resources_path('css', 'dock.css')
|
||||
with open(css_file, 'r', encoding='utf8') as f:
|
||||
css = f.read()
|
||||
|
||||
html = '<html><head>'
|
||||
#html += '<script src="http://ignf.github.io/geoportal-sdk/latest/dist/2d/GpSDK2D.js" defer ></script>'
|
||||
html += '<style>{css}</style></head><body>'.format(css=css)
|
||||
#html += '<link rel="stylesheet" href="http://ignf.github.io/geoportal-sdk/latest/dist/2d/GpSDK2D.css" >'
|
||||
#html += '<script src="file:///C:/Users/tlaveille/Desktop/maps.js" defer></script>'
|
||||
#html += '<noscript>Your browser does not support JavaScript!</noscript>'
|
||||
if title:
|
||||
html += '<h2>{title} <img class=logo src=https://i2.wp.com/www.cen-rhonealpes.fr/wp-content/uploads/2013/04/cen-rhonealpes-couleurs1.jpg?w=340&ssl=1></h2>'.format(title=title)
|
||||
if body:
|
||||
html += body
|
||||
|
||||
html += '</body></html>'
|
||||
|
||||
# It must be a file, even if it does not exist on the file system.
|
||||
base_url = QUrl.fromLocalFile(resources_path('images', 'must_be_a_file.png'))
|
||||
self.viewer.setHtml(html, base_url)
|
||||
|
||||
def ce_trouve_dans_psql(self,layer):
|
||||
try:
|
||||
uri = layer.dataProvider().uri()
|
||||
except:
|
||||
self.default_html_content_not_pg_layer()
|
||||
self.save_button.setEnabled(False)
|
||||
uri=''
|
||||
if uri != '':
|
||||
if not uri.table():
|
||||
layertype = layer.providerType().lower()
|
||||
if layertype == 'wms' or layertype == 'wfs':
|
||||
self.set_html_to_wms(layer)
|
||||
else:
|
||||
self.default_html_content_not_pg_layer()
|
||||
self.save_button.setEnabled(False)
|
||||
else:
|
||||
data_count = self.sql_check(uri)
|
||||
#print(data_count)
|
||||
if data_count == 0:
|
||||
self.default_html_content_not_metadata()
|
||||
self.save_button.setEnabled(False)
|
||||
else:
|
||||
self.build_html_content(layer,uri)
|
||||
self.save_button.setEnabled(True)
|
||||
|
||||
def build_html_content(self,layer,uri):
|
||||
body = ''
|
||||
|
||||
dataall=self.sql_info(uri)
|
||||
data=dataall[0]
|
||||
data_url=dataall[1]
|
||||
data_contact=dataall[2]
|
||||
#print(len(data_url))
|
||||
data_collonne=[field.name() for field in layer.dataProvider().fields()]
|
||||
|
||||
body += '<div><h3>Identification</h3><table class="table table-condensed">'
|
||||
body += '<tr><th>Titre</th><td>{data[4]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Description</th><td>{data[5]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Categories</th><td>{data}</td></tr>'.format(data=(", ".join(str(x) for x in data[6])))
|
||||
body += '<tr><th>Thèmes</th><td>{data}</td></tr>'.format(data=(", ".join(str(x) for x in data[24])))
|
||||
body += '<tr><th>Mots-clés</th><td>{data[7]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Dernier mise à jour</th><td>{data[23]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Langue</th><td>{data[26]}</td></tr>'.format(data=data)
|
||||
body += '</table></div>'
|
||||
|
||||
body += '<div><h3>Properties spatial</h3><table class="table table-condensed">'
|
||||
body += '<tr><th>Niveau</th><td>{data[8]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Echelle minimum</th><td>{data[9]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Echelle maximum</th><td>{data[10]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Nombre d\'entités </th><td>{data[15]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Type de géométrie</th><td>{data[16]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Nom de projection</th><td>{data[17]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>ID de projection</th><td>{data[18]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Emprise</th><td>{data[28]}</td></tr>'.format(data=data)
|
||||
body += '</table></div>'
|
||||
|
||||
#body += '<div id="map"></div>'
|
||||
|
||||
body += '<div><h3>Publication</h3><table class="table table-condensed">'
|
||||
body += '<tr><th>Date</th><td>{data[11]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Fréquence de mise à jour</th><td>{data[12]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Licence</th><td>{data[13]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Licence attribué</th><td>{data[25]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Restriction</th><td>{data[14]}</td></tr>'.format(data=data)
|
||||
body += '</table></div>'
|
||||
|
||||
body += '<div><h3>Lien</h3><table class="table table-condensed table-striped table-bordered">'
|
||||
body += '<tr><th>Type</th><th>URL</th><th>Type MIME</th><th>Format</th><th>Taille</th></tr>'
|
||||
for value_url in data_url:
|
||||
body += '<tr><td>{value_url[0]}</td><td>{value_url[1]}</td><td>{value_url[2]}</td><td>{value_url[3]}</td><td>{value_url[4]}</td></tr>'.format(value_url=value_url)
|
||||
body += '</table></div>'
|
||||
'''
|
||||
body += '<div><h3>Liste des champs</h3><table class="table table-condensed table-striped table-bordered">'
|
||||
for collonne in data_collonne:
|
||||
body += '<tr><th>{collonne}</th><td>{defini}</td></tr>'.format(collonne=collonne,defini='')
|
||||
body += '</table></div>'
|
||||
'''
|
||||
body += '<div><h3>Contacts</h3><table class="table table-condensed table-striped table-bordered">'
|
||||
body += '<tr><th>Rôle</th><th>Nom</th><th>Organisation</th><th>Email</th><th>Télèphone</th></tr>'
|
||||
for value_contact in data_contact:
|
||||
body += '<tr><td>{value_contact[0]}</td><td>{value_contact[1]}</td><td>{value_contact[2]}</td><td>{value_contact[3]}</td><td>{value_contact[4]}</td></tr>'.format(value_contact=value_contact)
|
||||
body += '</table></div>'
|
||||
|
||||
body += '<div><h3>Metadata</h3><table class="table table-condensed">'
|
||||
body += '<tr><th>Table</th><td>{data[2]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Schema</th><td>{data[3]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Date de création</th><td>{data[20]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Date de modification</th><td>{data[21]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Encodage</th><td>{data[27]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>UUID</th><td>{data[1]}</td></tr>'.format(data=data)
|
||||
body += '</table></div>'
|
||||
|
||||
self.set_html_content(
|
||||
layer.name(), body)
|
||||
|
||||
def set_html_to_wms(self,layer):
|
||||
self.set_html_content(
|
||||
'CenRa Metadata',(layer.htmlMetadata()))
|
||||
def default_html_content_not_pg_layer(self):
|
||||
""" When it's not a PostgreSQL layer. """
|
||||
self.set_html_content(
|
||||
'CenRa Metadata', ('Vous devez cliquer sur une couche dans la légende qui est stockée dans PostgreSQL.'))
|
||||
def default_html_content_not_metadata(self):
|
||||
self.set_html_content(
|
||||
'CenRa Metadata', ('La couche ne contien pas de métadonnée.'))
|
||||
|
||||
def sql_check(self,uri):
|
||||
cur=login_base()
|
||||
table = uri.table()
|
||||
schema = uri.schema()
|
||||
|
||||
sql_count = """SELECT count(uid) FROM metadata.dataset
|
||||
WHERE schema_name LIKE '"""+schema+"""' AND table_name LIKE '"""+table+"""';"""
|
||||
|
||||
cur.execute(sql_count)
|
||||
data_count = cur.fetchall()
|
||||
cur.close()
|
||||
return data_count[0][0]
|
||||
|
||||
def sql_info(self,uri):
|
||||
cur=login_base()
|
||||
table = uri.table()
|
||||
schema = uri.schema()
|
||||
#[s for s in iface.activeLayer().source().split(" ") if "dbname" in s][0].split("'")[1]
|
||||
sql_find = """SELECT *,right(left(st_astext(geom,2),-2),-9) FROM metadata.dataset
|
||||
WHERE schema_name LIKE '"""+schema+"""' AND table_name LIKE '"""+table+"""';"""
|
||||
cur.execute(sql_find)
|
||||
data_general = cur.fetchall()
|
||||
sql_findurl = """SELECT type,url,mime,format,taille FROM metadata.dataurl WHERE schema_name LIKE '"""+schema+"""' AND table_name LIKE '"""+table+"""';"""
|
||||
cur.execute(sql_findurl)
|
||||
data_url = cur.fetchall()
|
||||
sql_findcontact = """SELECT role,nom,organisation,email,telephone FROM metadata.datacontact WHERE schema_name LIKE '"""+schema+"""' AND table_name LIKE '"""+table+"""';"""
|
||||
cur.execute(sql_findcontact)
|
||||
data_contact = cur.fetchall()
|
||||
cur.close()
|
||||
return data_general[0],data_url,data_contact
|
||||
|
||||
"""Dock file."""
|
||||
|
||||
__copyright__ = 'Copyright 2020, 3Liz'
|
||||
__license__ = 'GPL version 3'
|
||||
__email__ = 'info@3liz.org'
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from collections import namedtuple
|
||||
from enum import Enum
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from xml.dom.minidom import parseString
|
||||
|
||||
from qgis.core import (
|
||||
NULL,
|
||||
QgsApplication,
|
||||
QgsDataSourceUri,
|
||||
QgsProject,
|
||||
QgsProviderConnectionException,
|
||||
QgsProviderRegistry,
|
||||
QgsRasterLayer,
|
||||
QgsSettings,
|
||||
QgsVectorLayer,
|
||||
)
|
||||
from qgis.PyQt.QtCore import QLocale, QUrl
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon
|
||||
from qgis.PyQt.QtPrintSupport import QPrinter
|
||||
#from qgis.PyQt.QtWebKitWidgets import QWebPage
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
QDialog,
|
||||
QAction,
|
||||
QDockWidget,
|
||||
QFileDialog,
|
||||
QInputDialog,
|
||||
QMenu,
|
||||
QToolButton,
|
||||
)
|
||||
from qgis.gui import *
|
||||
from qgis.utils import iface
|
||||
import qgis
|
||||
'''
|
||||
from pg_metadata.connection_manager import (
|
||||
check_pgmetadata_is_installed,
|
||||
connections_list,
|
||||
settings_connections_names,
|
||||
)
|
||||
'''
|
||||
try:
|
||||
from .tools.PythonSQL import login_base
|
||||
except:
|
||||
print('Pas de fichier PythonSQL')
|
||||
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
)
|
||||
|
||||
DOCK_CLASS = load_ui('CenRa_Metabase_dockwidget_base.ui')
|
||||
LOGGER = logging.getLogger('CenRa_Metabase')
|
||||
|
||||
|
||||
class Format(namedtuple('Format', ['label', 'ext'])):
|
||||
""" Format available for exporting metadata. """
|
||||
pass
|
||||
|
||||
|
||||
class OutputFormats(Format, Enum):
|
||||
""" Output format for a metadata sheet. """
|
||||
PDF = Format(label='PDF', ext='pdf')
|
||||
HTML = Format(label='HTML', ext='html')
|
||||
DCAT = Format(label='DCAT', ext='xml')
|
||||
|
||||
|
||||
class CenRa_Metabase(QDockWidget, DOCK_CLASS):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
_ = parent
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self.settings = QgsSettings()
|
||||
|
||||
self.current_datasource_uri = None
|
||||
self.current_connection = None
|
||||
|
||||
#self.viewer.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
|
||||
#self.viewer.page().linkClicked.connect(self.open_link)
|
||||
|
||||
# Help button
|
||||
self.external_help.setText('')
|
||||
self.external_help.setIcon(QIcon(QgsApplication.iconPath('mActionHelpContents.svg')))
|
||||
self.external_help.clicked.connect(self.open_external_help)
|
||||
|
||||
# Flat table button
|
||||
self.flatten_dataset_table.setText('')
|
||||
#self.flatten_dataset_table.setToolTip(tr("Add the catalog table"))
|
||||
self.flatten_dataset_table.setIcon(QgsApplication.getThemeIcon("/mActionAddHtml.svg"))
|
||||
#self.flatten_dataset_table.clicked.connect(self.add_flatten_dataset_table)
|
||||
|
||||
# Settings menu
|
||||
self.config.setAutoRaise(True)
|
||||
#self.config.setToolTip(tr("Settings"))
|
||||
self.config.setPopupMode(QToolButton.ToolButtonPopupMode(2))
|
||||
self.config.setIcon(QgsApplication.getThemeIcon("/mActionOptions.svg"))
|
||||
|
||||
self.auto_open_dock_action = QAction(
|
||||
("Dommage, cette option n'existe pas encore."),
|
||||
iface.mainWindow())
|
||||
self.auto_open_dock_action.setCheckable(True)
|
||||
self.auto_open_dock_action.setChecked(
|
||||
self.settings.value("pgmetadata/auto_open_dock", True, type=bool)
|
||||
)
|
||||
self.auto_open_dock_action.triggered.connect(self.save_auto_open_dock)
|
||||
menu = QMenu()
|
||||
menu.addAction(self.auto_open_dock_action)
|
||||
self.config.setMenu(menu)
|
||||
|
||||
# Setting PDF/HTML menu
|
||||
self.save_button.setAutoRaise(True)
|
||||
#self.save_button.setToolTip(tr("Save metadata"))
|
||||
self.save_button.setPopupMode(QToolButton.ToolButtonPopupMode(2))
|
||||
self.save_button.setIcon(QIcon(QgsApplication.iconPath('mActionFileSave.svg')))
|
||||
|
||||
self.save_as_pdf = QAction(
|
||||
('Enregistrer en PDF') + '…',
|
||||
iface.mainWindow())
|
||||
self.save_as_pdf.triggered.connect(partial(self.export_dock_content, OutputFormats.PDF))
|
||||
|
||||
self.save_as_html = QAction(
|
||||
('Enregistrer en HTML') + '…',
|
||||
iface.mainWindow())
|
||||
self.save_as_html.triggered.connect(partial(self.export_dock_content, OutputFormats.HTML))
|
||||
self.save_as_dcat = QAction(
|
||||
('Enregistrer en DCAT') + '…',
|
||||
iface.mainWindow())
|
||||
self.save_as_dcat.triggered.connect(partial(self.export_dock_content, OutputFormats.DCAT))
|
||||
|
||||
self.menu_save = QMenu()
|
||||
self.menu_save.addAction(self.save_as_pdf)
|
||||
self.menu_save.addAction(self.save_as_html)
|
||||
self.menu_save.addAction(self.save_as_dcat)
|
||||
self.save_button.setMenu(self.menu_save)
|
||||
self.save_button.setEnabled(False)
|
||||
|
||||
self.metadata = QgsProviderRegistry.instance().providerMetadata('postgres')
|
||||
|
||||
# Display message in the dock
|
||||
#if not settings_connections_names():
|
||||
#self.default_html_content_not_installed()
|
||||
#else:
|
||||
self.default_html_content_not_pg_layer()
|
||||
|
||||
try:
|
||||
login_base()
|
||||
iface.layerTreeView().currentLayerChanged.connect(self.layer_changed)
|
||||
except:
|
||||
#qgis.utils.plugins['CenRa_METABASE'].initGui()
|
||||
qgis.utils.plugins['CenRa_METABASE'].unload()
|
||||
#self.default_html_content_not_pg_layer()
|
||||
|
||||
if iface.activeLayer():
|
||||
layer=iface.activeLayer()
|
||||
iface.layerTreeView().setCurrentLayer(None)
|
||||
iface.layerTreeView().setCurrentLayer(layer)
|
||||
|
||||
def export_dock_content(self, output_format: OutputFormats):
|
||||
""" Export the current displayed metadata sheet to the given format. """
|
||||
layer_name = iface.activeLayer().name()
|
||||
|
||||
file_path = os.path.join(
|
||||
os.environ['USERPROFILE'],
|
||||
'Desktop\\{name}.{ext}'.format(name=layer_name, ext=output_format.ext)
|
||||
)
|
||||
output_file = QFileDialog.getSaveFileName(
|
||||
self,
|
||||
("Enregistrer en {format}").format(format=output_format.label),
|
||||
file_path,
|
||||
"{label} (*.{ext})".format(
|
||||
label=output_format.label,
|
||||
ext=output_format.ext,
|
||||
)
|
||||
)
|
||||
if output_file[0] == '':
|
||||
return
|
||||
|
||||
self.settings.setValue("UI/lastFileNameWidgetDir", os.path.dirname(output_file[0]))
|
||||
|
||||
output_file_path = output_file[0]
|
||||
parent_folder = str(Path(output_file_path).parent)
|
||||
|
||||
if output_format == OutputFormats.PDF:
|
||||
printer = QPrinter()
|
||||
printer.setOutputFormat(QPrinter.OutputFormat(1))
|
||||
#printer.setPageMargins(20,20,20,20,QPrinter.Unit(0))
|
||||
printer.setOutputFileName(output_file_path)
|
||||
self.viewer.print(printer)
|
||||
iface.messageBar().pushSuccess(
|
||||
("Export PDF"),
|
||||
(
|
||||
"The metadata has been exported as PDF successfully in "
|
||||
"<a href=\"{}\">{}</a>").format(parent_folder, output_file_path)
|
||||
)
|
||||
|
||||
elif output_format in [OutputFormats.HTML,OutputFormats.DCAT]:
|
||||
if output_format == OutputFormats.HTML:
|
||||
data_str = self.viewer.page().currentFrame().toHtml()
|
||||
else:
|
||||
layer = iface.activeLayer()
|
||||
uri = layer.dataProvider().uri()
|
||||
dataall = self.sql_info(uri)
|
||||
data = self.sql_to_xml(dataall)
|
||||
|
||||
with open(resources_path('xml', 'dcat.xml'), encoding='utf8') as xml_file:
|
||||
xml_template = xml_file.read()
|
||||
|
||||
xml = parseString(xml_template.format(language=data[0][0], content=data[0][1]))
|
||||
|
||||
data_str = xml.toprettyxml()
|
||||
|
||||
with open(output_file[0], "w", encoding='utf8') as file_writer:
|
||||
file_writer.write(data_str)
|
||||
iface.messageBar().pushSuccess(
|
||||
("Export") + ' ' + output_format.label,
|
||||
(
|
||||
"The metadata has been exported as {format} successfully in "
|
||||
"<a href=\"{folder}\">{path}</a>").format(
|
||||
format=output_format.label, folder=parent_folder, path=output_file_path)
|
||||
)
|
||||
|
||||
def save_auto_open_dock(self):
|
||||
""" Save settings about the dock. """
|
||||
self.settings.setValue("pgmetadata/auto_open_dock", self.auto_open_dock_action.isChecked())
|
||||
def sql_to_xml(self,dataall):
|
||||
distribution=''
|
||||
for y in dataall[1]:
|
||||
distribution = distribution + (
|
||||
'<dcat:distribution>'+
|
||||
'<dcat:Distribution>'+
|
||||
'<dct:title>{data}</dct:title>'.format(data=y[0])+
|
||||
'<dcat:downloadURL>{data}</dcat:downloadURL>'.format(data=y[1])+
|
||||
'<dcat:mediaType>{data}</dcat:mediaType>'.format(data=y[2])+
|
||||
'<dct:format>{data}</dct:format>'.format(data=y[3])+
|
||||
'<dct:bytesize>{data}</dct:bytesize>'.format(data=y[4])+
|
||||
'</dcat:Distribution>'+
|
||||
'</dcat:distribution>')
|
||||
publisher=''
|
||||
for z in dataall[2]:
|
||||
publisher = publisher + (
|
||||
'<dct:publisher>'+
|
||||
'<foaf:Organization>'+
|
||||
'<foaf:name>{data}</foaf:name>'.format(data=z[1])+
|
||||
'<foaf:mbox>{data}</foaf:mbox>'.format(data=z[3])+
|
||||
'</foaf:Organization>'+
|
||||
'</dct:publisher>')
|
||||
data_str = [[dataall[0][26],
|
||||
'<dct:identifier>{data}</dct:identifier>'.format(data=dataall[0][1])+
|
||||
'<dct:title>{data}</dct:title>'.format(data=dataall[0][4])+
|
||||
'<dct:description>{data}</dct:description>'.format(data=dataall[0][5])+
|
||||
'<dct:language>{data}</dct:language>'.format(data=dataall[0][26])+
|
||||
'<dct:spatial>{data}</dct:spatial>'.format(data=dataall[0][28])+
|
||||
'<dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">{data}</dct:created>'.format(data=dataall[0][20])+
|
||||
'<dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">{data}</dct:issued>'.format(data=dataall[0][11])+
|
||||
'<dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">{data}</dct:modified>'.format(data=dataall[0][21])+
|
||||
'<dct:license>{data}</dct:license>'.format(data=dataall[0][13])+
|
||||
distribution+
|
||||
publisher+
|
||||
'<dcat:theme>{data}</dcat:theme>'.format(data=", ".join(str(x) for x in dataall[0][24]))+
|
||||
'<dcat:keyword>{data}</dcat:keyword>'.format(data=", ".join(str(x) for x in dataall[0][6]))+
|
||||
'<dct:accrualPeriodicity>{data}</dct:accrualPeriodicity>'.format(data=dataall[0][12])]]
|
||||
|
||||
return data_str
|
||||
|
||||
@staticmethod
|
||||
def sql_for_layer(uri, output_format: OutputFormats):
|
||||
""" Get the SQL query for a given layer and output format. """
|
||||
locale = QgsSettings().value("locale/userLocale", QLocale().name())
|
||||
locale = locale.split('_')[0].lower()
|
||||
|
||||
if output_format == [OutputFormats.HTML,OutputFormats.DCAT]:
|
||||
sql = (
|
||||
"SELECT pgmetadata.get_dataset_item_html_content('{schema}', '{table}', '{locale}');"
|
||||
).format(schema=uri.schema(), table=uri.table(), locale=locale)
|
||||
else:
|
||||
raise NotImplementedError('Output format is not yet implemented.')
|
||||
|
||||
return sql
|
||||
|
||||
def layer_changed(self, layer):
|
||||
""" When the layer has changed in the legend, we must check this new layer. """
|
||||
self.current_datasource_uri = None
|
||||
self.current_connection = None
|
||||
self.ce_trouve_dans_psql(layer)
|
||||
|
||||
|
||||
def add_flatten_dataset_table(self):
|
||||
""" Add a flatten dataset table with all links and contacts. """
|
||||
'''
|
||||
connections, message = connections_list()
|
||||
if not connections:
|
||||
LOGGER.critical(message)
|
||||
self.set_html_content('PgMetadata', message)
|
||||
return
|
||||
|
||||
if len(connections) > 1:
|
||||
dialog = QInputDialog()
|
||||
dialog.setComboBoxItems(connections)
|
||||
dialog.setWindowTitle(tr("Database"))
|
||||
dialog.setLabelText(tr("Choose the database to add the catalog"))
|
||||
if not dialog.exec_():
|
||||
return
|
||||
connection_name = dialog.textValue()
|
||||
else:
|
||||
connection_name = connections[0]
|
||||
|
||||
metadata = QgsProviderRegistry.instance().providerMetadata('postgres')
|
||||
connection = metadata.findConnection(connection_name)
|
||||
|
||||
locale = QgsSettings().value("locale/userLocale", QLocale().name())
|
||||
locale = locale.split('_')[0].lower()
|
||||
|
||||
uri = QgsDataSourceUri(connection.uri())
|
||||
uri.setTable(f'(SELECT * FROM pgmetadata.export_datasets_as_flat_table(\'{locale}\'))')
|
||||
uri.setKeyColumn('uid')
|
||||
|
||||
layer = QgsVectorLayer(uri.uri(), '{} - {}'.format(tr("Catalog"), connection_name), 'postgres')
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
'''
|
||||
|
||||
@staticmethod
|
||||
def open_external_help():
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
@staticmethod
|
||||
def open_link(url):
|
||||
QDesktopServices.openUrl(url)
|
||||
|
||||
def set_html_content(self, title=None, body=None):
|
||||
""" Set the content in the dock. """
|
||||
#link_logo=resources_path('icons', 'CEN_RA.png')
|
||||
css_file = resources_path('css', 'dock.css')
|
||||
with open(css_file, 'r', encoding='utf8') as f:
|
||||
css = f.read()
|
||||
|
||||
html = '<html><head>'
|
||||
#html += '<script src="http://ignf.github.io/geoportal-sdk/latest/dist/2d/GpSDK2D.js" defer ></script>'
|
||||
html += '<style>{css}</style></head><body>'.format(css=css)
|
||||
#html += '<link rel="stylesheet" href="http://ignf.github.io/geoportal-sdk/latest/dist/2d/GpSDK2D.css" >'
|
||||
#html += '<script src="file:///C:/Users/tlaveille/Desktop/maps.js" defer></script>'
|
||||
#html += '<noscript>Your browser does not support JavaScript!</noscript>'
|
||||
if title:
|
||||
html += '<h2>{title} <img class=logo src=https://i2.wp.com/www.cen-rhonealpes.fr/wp-content/uploads/2013/04/cen-rhonealpes-couleurs1.jpg?w=340&ssl=1></h2>'.format(title=title)
|
||||
if body:
|
||||
html += body
|
||||
|
||||
html += '</body></html>'
|
||||
|
||||
# It must be a file, even if it does not exist on the file system.
|
||||
base_url = QUrl.fromLocalFile(resources_path('images', 'must_be_a_file.png'))
|
||||
self.viewer.setHtml(html)#, base_url)
|
||||
|
||||
def ce_trouve_dans_psql(self,layer):
|
||||
try:
|
||||
uri = layer.dataProvider().uri()
|
||||
except:
|
||||
self.default_html_content_not_pg_layer()
|
||||
self.save_button.setEnabled(False)
|
||||
uri=''
|
||||
if uri != '':
|
||||
if not uri.table():
|
||||
layertype = layer.providerType().lower()
|
||||
if layertype == 'wms' or layertype == 'wfs':
|
||||
self.set_html_to_wms(layer)
|
||||
else:
|
||||
self.default_html_content_not_pg_layer()
|
||||
self.save_button.setEnabled(False)
|
||||
else:
|
||||
data_count = self.sql_check(uri)
|
||||
#print(data_count)
|
||||
if data_count == 0:
|
||||
self.default_html_content_not_metadata()
|
||||
self.save_button.setEnabled(False)
|
||||
else:
|
||||
self.build_html_content(layer,uri)
|
||||
self.save_button.setEnabled(True)
|
||||
|
||||
def build_html_content(self,layer,uri):
|
||||
body = ''
|
||||
|
||||
dataall=self.sql_info(uri)
|
||||
data=dataall[0]
|
||||
data_url=dataall[1]
|
||||
data_contact=dataall[2]
|
||||
#print(len(data_url))
|
||||
data_collonne=[field.name() for field in layer.dataProvider().fields()]
|
||||
|
||||
body += '<div><h3>Identification</h3><table class="table table-condensed">'
|
||||
body += '<tr><th>Titre</th><td>{data[4]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Description</th><td>{data[5]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Categories</th><td>{data}</td></tr>'.format(data=(", ".join(str(x) for x in data[6])))
|
||||
body += '<tr><th>Thèmes</th><td>{data}</td></tr>'.format(data=(", ".join(str(x) for x in data[24])))
|
||||
body += '<tr><th>Mots-clés</th><td>{data[7]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Dernier mise à jour</th><td>{data[23]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Langue</th><td>{data[26]}</td></tr>'.format(data=data)
|
||||
body += '</table></div>'
|
||||
|
||||
body += '<div><h3>Properties spatial</h3><table class="table table-condensed">'
|
||||
body += '<tr><th>Niveau</th><td>{data[8]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Echelle minimum</th><td>{data[9]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Echelle maximum</th><td>{data[10]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Nombre d\'entités </th><td>{data[15]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Type de géométrie</th><td>{data[16]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Nom de projection</th><td>{data[17]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>ID de projection</th><td>{data[18]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Emprise</th><td>{data[28]}</td></tr>'.format(data=data)
|
||||
body += '</table></div>'
|
||||
|
||||
#body += '<div id="map"></div>'
|
||||
|
||||
body += '<div><h3>Publication</h3><table class="table table-condensed">'
|
||||
body += '<tr><th>Date</th><td>{data[11]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Fréquence de mise à jour</th><td>{data[12]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Licence</th><td>{data[13]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Licence attribué</th><td>{data[25]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Restriction</th><td>{data[14]}</td></tr>'.format(data=data)
|
||||
body += '</table></div>'
|
||||
|
||||
body += '<div><h3>Lien</h3><table class="table table-condensed table-striped table-bordered">'
|
||||
body += '<tr><th>Type</th><th>URL</th><th>Type MIME</th><th>Format</th><th>Taille</th></tr>'
|
||||
for value_url in data_url:
|
||||
body += '<tr><td>{value_url[0]}</td><td>{value_url[1]}</td><td>{value_url[2]}</td><td>{value_url[3]}</td><td>{value_url[4]}</td></tr>'.format(value_url=value_url)
|
||||
body += '</table></div>'
|
||||
'''
|
||||
body += '<div><h3>Liste des champs</h3><table class="table table-condensed table-striped table-bordered">'
|
||||
for collonne in data_collonne:
|
||||
body += '<tr><th>{collonne}</th><td>{defini}</td></tr>'.format(collonne=collonne,defini='')
|
||||
body += '</table></div>'
|
||||
'''
|
||||
body += '<div><h3>Contacts</h3><table class="table table-condensed table-striped table-bordered">'
|
||||
body += '<tr><th>Rôle</th><th>Nom</th><th>Organisation</th><th>Email</th><th>Télèphone</th></tr>'
|
||||
for value_contact in data_contact:
|
||||
body += '<tr><td>{value_contact[0]}</td><td>{value_contact[1]}</td><td>{value_contact[2]}</td><td>{value_contact[3]}</td><td>{value_contact[4]}</td></tr>'.format(value_contact=value_contact)
|
||||
body += '</table></div>'
|
||||
|
||||
body += '<div><h3>Metadata</h3><table class="table table-condensed">'
|
||||
body += '<tr><th>Table</th><td>{data[2]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Schema</th><td>{data[3]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Date de création</th><td>{data[20]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Date de modification</th><td>{data[21]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>Encodage</th><td>{data[27]}</td></tr>'.format(data=data)
|
||||
body += '<tr><th>UUID</th><td>{data[1]}</td></tr>'.format(data=data)
|
||||
body += '</table></div>'
|
||||
|
||||
self.set_html_content(
|
||||
layer.name(), body)
|
||||
|
||||
def set_html_to_wms(self,layer):
|
||||
self.set_html_content(
|
||||
'CenRa Metadata',(layer.htmlMetadata()))
|
||||
def default_html_content_not_pg_layer(self):
|
||||
""" When it's not a PostgreSQL layer. """
|
||||
self.set_html_content(
|
||||
'CenRa Metadata', ('Vous devez cliquer sur une couche dans la légende qui est stockée dans PostgreSQL.'))
|
||||
def default_html_content_not_metadata(self):
|
||||
self.set_html_content(
|
||||
'CenRa Metadata', ('La couche ne contien pas de métadonnée.'))
|
||||
|
||||
def sql_check(self,uri):
|
||||
cur=login_base()
|
||||
table = uri.table()
|
||||
schema = uri.schema()
|
||||
|
||||
sql_count = """SELECT count(uid) FROM metadata.dataset
|
||||
WHERE schema_name LIKE '"""+schema+"""' AND table_name LIKE '"""+table+"""';"""
|
||||
|
||||
cur.execute(sql_count)
|
||||
data_count = cur.fetchall()
|
||||
cur.close()
|
||||
return data_count[0][0]
|
||||
|
||||
def sql_info(self,uri):
|
||||
cur=login_base()
|
||||
table = uri.table()
|
||||
schema = uri.schema()
|
||||
#[s for s in iface.activeLayer().source().split(" ") if "dbname" in s][0].split("'")[1]
|
||||
sql_find = """SELECT *,right(left(st_astext(geom,2),-2),-9) FROM metadata.dataset
|
||||
WHERE schema_name LIKE '"""+schema+"""' AND table_name LIKE '"""+table+"""';"""
|
||||
cur.execute(sql_find)
|
||||
data_general = cur.fetchall()
|
||||
sql_findurl = """SELECT type,url,mime,format,taille FROM metadata.dataurl WHERE schema_name LIKE '"""+schema+"""' AND table_name LIKE '"""+table+"""';"""
|
||||
cur.execute(sql_findurl)
|
||||
data_url = cur.fetchall()
|
||||
sql_findcontact = """SELECT role,nom,organisation,email,telephone FROM metadata.datacontact WHERE schema_name LIKE '"""+schema+"""' AND table_name LIKE '"""+table+"""';"""
|
||||
cur.execute(sql_findcontact)
|
||||
data_contact = cur.fetchall()
|
||||
cur.close()
|
||||
return data_general[0],data_url,data_contact
|
||||
|
||||
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
@@ -1,89 +1,89 @@
|
||||
import os
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
end_find = plugin_dir.rfind('\\')+1
|
||||
|
||||
NAME = plugin_dir[end_find:]
|
||||
#print(NAME)
|
||||
|
||||
from qgis.gui import *
|
||||
|
||||
from qgis.core import (
|
||||
NULL,
|
||||
QgsApplication,
|
||||
QgsDataSourceUri,
|
||||
QgsProject,
|
||||
QgsProviderConnectionException,
|
||||
QgsProviderRegistry,
|
||||
QgsRasterLayer,
|
||||
QgsSettings,
|
||||
QgsVectorLayer,
|
||||
QgsGeometry,
|
||||
)
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
QDialog,
|
||||
QAction,
|
||||
QDockWidget,
|
||||
QFileDialog,
|
||||
QInputDialog,
|
||||
QMenu,
|
||||
QToolButton,
|
||||
QTableWidget,
|
||||
QTableWidgetItem,
|
||||
)
|
||||
from qgis.utils import iface
|
||||
|
||||
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
send_issues,
|
||||
)
|
||||
|
||||
EDITOR_CLASS = load_ui('CenRa_IssuesSend.ui')
|
||||
|
||||
class CenRa_Issues(QDialog, EDITOR_CLASS):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
_ = parent
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self.settings = QgsSettings()
|
||||
|
||||
#place connect here
|
||||
self.annuler_button.clicked.connect(self.close)
|
||||
self.ok_button.clicked.connect(self.run_sendissues)
|
||||
|
||||
def run_sendissues(self):
|
||||
text_titre = self.titre_line.text()
|
||||
text_message = self.messages_plain.toPlainText()
|
||||
statu_bug = self.check_bug.isChecked()
|
||||
statu_aide = self.check_aide.isChecked()
|
||||
statu_question = self.check_question.isChecked()
|
||||
statu_amelioration = self.check_amelioration.isChecked()
|
||||
statu_autre = self.check_autre.isChecked()
|
||||
|
||||
statu = []
|
||||
if statu_bug == True : statu = statu + [1]
|
||||
if statu_aide == True : statu = statu + [3]
|
||||
if statu_question == True : statu = statu + [5]
|
||||
if statu_amelioration == True : statu = statu + [2]
|
||||
if statu_autre == True : statu = statu + [6]
|
||||
|
||||
if len(statu) >= 1:
|
||||
import qgis
|
||||
url = qgis.utils.pluginMetadata(NAME,'tracker')
|
||||
print(text_message)
|
||||
send_info = send_issues(url,text_titre,text_message,statu)
|
||||
code = send_info.status_code
|
||||
print(code)
|
||||
else:
|
||||
code = 423
|
||||
if code == 201:
|
||||
iface.messageBar().pushMessage("Envoyer :", "Votre messages à bien été envoyer.", level=Qgis.Success, duration=20)
|
||||
self.close()
|
||||
elif code == 422:
|
||||
iface.messageBar().pushMessage("Erreur :", "Erreur dans le contenu du messages.", level=Qgis.Critical, duration=20)
|
||||
elif code == 423:
|
||||
iface.messageBar().pushMessage("Erreur :", "Pas de sujet sélectionné.", level=Qgis.Critical, duration=20)
|
||||
elif code == 404:
|
||||
iface.messageBar().pushMessage("Missing :", "Le serveur de messagerie est injoignable.", level=Qgis.Warning, duration=20)
|
||||
import os
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
end_find = plugin_dir.rfind('\\')+1
|
||||
|
||||
NAME = plugin_dir[end_find:]
|
||||
#print(NAME)
|
||||
|
||||
from qgis.gui import *
|
||||
|
||||
from qgis.core import (
|
||||
NULL,
|
||||
QgsApplication,
|
||||
QgsDataSourceUri,
|
||||
QgsProject,
|
||||
QgsProviderConnectionException,
|
||||
QgsProviderRegistry,
|
||||
QgsRasterLayer,
|
||||
QgsSettings,
|
||||
QgsVectorLayer,
|
||||
QgsGeometry,
|
||||
)
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
QDialog,
|
||||
QAction,
|
||||
QDockWidget,
|
||||
QFileDialog,
|
||||
QInputDialog,
|
||||
QMenu,
|
||||
QToolButton,
|
||||
QTableWidget,
|
||||
QTableWidgetItem,
|
||||
)
|
||||
from qgis.utils import iface
|
||||
|
||||
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
send_issues,
|
||||
)
|
||||
|
||||
EDITOR_CLASS = load_ui('CenRa_IssuesSend.ui')
|
||||
|
||||
class CenRa_Issues(QDialog, EDITOR_CLASS):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
_ = parent
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self.settings = QgsSettings()
|
||||
|
||||
#place connect here
|
||||
self.annuler_button.clicked.connect(self.close)
|
||||
self.ok_button.clicked.connect(self.run_sendissues)
|
||||
|
||||
def run_sendissues(self):
|
||||
text_titre = self.titre_line.text()
|
||||
text_message = self.messages_plain.toPlainText()
|
||||
statu_bug = self.check_bug.isChecked()
|
||||
statu_aide = self.check_aide.isChecked()
|
||||
statu_question = self.check_question.isChecked()
|
||||
statu_amelioration = self.check_amelioration.isChecked()
|
||||
statu_autre = self.check_autre.isChecked()
|
||||
|
||||
statu = []
|
||||
if statu_bug == True : statu = statu + [1]
|
||||
if statu_aide == True : statu = statu + [3]
|
||||
if statu_question == True : statu = statu + [5]
|
||||
if statu_amelioration == True : statu = statu + [2]
|
||||
if statu_autre == True : statu = statu + [6]
|
||||
|
||||
if len(statu) >= 1:
|
||||
import qgis
|
||||
url = qgis.utils.pluginMetadata(NAME,'tracker')
|
||||
print(text_message)
|
||||
send_info = send_issues(url,text_titre,text_message,statu)
|
||||
code = send_info.status_code
|
||||
print(code)
|
||||
else:
|
||||
code = 423
|
||||
if code == 201:
|
||||
iface.messageBar().pushMessage("Envoyer :", "Votre messages à bien été envoyer.", level=Qgis.Success, duration=20)
|
||||
self.close()
|
||||
elif code == 422:
|
||||
iface.messageBar().pushMessage("Erreur :", "Erreur dans le contenu du messages.", level=Qgis.Critical, duration=20)
|
||||
elif code == 423:
|
||||
iface.messageBar().pushMessage("Erreur :", "Pas de sujet sélectionné.", level=Qgis.Critical, duration=20)
|
||||
elif code == 404:
|
||||
iface.messageBar().pushMessage("Missing :", "Le serveur de messagerie est injoignable.", level=Qgis.Warning, duration=20)
|
||||
@@ -1,48 +1,49 @@
|
||||
# This file contains metadata for your plugin.
|
||||
|
||||
# This file should be included when you package your plugin.# Mandatory items:
|
||||
|
||||
[general]
|
||||
name=CenRa_Metabase
|
||||
qgisMinimumVersion=3.0
|
||||
description=CenRa_METABASE
|
||||
version=1.3
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
about=Permet de saisire et de visualisé les information lier à la metadonné d'une couche ce trouvent sur PostgreSQL
|
||||
|
||||
repository=https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS
|
||||
homepage=https://plateformesig.cenra-outils.org/
|
||||
tracker=https://gitea.cenra-outils.org/api/v1/repos/CEN-RA/Plugin_QGIS/issues
|
||||
# End of mandatory metadata
|
||||
|
||||
# Recommended items:
|
||||
|
||||
hasProcessingProvider=no
|
||||
# Uncomment the following line and add your changelog:
|
||||
changelog=<h2>CenRa_Metabase:</h2></br><p><h3>08/10/2024 - Version 1.3: </h3> - Lecture de métadonnée des flux WMS/WFS.</p></br><p><h3>07/10/2024 - Version 1.2: </h3> - Correctif de bug.</p></br><p><h3>03/10/2024 - Version 1.1: </h3> - Remonte la fênetre dans la pille.</p></br><p><h3>26/08/2024 - Version 1.0: </h3> - Lancement du plugin CenRa_Metabase </p></br>
|
||||
|
||||
# Tags are comma separated with spaces allowed
|
||||
tags=python
|
||||
|
||||
|
||||
category=Plugins
|
||||
icon=icon.png
|
||||
# experimental flag
|
||||
experimental=True
|
||||
|
||||
# deprecated flag (applies to the whole plugin, not just a single version)
|
||||
deprecated=False
|
||||
|
||||
# Since QGIS 3.8, a comma separated list of plugins to be installed
|
||||
# (or upgraded) can be specified.
|
||||
# Check the documentation for more information.
|
||||
# plugin_dependencies=
|
||||
|
||||
Category of the plugin: Raster, Vector, Database or Web
|
||||
# category=cenra,database,metadata
|
||||
|
||||
# If the plugin can run on QGIS Server.
|
||||
server=False
|
||||
|
||||
# This file contains metadata for your plugin.
|
||||
|
||||
# This file should be included when you package your plugin.# Mandatory items:
|
||||
|
||||
[general]
|
||||
name=CenRa_Metabase
|
||||
qgisMinimumVersion=3.0
|
||||
supportsQt6=True
|
||||
description=CenRa_METABASE
|
||||
version=0.3.0
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
about=Permet de saisire et de visualisé les information lier à la metadonné d'une couche ce trouvent sur PostgreSQL
|
||||
|
||||
repository=https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS
|
||||
homepage=https://plateformesig.cenra-outils.org/
|
||||
tracker=https://gitea.cenra-outils.org/api/v1/repos/CEN-RA/Plugin_QGIS/issues
|
||||
# End of mandatory metadata
|
||||
|
||||
# Recommended items:
|
||||
|
||||
hasProcessingProvider=no
|
||||
# Uncomment the following line and add your changelog:
|
||||
changelog=<h2>CenRa_METABASE:</h2></br><p><h3>19/05/2025 - Version 0.3.0: </h3> Compatible PyQt5 et PyQt6</p></br><p><h3>09/04/2025 - Version 0.2.3: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 0.2.2: </h3> - Optimisation pour le TT.</p></br><p><h3>03/04/2025 - Version 0.2.1: </h3> - Mise a jour de securite.</p></br><p><h3>07/01/2025 - Version 0.2.0: </h3> - Deployment sur serveur SIG.</p></br><p><h3>07/01/2025 - Version 0.1.6: </h3> - ByPass du certif ssl ci erreur</p></br><p><h3>19/12/2024 - Version 0.1.5: </h3> - Fix les problem de lenteur qu'en la base est down.</p></br><p><h3>12/12/2024 - Version 0.1.4: </h3> - Crash Fix .</p></br><p><h3>08/10/2024 - Version 0.1.3: </h3> - Lecture de métadonnée des flux WMS/WFS.</p></br><p><h3>07/10/2024 - Version 0.1.2: </h3> - Correctif de bug.</p></br><p><h3>03/10/2024 - Version 0.1.1: </h3> - Remonte la fênetre dans la pille.</p></br><p><h3>26/08/2024 - Version 0.1.0: </h3> - Lancement du plugin CenRa_Metabase </p>
|
||||
|
||||
# Tags are comma separated with spaces allowed
|
||||
tags=python
|
||||
|
||||
|
||||
category=Plugins
|
||||
icon=icon.png
|
||||
# experimental flag
|
||||
experimental=True
|
||||
|
||||
# deprecated flag (applies to the whole plugin, not just a single version)
|
||||
deprecated=False
|
||||
|
||||
# Since QGIS 3.8, a comma separated list of plugins to be installed
|
||||
# (or upgraded) can be specified.
|
||||
# Check the documentation for more information.
|
||||
# plugin_dependencies=
|
||||
|
||||
Category of the plugin: Raster, Vector, Database or Web
|
||||
# category=cenra,database,metadata
|
||||
|
||||
# If the plugin can run on QGIS Server.
|
||||
server=False
|
||||
|
||||
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@@ -3,9 +3,7 @@
|
||||
import configparser
|
||||
import shutil
|
||||
import tempfile
|
||||
import base64
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
import os
|
||||
from os.path import abspath, join, pardir, dirname
|
||||
from qgis.PyQt.QtWidgets import QApplication
|
||||
from qgis.PyQt import uic
|
||||
@@ -94,6 +92,14 @@ def resources_path(*args):
|
||||
path = abspath(join(path, item))
|
||||
return path
|
||||
|
||||
def pyperclip():
|
||||
dst = dirname(dirname(__file__))+"\\tools\\"
|
||||
if os.access('N:/',os.R_OK):
|
||||
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
|
||||
try:
|
||||
shutil.copy(src, dst)
|
||||
except:
|
||||
print('404')
|
||||
|
||||
def load_ui(*args):
|
||||
"""Get compile UI file.
|
||||
@@ -107,25 +113,6 @@ def load_ui(*args):
|
||||
|
||||
return ui_class
|
||||
|
||||
def login_base(take=None):
|
||||
from CenRa_METABASE.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 + "')")
|
||||
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
|
||||
@@ -158,7 +145,7 @@ def maj_verif(NAME):
|
||||
|
||||
url = qgis.utils.pluginMetadata(NAME,'repository')
|
||||
#URL = url+'/raw/branch/main/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
|
||||
# print(URL)
|
||||
version = qgis.utils.pluginMetadata(NAME,'version')
|
||||
len_version = len(version)
|
||||
@@ -168,12 +155,15 @@ def maj_verif(NAME):
|
||||
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('<version>',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)
|
||||
try:
|
||||
version_web = str(urllib.request.urlopen(URL).read())
|
||||
plugin_num = version_web.find(NAME)
|
||||
valeur_version_web = version_web.find('<version>',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)
|
||||
except:
|
||||
print("error gitea version ssl")
|
||||
else:
|
||||
iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
|
||||
|
||||
@@ -64,24 +64,11 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWebView" name="viewer" native="true">
|
||||
<property name="url" stdset="0">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextBrowser" name="viewer"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtWebKitWidgets/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Metabase</string>
|
||||
<string>Journal des modifications</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
@@ -29,9 +29,6 @@
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -41,7 +38,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>547</height>
|
||||
<height>570</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
@@ -56,7 +53,7 @@
|
||||
<property name="title">
|
||||
<string>DevLog</string>
|
||||
</property>
|
||||
<widget class="QWebView" name="viewer" native="true">
|
||||
<widget class="QTextBrowser" name="viewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
@@ -65,11 +62,6 @@
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="url" stdset="0">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -78,19 +70,12 @@
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::NoButton</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtWebKitWidgets/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -1,34 +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.81"
|
||||
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'
|
||||
if os_user == 'Administrateur':
|
||||
os_user='stage'
|
||||
@@ -30,9 +30,10 @@ from .tools.resources import (
|
||||
maj_verif,
|
||||
)
|
||||
from .canvas_editor import PageRender_Editor
|
||||
from .about_form import PageRenderAboutDialog
|
||||
from .about_form import AboutDialog
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
|
||||
class PgPageRender:
|
||||
def __init__(self):
|
||||
@@ -114,8 +115,8 @@ class PgPageRender:
|
||||
"""
|
||||
About dialog
|
||||
"""
|
||||
dialog = PageRenderAboutDialog(iface)
|
||||
dialog.exec_()
|
||||
dialog = AboutDialog(iface)
|
||||
dialog.exec()
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
@@ -12,12 +12,12 @@ ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
os.path.join(
|
||||
str(Path(__file__).resolve().parent),
|
||||
'tools/ui',
|
||||
'CenRa_PageRender_about_form.ui'
|
||||
'CenRa_about_form.ui'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class PageRenderAboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
class AboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import logging
|
||||
import os
|
||||
from PyQt5.QtCore import QSettings
|
||||
from collections import namedtuple
|
||||
from enum import Enum
|
||||
from functools import partial
|
||||
@@ -39,11 +38,12 @@ from qgis.core import (
|
||||
QgsLayoutTableColumn,
|
||||
QgsRectangle,
|
||||
QgsLayoutItemMapOverviewStack,
|
||||
QgsLayoutItemHtml,
|
||||
)
|
||||
from qgis.PyQt.QtCore import QLocale, QUrl, QDateTime, Qt
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon, QColor, QFont, QMovie
|
||||
from qgis.PyQt.QtPrintSupport import QPrinter
|
||||
from qgis.PyQt.QtWebKitWidgets import QWebPage
|
||||
#from qgis.PyQt.QtWebKitWidgets import QWebPage
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
QDialog,
|
||||
QAction,
|
||||
@@ -56,14 +56,17 @@ from qgis.PyQt.QtWidgets import (
|
||||
QTableWidgetItem,
|
||||
QVBoxLayout,
|
||||
)
|
||||
from PyQt5 import QtGui
|
||||
|
||||
from qgis.PyQt import QtGui
|
||||
from qgis.PyQt.QtWidgets import QApplication
|
||||
from qgis.PyQt.QtCore import QSettings,QPointF
|
||||
|
||||
from qgis.PyQt.QtXml import QDomDocument
|
||||
from qgis.utils import iface
|
||||
import glob
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
login_base,
|
||||
send_issues,
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
@@ -148,14 +151,95 @@ class PageRender_Editor(QDialog, EDITOR_CLASS):
|
||||
self.toolButton_2.clicked.connect(self.type_page)
|
||||
self.pushButton_2.clicked.connect(self.load)
|
||||
self.verticalScrollBar.valueChanged.connect(self.moveFrame)
|
||||
#self.setAcceptHoverEvents(True)
|
||||
self.tableWidget.setTabKeyNavigation(False)
|
||||
|
||||
def raise_(self):
|
||||
self.activateWindow()
|
||||
self.setNavigator()
|
||||
self.verticalScrollBar.setValue(self.frame.y())
|
||||
def mousePressEvent(self, event):
|
||||
if self.tableWidget.currentItem() != None:
|
||||
QApplication.setOverrideCursor(Qt.CursorShape(18))
|
||||
global lastPos
|
||||
lastPos = {'x':event.pos().x(),'y':event.pos().y()}
|
||||
|
||||
def moveFrame(self):
|
||||
self.frame.move(self.frame.x(),self.verticalScrollBar.value())
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
#if event.modifiers() & Qt.ControlModifier:
|
||||
if event.key() == Qt.Key(0x01000015):
|
||||
self.verticalSlider.setValue(self.spinBox_2.value()+1)
|
||||
if event.key() == Qt.Key(0x01000013):
|
||||
self.verticalSlider.setValue(self.spinBox_2.value()-1)
|
||||
if event.key() == Qt.Key(0x01000014):
|
||||
self.horizontalSlider.setValue(self.spinBox.value()+1)
|
||||
if event.key() == Qt.Key(0x01000012):
|
||||
self.horizontalSlider.setValue(self.spinBox.value()-1)
|
||||
|
||||
|
||||
def wheelEvent(self,event):
|
||||
if (event.angleDelta().y() >= 1):
|
||||
vsb = self.verticalScrollBar.value()+50
|
||||
else:
|
||||
vsb = self.verticalScrollBar.value()-50
|
||||
self.verticalScrollBar.setValue(vsb)
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
updated_cursor_position = event.pos()
|
||||
if self.tableWidget.currentItem() != None:
|
||||
selection_name = (self.tableWidget.currentItem()).text()
|
||||
all_children = self.frame.children()
|
||||
selection = 0
|
||||
for children in all_children:
|
||||
if selection_name == children.objectName():
|
||||
selection = children
|
||||
|
||||
frame_x = self.frame.x()
|
||||
frame_y = self.frame.y()
|
||||
frame_w = self.frame.width()+frame_x
|
||||
frame_h = self.frame.height()+frame_y
|
||||
global lastPos
|
||||
|
||||
orig_position_w = selection.width()
|
||||
orig_position_h = selection.height()
|
||||
if (frame_x <= round(updated_cursor_position.x()) <= frame_w and self.radioButton.isChecked() == True):
|
||||
updated_cursor_position_x = orig_position_w+(round(updated_cursor_position.x()-lastPos['x']))
|
||||
lastPos['x'] = event.pos().x()
|
||||
selection.resize(updated_cursor_position_x,orig_position_h)
|
||||
self.horizontalSlider.setValue(round(updated_cursor_position_x/3.5))
|
||||
orig_position_w = selection.width()
|
||||
orig_position_h = selection.height()
|
||||
if (frame_y <= round(updated_cursor_position.y()) <= frame_h and self.radioButton.isChecked() == True):
|
||||
updated_cursor_position_y = orig_position_h+(round(updated_cursor_position.y()-lastPos['y']))
|
||||
lastPos['y'] = event.pos().y()
|
||||
selection.resize(orig_position_w,updated_cursor_position_y)
|
||||
self.verticalSlider.setValue(round(updated_cursor_position_y/3.5))
|
||||
|
||||
orig_position_x = selection.pos().x()
|
||||
orig_position_y = selection.pos().y()
|
||||
if (frame_x <= round(updated_cursor_position.x()) <= frame_w and self.radioButton.isChecked() == False):
|
||||
updated_cursor_position_x = orig_position_x+(round(updated_cursor_position.x()-lastPos['x']))
|
||||
lastPos['x'] = event.pos().x()
|
||||
#print(updated_cursor_position_x)
|
||||
selection.move(updated_cursor_position_x,orig_position_y)
|
||||
self.horizontalSlider.setValue(round(updated_cursor_position_x/3.5))
|
||||
|
||||
orig_position_x = selection.pos().x()
|
||||
orig_position_y = selection.pos().y()
|
||||
if (frame_y <= round(updated_cursor_position.y()) <= frame_h and self.radioButton.isChecked() == False):
|
||||
updated_cursor_position_y = orig_position_y+(round(updated_cursor_position.y()-lastPos['y']))
|
||||
lastPos['y'] = event.pos().y()
|
||||
#print(updated_cursor_position_y)
|
||||
selection.move(orig_position_x,updated_cursor_position_y)
|
||||
self.verticalSlider.setValue(round(updated_cursor_position_y/3.5))
|
||||
|
||||
def mouseReleaseEvent(self, event):
|
||||
#print('x: {0}, y: {1}'.format(event.pos().x(), event.pos().y()))
|
||||
if self.tableWidget.currentItem() != None:
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
def select_file(self):
|
||||
options = QFileDialog.Options()
|
||||
options |= QFileDialog.ShowDirsOnly
|
||||
@@ -352,8 +436,8 @@ def fletch_canvas(self):
|
||||
last_children = selection
|
||||
self.toolButton_2.setText('Portrait')
|
||||
elif self.toolButton_2.text() == 'Portrait':
|
||||
self.horizontalSlider.setMaximum(maxV)
|
||||
self.verticalSlider.setMaximum(maxH)
|
||||
self.horizontalSlider.setMaximum(maxH)
|
||||
self.verticalSlider.setMaximum(maxV)
|
||||
last_children=0
|
||||
for children in all_children:
|
||||
selection = children
|
||||
@@ -380,6 +464,7 @@ def fletch_canvas(self):
|
||||
self.frame.move(frame_x,frame_y)
|
||||
def setSlider(self):
|
||||
if self.tableWidget.currentItem() != None:
|
||||
print(self.tableWidget.tabKeyNavigation())
|
||||
selection_name = (self.tableWidget.currentItem()).text()
|
||||
all_children = self.frame.children()
|
||||
selection = 0
|
||||
@@ -405,14 +490,18 @@ def fletch_canvas(self):
|
||||
|
||||
def rotate_color(self,selection,last_children):
|
||||
global last_select
|
||||
if self.radioButton.isChecked() == False:
|
||||
ColorCode = "10, 10, 80, 50"
|
||||
else:
|
||||
ColorCode = "249, 238, 148, 50"
|
||||
if self.rotate_object[selection.objectName()] == 0:
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-bottom-color: blue;background-color: rgb(10, 10, 80, 50)")
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-bottom-color: blue;background-color: rgb("+ColorCode+")")
|
||||
elif self.rotate_object[selection.objectName()] == 90:
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-left-color: blue;background-color: rgb(10, 10, 80, 50)")
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-left-color: blue;background-color: rgb("+ColorCode+")")
|
||||
elif self.rotate_object[selection.objectName()] == 180:
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-top-color: blue;background-color: rgb(10, 10, 80, 50)")
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-top-color: blue;background-color: rgb("+ColorCode+")")
|
||||
elif self.rotate_object[selection.objectName()] == 270:
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-right-color: blue;background-color: rgb(10, 10, 80, 50)")
|
||||
selection.setStyleSheet("border: 2px solid;border-color:red;border-right-color: blue;background-color: rgb("+ColorCode+")")
|
||||
if last_children != 0:
|
||||
if last_select != selection.objectName():
|
||||
last_children.setStyleSheet("background-color: rgb(10, 10, 10, 50)")
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
|
||||
from qgis.core import (
|
||||
QgsLayoutSize,
|
||||
QgsUnitTypes,
|
||||
QgsLayoutPoint,
|
||||
)
|
||||
def fletch_canvas(self):
|
||||
if self.radioButton_6.isChecked():
|
||||
values_page = 'A4'
|
||||
else:
|
||||
values_page = 'A3'
|
||||
if self.radioButton_7.isChecked():
|
||||
page_rotate = 'Portrait'
|
||||
else:
|
||||
page_rotate = 'Landscape'
|
||||
|
||||
if page_rotate == 'Portrait':
|
||||
if values_page == 'A4':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(200.0,200, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(6, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(80.0,80, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(126, 210, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(86.0,86, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(6, 208, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(14.285714285714286,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(189, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(51.42857142857143,7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(9, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(45.714285714285715,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(3, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(154.28571428571428,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(51, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(51.42857142857143,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(151, 210, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(51.42857142857143,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(229, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(125.71428571428571,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(60, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(51.42857142857143,13, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(9, 184, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(28.571428571428573,29, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(9, 151, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(282,282, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(8, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(113,113, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(178, 296, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(121,121, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(8, 293, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(20,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(267, 28, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(73,10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(13, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(64,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(4, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(218,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(72, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(73,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(213, 296, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(73,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(323, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(177,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(85, 28, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(73,18, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(13, 259, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(40,40, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(13, 213, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if page_rotate == 'Landscape':
|
||||
if values_page == 'A4':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(200.0,200, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(6, 6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(85.71428571428571,69, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(209, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(85.71428571428571,131, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(209, 74, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(14.285714285714286,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(189, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(51.42857142857143,7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(9, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(45.714285714285715,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(3, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(154.28571428571428,11, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(51, 3, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(51.42857142857143,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(151, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(51.42857142857143,6, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(229, 197, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(125.71428571428571,14, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(60, 20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(51.42857142857143,13, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(9, 184, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(28.571428571428573,29, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(9, 151, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
if values_page == 'A3':
|
||||
self.template_parameters['Carte_size'] = QgsLayoutSize(282,282, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(8, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_rotate'] = 0
|
||||
self.template_parameters['Carte_2_size'] = QgsLayoutSize(121,97, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_locals'] = QgsLayoutPoint(294, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_2_rotate'] = 0
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(121,185, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(294, 105, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_rotate'] = 0
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(20,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(266, 28, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_rotate'] = 0
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(73,10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(12, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_rotate'] = 0
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(64,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_locals'] = QgsLayoutPoint(4, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_rotate'] = 0
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(218,16, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(73, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_rotate'] = 0
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(73,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(214, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_rotate'] = 0
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(73,8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(322, 278, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_rotate'] = 0
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(177,20, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_locals'] = QgsLayoutPoint(85, 28, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_rotate'] = 0
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(73,18, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(12, 260, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_rotate'] = 0
|
||||
self.template_parameters['Logo_2_size'] = QgsLayoutSize(40,40, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_locals'] = QgsLayoutPoint(12, 214, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_2_rotate'] = 0
|
||||
return self.template_parameters
|
||||
@@ -5,8 +5,9 @@
|
||||
[general]
|
||||
name=CenRa_PageRender
|
||||
qgisMinimumVersion=3.0
|
||||
supportsQt6=True
|
||||
description=CenRa_PageRender
|
||||
version=1.3
|
||||
version=0.2.0
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
@@ -21,7 +22,7 @@ tracker=https://gitea.cenra-outils.org/api/v1/repos/CEN-RA/Plugin_QGIS/issues
|
||||
|
||||
hasProcessingProvider=no
|
||||
# Uncomment the following line and add your changelog:
|
||||
changelog=<h2>CenRa_PageRender:</h2></br><p><h3>08/11/2024 - Version 1.3: </h3> - Correctif de bug. </br><p><h3>21/10/2024 - Version 1.1: </h3> - Les match en if. </br> - Bouton de scroll et adaptation portrait.</p></br><p><h3>09/10/2024 - Version 1.0: </h3> - Création.</p>
|
||||
changelog=<h2>CenRa_PAGERENDER:</h2></br><p><h3>19/05/2025 - Version 0.2.0: </h3> Compatible PyQt5 et PyQt6</p></br><p><h3>03/04/2025 - Version 0.1.6: </h3> - Mise a jour de securite.</p></br><p><h3>07/01/2025 - Version 0.1.5: </h3> - ByPass du certif ssl ci erreur.</br></p><p><h3>14/11/2024 - Version 0.1.4: </h3> - Implementation de la mollet. </br> - Implementation du dragging pour déplacer et modification de la taille </br></p></br><p><h3>08/11/2024 - Version 0.1.3: </h3> - Correctif de bug. </br><p><h3>21/10/2024 - Version 0.1.1: </h3> - Les match en if. </br> - Bouton de scroll et adaptation portrait.</p></br><p><h3>09/10/2024 - Version 0.1.0: </h3> - Création.</p>
|
||||
|
||||
# Tags are comma separated with spaces allowed
|
||||
tags=python
|
||||
|
||||
@@ -1,34 +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.81"
|
||||
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'
|
||||
if os_user == 'Administrateur':
|
||||
os_user='stage'
|
||||
@@ -107,25 +107,6 @@ def load_ui(*args):
|
||||
|
||||
return ui_class
|
||||
|
||||
def login_base(take=None):
|
||||
from CenRa_METABASE.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 + "')")
|
||||
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
|
||||
@@ -158,7 +139,7 @@ def maj_verif(NAME):
|
||||
|
||||
url = qgis.utils.pluginMetadata(NAME,'repository')
|
||||
#URL = url+'/raw/branch/main/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
|
||||
# print(URL)
|
||||
version = qgis.utils.pluginMetadata(NAME,'version')
|
||||
len_version = len(version)
|
||||
@@ -168,12 +149,15 @@ def maj_verif(NAME):
|
||||
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('<version>',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)
|
||||
try:
|
||||
version_web = str(urllib.request.urlopen(URL).read())
|
||||
plugin_num = version_web.find(NAME)
|
||||
valeur_version_web = version_web.find('<version>',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)
|
||||
except:
|
||||
print("error gitea version ssl")
|
||||
else:
|
||||
iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
|
||||
|
||||
|
||||
@@ -443,6 +443,9 @@
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Metabase</string>
|
||||
<string>Journal des modifications</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
@@ -29,9 +29,6 @@
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -41,7 +38,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>547</height>
|
||||
<height>570</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
@@ -56,7 +53,7 @@
|
||||
<property name="title">
|
||||
<string>DevLog</string>
|
||||
</property>
|
||||
<widget class="QWebView" name="viewer" native="true">
|
||||
<widget class="QTextBrowser" name="viewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
@@ -65,11 +62,6 @@
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="url" stdset="0">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -78,19 +70,12 @@
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::NoButton</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtWebKitWidgets/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -13,23 +13,32 @@ import qgis
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
import socket
|
||||
import os
|
||||
from .tools.resources import (
|
||||
plugin_path,
|
||||
pyperclip,
|
||||
resources_path,
|
||||
maj_verif,
|
||||
)
|
||||
pyperclip()
|
||||
|
||||
from .postgis_editor import Postgis_Editor
|
||||
from .postgis_creator import Postgis_Creator
|
||||
from .about_form import PostgisAboutDialog
|
||||
from .postgis_rename import Postgis_Rename
|
||||
from .about_form import AboutDialog
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
|
||||
IPAddr=socket.gethostbyname(socket.gethostname())
|
||||
|
||||
class PgPostgis:
|
||||
def __init__(self):
|
||||
""" Constructor. """
|
||||
self.action_editor = None
|
||||
self.action_creator = None
|
||||
self.action_rename = None
|
||||
# self.issues = None
|
||||
self.provider = None
|
||||
self.locator_filter = None
|
||||
@@ -58,6 +67,7 @@ class PgPostgis:
|
||||
|
||||
icon = QIcon(resources_path('icons', 'page_new.png'))
|
||||
icon2 = QIcon(resources_path('icons', 'page_ajout.png'))
|
||||
icon3 = QIcon(resources_path('icons', 'page_rename.png'))
|
||||
|
||||
# Open the online help
|
||||
self.help_action = QAction(icon, "CenRa_Postgis", iface.mainWindow())
|
||||
@@ -69,6 +79,11 @@ class PgPostgis:
|
||||
self.postgis_creator = QAction(icon, 'dossier_creator',None)
|
||||
self.toolBar.addAction(self.postgis_creator)
|
||||
self.postgis_creator.triggered.connect(self.open_creator)
|
||||
|
||||
self.postgis_creator.setEnabled(False)
|
||||
if os.access('N:/',os.R_OK):
|
||||
self.postgis_creator.setEnabled(True)
|
||||
|
||||
if not self.action_editor:
|
||||
self.action_editor = Postgis_Editor()
|
||||
|
||||
@@ -76,12 +91,36 @@ class PgPostgis:
|
||||
self.toolBar.addAction(self.postgis_editor)
|
||||
self.postgis_editor.triggered.connect(self.open_editor)
|
||||
|
||||
self.postgis_editor.setEnabled(False)
|
||||
if os.access('N:/',os.R_OK):
|
||||
self.postgis_editor.setEnabled(True)
|
||||
|
||||
if not self.action_rename:
|
||||
self.action_rename = Postgis_Rename()
|
||||
|
||||
self.postgis_rename = QAction(icon3, 'dossier_rename',None)
|
||||
self.toolBar.addAction(self.postgis_rename)
|
||||
self.postgis_rename.triggered.connect(self.open_rename)
|
||||
|
||||
if os.environ['USERNAME'] == 'tlaveille' or os.environ['USERNAME'] == 'lpoulin' or os.environ['USERNAME'] == 'rclement':
|
||||
self.action_rename.setEnabled(True)
|
||||
self.postgis_rename.setEnabled(True)
|
||||
self.postgis_rename.setVisible(1)
|
||||
else:
|
||||
self.action_rename.setEnabled(False)
|
||||
self.postgis_rename.setEnabled(False)
|
||||
self.postgis_rename.setVisible(0)
|
||||
|
||||
self.postgis_rename.setEnabled(False)
|
||||
if os.access('N:/',os.R_OK):
|
||||
self.postgis_rename.setEnabled(True)
|
||||
|
||||
def open_about_dialog(self):
|
||||
"""
|
||||
About dialog
|
||||
"""
|
||||
dialog = PostgisAboutDialog(iface)
|
||||
dialog.exec_()
|
||||
dialog = AboutDialog(iface)
|
||||
dialog.exec()
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
@@ -94,12 +133,18 @@ class PgPostgis:
|
||||
self.action_creator.show()
|
||||
self.action_creator.raise_()
|
||||
|
||||
def open_rename(self):
|
||||
self.action_rename.show()
|
||||
self.action_rename.raise_()
|
||||
|
||||
def unload(self):
|
||||
""" Unload the plugin. """
|
||||
if self.action_editor:
|
||||
iface.removePluginMenu('CenRa_Postgis',self.postgis_editor)
|
||||
if self.action_creator:
|
||||
iface.removePluginMenu('CenRa_Postgis',self.postgis_creator)
|
||||
if self.action_rename:
|
||||
iface.removePluginMenu('CenRa_Postgis',self.postgis_rename)
|
||||
|
||||
if self.provider:
|
||||
QgsApplication.processingRegistry().removeProvider(self.provider)
|
||||
|
||||
@@ -17,7 +17,7 @@ ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
)
|
||||
|
||||
|
||||
class PostgisAboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
class AboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
|
||||
@@ -26,7 +26,7 @@ class PostgisAboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
self.iface = iface
|
||||
self.setupUi(self)
|
||||
|
||||
self.viewer.setHtml(devlog('CenRa_POSTGRES'))
|
||||
self.viewer.setHtml(devlog('CenRa_POSTGIS'))
|
||||
|
||||
self.rejected.connect(self.onReject)
|
||||
self.buttonBox.rejected.connect(self.onReject)
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
[general]
|
||||
name=CenRa_POSTGIS
|
||||
qgisMinimumVersion=3.0
|
||||
supportsQt6=True
|
||||
description=Permet de crée un dossier dans la base PostGis
|
||||
version=2.0
|
||||
version=3.0
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
@@ -21,7 +22,7 @@ email=si_besoin@cen-rhonealpes.fr
|
||||
# Optional items:
|
||||
|
||||
# Uncomment the following line and add your changelog entries:
|
||||
changelog=<h2>CenRa_POSTGIS:</h2></br><p><h3>22/10/2024 - Version 2.0:</h3>- Refont du code.</p>
|
||||
changelog=<h2>CenRa_POSTGIS:</h2></br><p><h3>19/05/2025 - Version 3.0: </h3> Compatible PyQt5 et PyQt6</p></br><p><h3>09/04/2025 - Version 2.9: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 2.8: </h3> - Optimisation pour le TT.</p></br><p><h3>03/04/2025 - Version 2.7: </h3> - Mise a jour de securite.</p></br><p><h3>12/02/2025 - Version 2.6: </h3> - InDev:renomé les schema et table.</p></br><p><h3>04/02/2025 - Version 2.5: </h3> - Correctif bug création de couche.</p></br><p><h3>23/01/2025 - Version 2.4: </h3> - Correctif sur les pkey.</p></br><p><h3>22/01/2025 - Version 2.3: </h3> - Correctif sur la creation de projet.</p></br><p><h3>21/01/2025 - Version 2.2: </h3> - Correctif sur la longeur des nom.</p></br><p><h3>07/01/2025 - Version 2.1: </h3> - ByPass du certif ssl ci erreur.</p></br><p><h3>22/10/2024 - Version 2.0:</h3>- Refont du code.</p>
|
||||
|
||||
# tags are comma separated with spaces allowed
|
||||
tags=cenra, postgis, database
|
||||
|
||||
@@ -7,20 +7,31 @@ 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.QtWidgets import QAction, QMenu, QDialog,QMessageBox
|
||||
from qgis.PyQt.QtGui import QIcon
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5 import QtGui
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
from qgis.PyQt.QtGui import *
|
||||
from qgis.PyQt import QtGui
|
||||
|
||||
from qgis.core import *
|
||||
from qgis.core import QgsDataSourceUri
|
||||
|
||||
from .tools.PythonSQL import *
|
||||
try:
|
||||
from .tools.PythonSQL import login_base
|
||||
except:
|
||||
print('Pas de fichier PythonSQL')
|
||||
|
||||
from .tools.SQLRequet import *
|
||||
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
login_base,
|
||||
send_issues,
|
||||
create_vierge,
|
||||
create_contour,
|
||||
create_travaux,
|
||||
create_habita
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
@@ -46,10 +57,11 @@ class Postgis_Creator(QDialog, EDITOR_CLASS):
|
||||
|
||||
# run method that performs all the real work
|
||||
def raise_(self):
|
||||
self.activateWindow()
|
||||
# show the dialog
|
||||
self.show()
|
||||
# Run the dialog event loop
|
||||
result = self.exec_()
|
||||
result = self.exec()
|
||||
# See if OK was pressed
|
||||
if result == 1:
|
||||
|
||||
@@ -70,363 +82,29 @@ class Postgis_Creator(QDialog, EDITOR_CLASS):
|
||||
if self.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.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()
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
|
||||
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)
|
||||
if self.couche_contour.isChecked() or self.couche_habitat.isChecked() or self.couche_travaux_prevus.isChecked() or self.couche_vierge.isChecked():
|
||||
cur.execute(SQL_schema)
|
||||
cur.execute(SQL_GRANT_SCHEMA)
|
||||
else:
|
||||
iface.messageBar().pushMessage("POSTGRESQL :", "Pas de couche sélectionnée, création refusée.", level=Qgis.Warning, duration=30)
|
||||
|
||||
### Creation de la table contour
|
||||
if self.couche_contour.isChecked(): # Verifie si la checkbox est cochee
|
||||
if self.annee_1.text() == 'aaaa' or self.annee_1.text() == '':
|
||||
tablename = schema + "_contour"
|
||||
else :
|
||||
tablename = schema + "_contour_" + self.annee_1.text()
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
create_contour(self,schema,cur,con,host ,port ,dbname ,user ,mdp)
|
||||
create_habita(self,schema,cur,con,host ,port ,dbname ,user ,mdp)
|
||||
create_travaux(self,schema,cur,con,host ,port ,dbname ,user ,mdp)
|
||||
create_vierge(self,schema,cur,con,host ,port ,dbname ,user ,mdp)
|
||||
|
||||
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.couche_habitat.isChecked():
|
||||
if self.annee_2.text() == 'aaaa' or self.annee_2.text() == '':
|
||||
tablename = schema + "_habitat"
|
||||
else :
|
||||
tablename = schema + "_habitat_" + self.annee_2.text()
|
||||
tablename_1=tablename+"_points"
|
||||
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.couche_travaux_prevus.isChecked():
|
||||
#**********Poly
|
||||
if self.annee_5.text() == 'aaaa' or self.annee_5.text() == '':
|
||||
tablename = schema + "_travaux_prevus_poly"
|
||||
else :
|
||||
tablename = schema + "_travaux_prevus_poly_" + self.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.annee_5.text() == 'aaaa' or self.annee_5.text() == '':
|
||||
tablename = schema + "_travaux_prevus_ligne"
|
||||
else :
|
||||
tablename = schema + "_travaux_prevus_ligne_" + self.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.annee_5.text() == 'aaaa' or self.annee_5.text() == '':
|
||||
tablename = schema + "_travaux_prevus_point"
|
||||
else :
|
||||
tablename = schema + "_travaux_prevus_point_" + self.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.couche_vierge.isChecked():
|
||||
if self.annee_4.text() == 'aaaa' or self.annee_4.text() == '':
|
||||
tablename = schema + "_" + self.nom_couche_vierge.text().lower()
|
||||
else :
|
||||
tablename = schema + "_" + self.nom_couche_vierge.text().lower() + "_" + self.annee_4.text()
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
|
||||
if self.couche_vierge_point.isChecked() == 1 :
|
||||
champ_vierge = champ_viergePoint
|
||||
|
||||
if self.couche_vierge_ligne.isChecked() == 1 :
|
||||
champ_vierge = champ_viergeLigne
|
||||
|
||||
if self.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.couche_vierge_point.isChecked() == 1 :
|
||||
cur.execute(SQL_trigger_coordonnees)
|
||||
|
||||
if self.couche_vierge_ligne.isChecked() == 1 :
|
||||
cur.execute(SQL_trigger_length_m)
|
||||
cur.execute(SQL_trigger_length_km)
|
||||
|
||||
if self.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
|
||||
@@ -9,18 +9,28 @@ import qgis
|
||||
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 PyQt5 import QtGui
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
from qgis.PyQt.QtGui import *
|
||||
from qgis.PyQt import QtGui
|
||||
|
||||
from qgis.core import *
|
||||
from qgis.core import QgsDataSourceUri
|
||||
|
||||
from .tools.PythonSQL import *
|
||||
try:
|
||||
from .tools.PythonSQL import login_base
|
||||
except:
|
||||
print('Pas de fichier PythonSQL')
|
||||
from .tools.SQLRequet import *
|
||||
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
login_base,
|
||||
send_issues,
|
||||
create_vierge,
|
||||
create_contour,
|
||||
create_travaux,
|
||||
create_habita
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
@@ -46,16 +56,15 @@ class Postgis_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
### Outil Ajout de nouvelles couche a un dossier
|
||||
def raise_(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()
|
||||
self.activateWindow()
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
# 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
|
||||
@@ -82,19 +91,18 @@ class Postgis_Editor(QDialog, EDITOR_CLASS):
|
||||
# show the dialog
|
||||
self.show()
|
||||
# Run the dialog event loop
|
||||
result = self.exec_()
|
||||
result = self.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()
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
|
||||
if self.schema.currentIndex() == -1 :
|
||||
QMessageBox.warning(None, "Oups :", "Veuillez choisir un nom de dossier.")
|
||||
@@ -102,350 +110,10 @@ class Postgis_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
schema = self.schema.currentText()
|
||||
|
||||
### Creation de la table contour
|
||||
if self.couche_contour.isChecked(): # Verifie si la checkbox est cochee
|
||||
if self.annee_1.text() == 'aaaa' or self.annee_1.text() == '':
|
||||
tablename = schema + "_contour"
|
||||
else :
|
||||
tablename = schema + "_contour_" + self.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.couche_habitat.isChecked():
|
||||
if self.annee_2.text() == 'aaaa' or self.annee_2.text() == '':
|
||||
tablename = schema + "_habitat"
|
||||
else :
|
||||
tablename = schema + "_habitat_" + self.annee_2.text()
|
||||
|
||||
tablename_1=tablename+"_points"
|
||||
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.couche_travaux_prevus.isChecked():
|
||||
#**********Poly
|
||||
if self.annee_5.text() == 'aaaa' or self.annee_5.text() == '':
|
||||
tablename = schema + "_travaux_prevus_poly"
|
||||
else :
|
||||
tablename = schema + "_travaux_prevus_poly_" + self.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.annee_5.text() == 'aaaa' or self.annee_5.text() == '':
|
||||
tablename = schema + "_travaux_prevus_ligne"
|
||||
else :
|
||||
tablename = schema + "_travaux_prevus_ligne_" + self.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.annee_5.text() == 'aaaa' or self.annee_5.text() == '':
|
||||
tablename = schema + "_travaux_prevus_point"
|
||||
else :
|
||||
tablename = schema + "_travaux_prevus_point_" + self.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.couche_vierge.isChecked():
|
||||
if self.annee_4.text() == 'aaaa' or self.annee_4.text() == '':
|
||||
tablename = schema + "_" + self.nom_couche_vierge.text().lower()
|
||||
else :
|
||||
tablename = schema + "_" + self.nom_couche_vierge.text().lower() + "_" + self.annee_4.text()
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
|
||||
if self.couche_vierge_point.isChecked() == 1 :
|
||||
champ_vierge = champ_viergePoint
|
||||
|
||||
if self.couche_vierge_ligne.isChecked() == 1 :
|
||||
champ_vierge = champ_viergeLigne
|
||||
|
||||
if self.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();"
|
||||
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_vierge)
|
||||
cur.execute(SQL_pkey)
|
||||
cur.execute(SQL_GRANT_TABLE)
|
||||
|
||||
if self.couche_vierge_point.isChecked() == 1 :
|
||||
cur.execute(SQL_trigger_coordonnees)
|
||||
|
||||
if self.couche_vierge_ligne.isChecked() == 1 :
|
||||
cur.execute(SQL_trigger_length_m)
|
||||
cur.execute(SQL_trigger_length_km)
|
||||
|
||||
if self.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()
|
||||
create_contour(self,schema,cur,con,host ,port ,dbname ,user ,mdp)
|
||||
create_habita(self,schema,cur,con,host ,port ,dbname ,user ,mdp)
|
||||
create_travaux(self,schema,cur,con,host ,port ,dbname ,user ,mdp)
|
||||
create_vierge(self,schema,cur,con,host ,port ,dbname ,user ,mdp)
|
||||
|
||||
con.close()
|
||||
pass
|
||||
@@ -0,0 +1,240 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import
|
||||
# Import the PyQt and QGIS libraries
|
||||
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, QMessageBox,QDialogButtonBox
|
||||
from qgis.PyQt.QtGui import QIcon
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
from qgis.PyQt.QtGui import *
|
||||
from qgis.PyQt import QtGui
|
||||
|
||||
from qgis.core import *
|
||||
from qgis.core import QgsDataSourceUri
|
||||
|
||||
try:
|
||||
from .tools.PythonSQL import login_base
|
||||
except:
|
||||
print('Pas de fichier PythonSQL')
|
||||
from .tools.SQLRequet import *
|
||||
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
send_issues,
|
||||
create_vierge,
|
||||
create_contour,
|
||||
create_travaux,
|
||||
create_habita
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
import os.path
|
||||
import webbrowser, os
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
import base64
|
||||
from qgis.utils import iface
|
||||
|
||||
EDITOR_CLASS = load_ui('CenRa_PostgisRename_base.ui')
|
||||
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" "]
|
||||
try:
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
except:
|
||||
print('')
|
||||
class Postgis_Rename(QDialog, EDITOR_CLASS):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
_ = parent
|
||||
super().__init__()
|
||||
self.setupUi(self)
|
||||
self.settings = QgsSettings()
|
||||
self.s = QSettings()
|
||||
self.setWindowIcon(QtGui.QIcon(resources_path('icons','icon.png')))
|
||||
self.iface = iface
|
||||
|
||||
self.schema.currentIndexChanged.connect(self.Test)
|
||||
self.buttonBox.accepted.connect(self.msgBox)
|
||||
### Outil Ajout de nouvelles couche a un dossier
|
||||
def raise_(self):
|
||||
self.activateWindow()
|
||||
self.groupBox_3.hide()
|
||||
self.buttonBox.button(QDialogButtonBox.StandardButton(0x00000400)).setEnabled(False)
|
||||
GET_ALL_SCHEMA = """SELECT DISTINCT table_schema FROM information_schema.tables WHERE table_schema LIKE '_form_%' OR table_schema LIKE '_01_%' OR table_schema LIKE '_07_%' OR table_schema LIKE '_26_%' OR table_schema LIKE '_42_%' OR table_schema LIKE '_69_%' ORDER BY table_schema;"""
|
||||
cur.execute(GET_ALL_SCHEMA)
|
||||
AllSchema = cur.fetchall()
|
||||
last_value_schema = self.schema.currentText()
|
||||
last_value_departement = self.departement.currentText()
|
||||
self.schema.clear()
|
||||
self.departement.clear()
|
||||
self.schema.addItems([''])
|
||||
for Schema in AllSchema:
|
||||
self.schema.addItems(Schema)
|
||||
self.departement.addItems(['','01','07','26','42','69','form'])
|
||||
if last_value_schema != '':
|
||||
self.schema.setCurrentIndex(self.schema.findText(last_value_schema))
|
||||
if last_value_departement != '':
|
||||
self.departement.setCurrentIndex(self.departement.findText(last_value_departement))
|
||||
|
||||
def Test(self):
|
||||
oldSchema = self.schema.currentText()
|
||||
if oldSchema != '':
|
||||
allIsGood = 0
|
||||
|
||||
GET_COUNT_LEFT = "SELECT count(*) FROM information_schema.tables WHERE table_schema LIKE left(table_name,"+str(len(oldSchema))+") AND table_schema LIKE '"+oldSchema+"';"
|
||||
GET_COUNT_TOT = "SELECT count(*) FROM information_schema.tables WHERE table_schema LIKE '"+oldSchema+"';"
|
||||
|
||||
cur.execute(GET_COUNT_TOT)
|
||||
CountTot = cur.fetchall()[0]
|
||||
cur.execute(GET_COUNT_LEFT)
|
||||
CountLeft = cur.fetchall()[0]
|
||||
|
||||
if CountLeft[0] == CountTot[0]:
|
||||
allIsGood = allIsGood+1
|
||||
self.couche.setChecked(1)
|
||||
else:
|
||||
self.couche.setChecked(0)
|
||||
|
||||
GET_GRANTEE_PRIVILEGE = "SELECT DISTINCT count(*) FROM information_schema.role_table_grants WHERE table_schema LIKE '"+oldSchema+"' AND grantee LIKE 'grp_qgis' AND privilege_type LIKE 'UPDATE';"
|
||||
cur.execute(GET_GRANTEE_PRIVILEGE)
|
||||
CountPrivilege = cur.fetchall()[0]
|
||||
|
||||
if CountTot[0] == CountPrivilege[0]:
|
||||
allIsGood = allIsGood+1
|
||||
self.compte.setChecked(1)
|
||||
else:
|
||||
self.compte.setChecked(0)
|
||||
|
||||
if allIsGood == 2:
|
||||
self.groupBox_3.show()
|
||||
self.loadValue()
|
||||
self.buttonBox.button(QDialogButtonBox.StandardButton(0x00000400)).setEnabled(True)
|
||||
else:
|
||||
self.groupBox_3.hide()
|
||||
self.buttonBox.button(QDialogButtonBox.StandardButton(0x00000400)).setEnabled(False)
|
||||
else:
|
||||
self.old_name.setText('')
|
||||
self.compte.setChecked(0)
|
||||
self.couche.setChecked(0)
|
||||
self.groupBox_3.hide()
|
||||
|
||||
def loadValue(self):
|
||||
oldSchema = self.schema.currentText()
|
||||
if oldSchema[:6] == '_form_':
|
||||
oldSchema = self.schema.currentText()[6:]
|
||||
prefixSchema = self.schema.currentText()[1:5]
|
||||
else:
|
||||
oldSchema = self.schema.currentText()[4:]
|
||||
prefixSchema = self.schema.currentText()[1:3]
|
||||
if oldSchema[:3] == 'at_':
|
||||
oldSchema = oldSchema[3:]
|
||||
self.animation.setChecked(1)
|
||||
else:
|
||||
self.animation.setChecked(0)
|
||||
self.old_name.setText(oldSchema)
|
||||
self.departement.setCurrentIndex(self.departement.findText(prefixSchema))
|
||||
|
||||
def updateName(self):
|
||||
if self.departement.currentText() != '':
|
||||
oldTableName = self.old_name.text()
|
||||
newTableName = ((self.new_name.text()).lower()).replace(' ','_')
|
||||
newPrefixSchema = '_'+self.departement.currentText()+'_'
|
||||
if self.schema.currentText()[:6] == '_form_':
|
||||
oldPrefixSchema = self.schema.currentText()[:6]
|
||||
if (self.schema.currentText()[6:9]) == "at_":
|
||||
oldPrefixSchema=oldPrefixSchema+'at_'
|
||||
else:
|
||||
oldPrefixSchema = self.schema.currentText()[:4]
|
||||
if (self.schema.currentText()[4:7]) == 'at_':
|
||||
oldPrefixSchema=oldPrefixSchema+'at_'
|
||||
|
||||
if self.animation.isChecked():
|
||||
newPrefixSchema=newPrefixSchema+'at_'
|
||||
oldSchemaName = oldPrefixSchema+oldTableName
|
||||
newSchemaName = newPrefixSchema+newTableName
|
||||
|
||||
if oldSchemaName != newSchemaName:
|
||||
global AllSQLrun
|
||||
allSQLrun=''
|
||||
|
||||
SQL_UPDATE = """UPDATE public.layer_styles SET f_table_schema = '"""+newSchemaName+"""',f_table_name = replace(replace(f_table_name,'"""+oldTableName+"""','"""+newTableName+"""'),'"""+oldPrefixSchema+"""','"""+newPrefixSchema+"""') WHERE f_table_schema LIKE '"""+oldSchemaName+"""';"""
|
||||
allSQLrun = allSQLrun+SQL_UPDATE
|
||||
cur.execute(SQL_UPDATE)
|
||||
|
||||
SQL_GET_TABLE_RENAME = """SELECT table_name,replace(replace(table_name,'"""+oldTableName+"""','"""+newTableName+"""'),'"""+oldPrefixSchema+"""','"""+newPrefixSchema+"""') from information_schema.tables WHERE table_schema LIKE '"""+oldSchemaName+"""';"""
|
||||
cur.execute(SQL_GET_TABLE_RENAME)
|
||||
allTableRename = cur.fetchall()
|
||||
allTableList = []
|
||||
for TableRename in allTableRename:
|
||||
oldTable = TableRename[0]
|
||||
newTable = TableRename[1]
|
||||
allTableList.append([oldTable,newSchemaName,newTable])
|
||||
SQL_RENAME_TABLE = """ALTER TABLE """+oldSchemaName+'.'+oldTable+""" RENAME TO """+newTable+""";"""
|
||||
allSQLrun = allSQLrun+SQL_RENAME_TABLE
|
||||
cur.execute(SQL_RENAME_TABLE)
|
||||
|
||||
SQL_RENAME_SCHEMA = 'ALTER SCHEMA '+oldSchemaName+' RENAME TO '+newSchemaName
|
||||
allSQLrun = allSQLrun+SQL_RENAME_SCHEMA
|
||||
cur.execute(SQL_RENAME_SCHEMA)
|
||||
#print(allSQLrun)
|
||||
con.commit()
|
||||
for LayerOpen in allTableList:
|
||||
self.UnloadLoadLayers(LayerOpen[0],LayerOpen[1],LayerOpen[2])
|
||||
|
||||
|
||||
def UnloadLoadLayers(self,OldName,NewSchema,NewTable):
|
||||
allLayers = (QgsProject.instance().mapLayers().values())
|
||||
listLayers = []
|
||||
listLayersName = []
|
||||
for layer in allLayers:
|
||||
listLayers.append(layer)
|
||||
listLayersName.append(layer.name())
|
||||
if OldName in listLayersName:
|
||||
layer = (listLayers[listLayersName.index(OldName)])
|
||||
provider = layer.dataProvider()
|
||||
dbname = (QgsDataSourceUri(provider.dataSourceUri()).database())
|
||||
user = QgsDataSourceUri(provider.dataSourceUri()).username()
|
||||
mdp = QgsDataSourceUri(provider.dataSourceUri()).password()
|
||||
host = QgsDataSourceUri(provider.dataSourceUri()).host()
|
||||
port = QgsDataSourceUri(provider.dataSourceUri()).port()
|
||||
|
||||
### 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(NewSchema, NewTable, 'geom')
|
||||
QgsProject.instance().removeMapLayer(layer.id())
|
||||
layer = self.iface.addVectorLayer(uri.uri(), NewTable, "postgres")
|
||||
|
||||
def msgBox(self):
|
||||
self.QMBquestion = QMessageBox()
|
||||
self.QMBquestion.setWindowTitle(u"Attention !")
|
||||
self.QMBquestion.setIcon(QMessageBox.Icon.Warning)
|
||||
self.QMBquestion.setText("Attention, le renommage de dossier PostGIS peut engendrer des pertes de liaisons avec des projets QGIS !")
|
||||
self.QMBquestion.setStandardButtons(QMessageBox.StandardButton(0x00004000)|QMessageBox.StandardButton(0x00010000))
|
||||
if self.new_name.text() != '':
|
||||
error_caracteres = 0
|
||||
for caracteres in ch :
|
||||
if self.new_name.text().find(caracteres) != -1 :
|
||||
error_caracteres = 1
|
||||
if error_caracteres == 0:
|
||||
self.QMBquestion = self.QMBquestion.exec()
|
||||
else:
|
||||
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.new_name.text().lower() )
|
||||
else:
|
||||
QMessageBox.warning(None, "Oups :", "Votre projet doit avoire un nom !")
|
||||
if self.QMBquestion == QMessageBox.StandardButton(0x00004000):
|
||||
self.updateName()
|
||||
@@ -1,21 +0,0 @@
|
||||
from qgis.core import QgsApplication
|
||||
|
||||
def gitea():
|
||||
file_url = QgsApplication.qgisSettingsDirPath()+'QGIS/QGIS3.ini'
|
||||
recherche_1 = 'plugin_repositories\\github\\url=https://github.com/CEN-Rhone-Alpes/Plugin_QGIS/releases/latest/download/plugins.xml'
|
||||
replace_1 = 'plugin_repositories\\gitea\\url=https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
|
||||
|
||||
recherche_2 = 'github'
|
||||
replace_2 = 'gitea'
|
||||
|
||||
# Read in the file
|
||||
with open(file_url, 'r') as file:
|
||||
filedata = file.read()
|
||||
|
||||
# Replace the target string
|
||||
filedata = filedata.replace(recherche_1, replace_1)
|
||||
filedata = filedata.replace(recherche_2, replace_2)
|
||||
|
||||
# Write the file out again
|
||||
with open(file_url, 'w') as file:
|
||||
file.write(filedata)
|
||||
@@ -1,174 +1,141 @@
|
||||
import sys
|
||||
import socket
|
||||
import os
|
||||
IPAddr=socket.gethostbyname(socket.gethostname())
|
||||
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'
|
||||
if os_user == 'Administrateur':
|
||||
os_user='stage'
|
||||
|
||||
geom = "geom"
|
||||
champ_travaux_prevus_multipolygon="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
champ_travaux_prevus_multilinestring="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))"""
|
||||
champ_travaux_prevus_point = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, x_wgs84 double precision, y_wgs84 double precision, date_creation date, date_maj date, geom geometry(Point,2154))"""
|
||||
|
||||
champ_viergePolygone = """(gid serial NOT NULL, commentaire text, surface_m2 double precision, surface_ha double precision, geom geometry(MultiPolygon,2154))"""
|
||||
champ_viergeLigne = """(gid serial NOT NULL, commentaire text, longueur_m double precision, longueur_km double precision, geom geometry(MultiLineString,2154))"""
|
||||
champ_viergePoint = """(gid serial NOT NULL, commentaire text, x_wgs84 double precision, y_wgs84 double precision, geom geometry(Point,2154))"""
|
||||
|
||||
champ_habitat = """(gid serial NOT NULL, cd_cb_01 text, lb_cb97_fr_01 text, occupation_01 integer, cd_cb_02 text, lb_cb97_fr_02 text, occupation_02 integer, cd_cb_03 text, lb_cb97_fr_03 text, occupation_03 integer, milieu_code text, milieu_libelle text, surface_m2 double precision, surface_ha double precision, commentaire text, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
|
||||
champ_contour="""(gid serial NOT NULL, date_creation date, date_maj date, utilisateur character varying, dept character(2), nom character varying, surface_m2 double precision, surface_ha double precision, type_site character varying, type_milieu character varying, date_premier_pg integer, date_debut_pg integer, date_fin_pg integer, referent character varying, gestion_deleguee character varying, terrain_militaire character(3), ens character(3), zh character(3), adapt_pmr character(3), inform character(3), guide character(3), ouverture_public character(3), obs character(3), anim character(3), n2000_anim character(3), contrat_n2000_conseil character(3), n2000_op character(3), contrat_n2000_benef character(3), contrat_agri character(3), bc_habitat integer, bc_amphibien integer, bc_coleoptere integer, bc_crustace integer, bc_mammifere integer, bc_chiroptere integer, bc_mollusque integer, bc_odonate integer, bc_oiseau integer, bc_orthoptere integer, bc_poisson integer, bc_reptile integer, bc_rhopalocere integer, bc_heterocere integer, bc_autre_invertebre integer, bc_flore integer, bc_bryophyte integer, bc_champignon integer, suiv_analyse_sol character(3), suiv_piezo character(3), suiv_climat character(3), suiv_topo character(3), suiv_habitat character(3), suiv_amphibien character(3), suiv_coleoptere character(3), suiv_crustace character(3), suiv_mammifere character(3), suiv_chiroptere character(3), suiv_mollusque character(3), suiv_odonate character(3), suiv_oiseau character(3), suiv_orthoptere character(3), suiv_poisson character(3), suiv_reptile character(3), suiv_rhopalocere character(3), suiv_heterocere character(3), suiv_autre_invertebre character(3), suiv_flore character(3), suiv_bryophyte character(3), suiv_champignon character(3), suiv_analyse_eau character(3), suiv_phenologie character(3), suiv_frequentation character(3), suiv_paysager character(3), suiv_autre character(3), commentaire text, geom geometry(MultiPolygon,2154))
|
||||
"""
|
||||
|
||||
champ_vegethab_point = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
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,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(Point,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multilinestring = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
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,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiLineString,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multipolygon = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiPolygon,2154)
|
||||
)
|
||||
|
||||
geom = "geom"
|
||||
champ_travaux_prevus_multipolygon="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
champ_travaux_prevus_multilinestring="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))"""
|
||||
champ_travaux_prevus_point = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, x_wgs84 double precision, y_wgs84 double precision, date_creation date, date_maj date, geom geometry(Point,2154))"""
|
||||
|
||||
champ_viergePolygone = """(gid serial NOT NULL, commentaire text, surface_m2 double precision, surface_ha double precision, geom geometry(MultiPolygon,2154))"""
|
||||
champ_viergeLigne = """(gid serial NOT NULL, commentaire text, longueur_m double precision, longueur_km double precision, geom geometry(MultiLineString,2154))"""
|
||||
champ_viergePoint = """(gid serial NOT NULL, commentaire text, x_wgs84 double precision, y_wgs84 double precision, geom geometry(Point,2154))"""
|
||||
|
||||
champ_habitat = """(gid serial NOT NULL, cd_cb_01 text, lb_cb97_fr_01 text, occupation_01 integer, cd_cb_02 text, lb_cb97_fr_02 text, occupation_02 integer, cd_cb_03 text, lb_cb97_fr_03 text, occupation_03 integer, milieu_code text, milieu_libelle text, surface_m2 double precision, surface_ha double precision, commentaire text, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
|
||||
champ_contour="""(gid serial NOT NULL, date_creation date, date_maj date, utilisateur character varying, dept character(2), nom character varying, surface_m2 double precision, surface_ha double precision, type_site character varying, type_milieu character varying, date_premier_pg integer, date_debut_pg integer, date_fin_pg integer, referent character varying, gestion_deleguee character varying, terrain_militaire character(3), ens character(3), zh character(3), adapt_pmr character(3), inform character(3), guide character(3), ouverture_public character(3), obs character(3), anim character(3), n2000_anim character(3), contrat_n2000_conseil character(3), n2000_op character(3), contrat_n2000_benef character(3), contrat_agri character(3), bc_habitat integer, bc_amphibien integer, bc_coleoptere integer, bc_crustace integer, bc_mammifere integer, bc_chiroptere integer, bc_mollusque integer, bc_odonate integer, bc_oiseau integer, bc_orthoptere integer, bc_poisson integer, bc_reptile integer, bc_rhopalocere integer, bc_heterocere integer, bc_autre_invertebre integer, bc_flore integer, bc_bryophyte integer, bc_champignon integer, suiv_analyse_sol character(3), suiv_piezo character(3), suiv_climat character(3), suiv_topo character(3), suiv_habitat character(3), suiv_amphibien character(3), suiv_coleoptere character(3), suiv_crustace character(3), suiv_mammifere character(3), suiv_chiroptere character(3), suiv_mollusque character(3), suiv_odonate character(3), suiv_oiseau character(3), suiv_orthoptere character(3), suiv_poisson character(3), suiv_reptile character(3), suiv_rhopalocere character(3), suiv_heterocere character(3), suiv_autre_invertebre character(3), suiv_flore character(3), suiv_bryophyte character(3), suiv_champignon character(3), suiv_analyse_eau character(3), suiv_phenologie character(3), suiv_frequentation character(3), suiv_paysager character(3), suiv_autre character(3), commentaire text, geom geometry(MultiPolygon,2154))
|
||||
"""
|
||||
|
||||
champ_vegethab_point = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
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,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(Point,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multilinestring = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
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,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiLineString,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multipolygon = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiPolygon,2154)
|
||||
)
|
||||
"""
|
||||
|
After Width: | Height: | Size: 4.8 KiB |
@@ -6,8 +6,10 @@ import tempfile
|
||||
import base64
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
import os
|
||||
from os.path import abspath, join, pardir, dirname
|
||||
|
||||
from qgis.core import QgsDataSourceUri
|
||||
from .SQLRequet import *
|
||||
from qgis.PyQt import uic
|
||||
|
||||
__copyright__ = "Copyright 2019, 3Liz"
|
||||
@@ -17,167 +19,513 @@ __revision__ = "$Format:%H$"
|
||||
|
||||
|
||||
def plugin_path(*args):
|
||||
"""Get the path to plugin root folder.
|
||||
"""Get the path to plugin root folder.
|
||||
|
||||
:param args List of path elements e.g. ['img', 'logos', 'image.png']
|
||||
:type args: str
|
||||
: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: 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
|
||||
return path
|
||||
|
||||
|
||||
def plugin_name():
|
||||
"""Return the plugin name according to metadata.txt.
|
||||
"""Return the plugin name according to metadata.txt.
|
||||
|
||||
:return: The plugin name.
|
||||
:rtype: basestring
|
||||
"""
|
||||
metadata = metadata_config()
|
||||
name = metadata["general"]["name"]
|
||||
return name
|
||||
: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.
|
||||
"""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
|
||||
: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.
|
||||
"""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 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
|
||||
: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))
|
||||
: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
|
||||
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.
|
||||
"""Get the path to our resources folder.
|
||||
|
||||
:param args List of path elements e.g. ['img', 'logos', 'image.png']
|
||||
:type args: str
|
||||
: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_POSTGIS\\tools")))
|
||||
for item in args:
|
||||
path = abspath(join(path, item))
|
||||
return path
|
||||
:return: Absolute path to the resources folder.
|
||||
:rtype: str
|
||||
"""
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_POSTGIS\\tools")))
|
||||
for item in args:
|
||||
path = abspath(join(path, item))
|
||||
return path
|
||||
|
||||
|
||||
def load_ui(*args):
|
||||
"""Get compile UI file.
|
||||
"""Get compile UI file.
|
||||
|
||||
:param args List of path elements e.g. ['img', 'logos', 'image.png']
|
||||
:type args: str
|
||||
: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: Compiled UI file.
|
||||
"""
|
||||
ui_class, _ = uic.loadUiType(resources_path("ui", *args))
|
||||
|
||||
return ui_class
|
||||
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}
|
||||
def pyperclip():
|
||||
dst = dirname(dirname(__file__))+"\\tools\\"
|
||||
if os.access('N:/',os.R_OK):
|
||||
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
|
||||
try:
|
||||
urllib.request.urlopen('https://google.com')
|
||||
binar = True
|
||||
shutil.copy(src, dst)
|
||||
except:
|
||||
binar = False
|
||||
r = ''
|
||||
if binar:
|
||||
r = requests.post(url, data=json.dumps(payload), headers=headers)
|
||||
return r
|
||||
print('404')
|
||||
|
||||
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}
|
||||
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.request
|
||||
iface = qgis.utils.iface
|
||||
from qgis.core import Qgis
|
||||
import qgis
|
||||
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 = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
|
||||
url = qgis.utils.pluginMetadata(NAME,'repository')
|
||||
#URL = url+'/raw/branch/main/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
|
||||
# print(URL)
|
||||
version = qgis.utils.pluginMetadata(NAME,'version')
|
||||
len_version = 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('<version>',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)
|
||||
version = qgis.utils.pluginMetadata(NAME,'version')
|
||||
len_version = len(version)
|
||||
try:
|
||||
urllib.request.urlopen('https://google.com')
|
||||
binar = True
|
||||
except:
|
||||
binar = False
|
||||
if binar:
|
||||
try:
|
||||
version_web = str(urllib.request.urlopen(URL).read())
|
||||
plugin_num = version_web.find(NAME)
|
||||
valeur_version_web = version_web.find('<version>',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)
|
||||
except:
|
||||
print("error gitea version ssl")
|
||||
else:
|
||||
iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
|
||||
|
||||
def devlog(NAME):
|
||||
import qgis
|
||||
devmaj = '<head><style>* {margin:0; padding:0; }</style></head>'
|
||||
devmaj = devmaj+qgis.utils.pluginMetadata(NAME,'changelog')
|
||||
return devmaj
|
||||
import qgis
|
||||
devmaj = '<head><style>* {margin:0; padding:0; }</style></head>'
|
||||
devmaj = devmaj+qgis.utils.pluginMetadata(NAME,'changelog')
|
||||
return devmaj
|
||||
|
||||
def create_contour(self,schema,cur,con,host ,port ,dbname ,user ,mdp):
|
||||
### Creation de la table contour
|
||||
if self.couche_contour.isChecked(): # Verifie si la checkbox est cochee
|
||||
if self.annee_1.text() == 'aaaa' or self.annee_1.text() == '':
|
||||
tablename = schema + "_contour"
|
||||
else :
|
||||
tablename = schema + "_contour_" + self.annee_1.text()
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
|
||||
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+ tablename+"','gid')"
|
||||
SQL_contour = "CREATE TABLE " + schema + "."+ tablename + champ_contour
|
||||
|
||||
cur.execute(SQL_contour)
|
||||
cur.execute(RETURNE)
|
||||
sequence_name = cur.fetchone()[0]
|
||||
|
||||
SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename[len(schema):] + "_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 "+sequence_name+" TO grp_qgis;"
|
||||
|
||||
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")
|
||||
def create_travaux(self,schema,cur,con,host,port,dbname,user,mdp):
|
||||
### Creation de la table travaux prevus
|
||||
if self.couche_travaux_prevus.isChecked():
|
||||
#**********Poly
|
||||
if self.annee_5.text() == 'aaaa' or self.annee_5.text() == '':
|
||||
tablename = schema + "_travaux_prevus_poly"
|
||||
else :
|
||||
tablename = schema + "_travaux_prevus_poly_" + self.annee_5.text()
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
|
||||
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+ tablename+"','gid')"
|
||||
SQL_travaux_prevus = "CREATE TABLE " + schema + "."+ tablename + champ_travaux_prevus_multipolygon
|
||||
|
||||
cur.execute(SQL_travaux_prevus)
|
||||
cur.execute(RETURNE)
|
||||
sequence_name = cur.fetchone()[0]
|
||||
|
||||
|
||||
SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename[len(schema):] + "_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 "+sequence_name+" TO grp_qgis;"
|
||||
|
||||
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.annee_5.text() == 'aaaa' or self.annee_5.text() == '':
|
||||
tablename = schema + "_travaux_prevus_ligne"
|
||||
else :
|
||||
tablename = schema + "_travaux_prevus_ligne_" + self.annee_5.text()
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
|
||||
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+ tablename+"','gid')"
|
||||
SQL_travaux_prevus = "CREATE TABLE " + schema + "."+ tablename + champ_travaux_prevus_multilinestring
|
||||
|
||||
cur.execute(SQL_travaux_prevus)
|
||||
cur.execute(RETURNE)
|
||||
sequence_name = cur.fetchone()[0]
|
||||
|
||||
SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename[len(schema):] + "_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 "+sequence_name+" TO grp_qgis;"
|
||||
|
||||
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.annee_5.text() == 'aaaa' or self.annee_5.text() == '':
|
||||
tablename = schema + "_travaux_prevus_point"
|
||||
else :
|
||||
tablename = schema + "_travaux_prevus_point_" + self.annee_5.text()
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
|
||||
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+ tablename+"','gid')"
|
||||
SQL_travaux_prevus = "CREATE TABLE " + schema + "."+ tablename + champ_travaux_prevus_point
|
||||
|
||||
cur.execute(SQL_travaux_prevus)
|
||||
cur.execute(RETURNE)
|
||||
sequence_name = cur.fetchone()[0]
|
||||
|
||||
SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename[len(schema):] + "_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 "+sequence_name+" TO grp_qgis;"
|
||||
|
||||
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")
|
||||
|
||||
def create_habita(self,schema,cur,con,host ,port ,dbname ,user ,mdp):
|
||||
### Creation de la table habitat
|
||||
if self.couche_habitat.isChecked():
|
||||
if self.annee_2.text() == 'aaaa' or self.annee_2.text() == '':
|
||||
tablename = schema + "_habitat"
|
||||
else :
|
||||
tablename = schema + "_habitat_" + self.annee_2.text()
|
||||
|
||||
tablename_1=tablename+"_points"
|
||||
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+tablename_1+"','gid')"
|
||||
tablename_qgis = tablename_1[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
SQL_VEGETHAB = "CREATE TABLE "+ schema + "."+ tablename_1 + champ_vegethab_point
|
||||
|
||||
print(RETURNE)
|
||||
print('')
|
||||
print(SQL_VEGETHAB)
|
||||
cur.execute(SQL_VEGETHAB)
|
||||
cur.execute(RETURNE)
|
||||
sequence_name = cur.fetchone()[0]
|
||||
|
||||
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 "+sequence_name+" TO grp_qgis;"
|
||||
|
||||
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"
|
||||
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+ tablename_2+"','gid')"
|
||||
tablename_qgis = tablename_2[1:]
|
||||
SQL_VEGETHAB = "CREATE TABLE "+ schema + "."+ tablename_2 + champ_vegethab_multilinestring
|
||||
|
||||
cur.execute(SQL_VEGETHAB)
|
||||
cur.execute(RETURNE)
|
||||
sequence_name = cur.fetchone()[0]
|
||||
|
||||
SQL_pkey = "ALTER TABLE " + schema + "." + tablename_2 + " ADD CONSTRAINT " + tablename_2[len(schema):] + "_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 "+sequence_name+" TO grp_qgis;"
|
||||
|
||||
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"
|
||||
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+ tablename_3+"','gid')"
|
||||
tablename_qgis = tablename_3[1:]
|
||||
SQL_VEGETHAB = "CREATE TABLE "+ schema + "."+ tablename_3 + champ_vegethab_multipolygon
|
||||
|
||||
cur.execute(SQL_VEGETHAB)
|
||||
cur.execute(RETURNE)
|
||||
sequence_name = cur.fetchone()[0]
|
||||
|
||||
SQL_pkey = "ALTER TABLE " + schema + "." + tablename_3 + " ADD CONSTRAINT " + tablename_3[len(schema):] + "_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 "+sequence_name+" TO grp_qgis;"
|
||||
|
||||
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")
|
||||
def create_vierge(self,schema,cur,con,host ,port ,dbname ,user ,mdp):
|
||||
### Creation de la table vierge
|
||||
if self.couche_vierge.isChecked():
|
||||
if self.annee_4.text() == 'aaaa' or self.annee_4.text() == '':
|
||||
tablename = schema + "_" + self.nom_couche_vierge.text().lower()
|
||||
else :
|
||||
tablename = schema + "_" + self.nom_couche_vierge.text().lower() + "_" + self.annee_4.text()
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
|
||||
if self.couche_vierge_point.isChecked() == 1 :
|
||||
champ_vierge = champ_viergePoint
|
||||
|
||||
if self.couche_vierge_ligne.isChecked() == 1 :
|
||||
champ_vierge = champ_viergeLigne
|
||||
|
||||
if self.couche_vierge_polygone.isChecked() == 1 :
|
||||
champ_vierge = champ_viergePolygone
|
||||
|
||||
RETURNE = "SELECT pg_get_serial_sequence('"+schema + "."+ tablename+"','gid')"
|
||||
SQL_vierge = "CREATE TABLE " + schema + "."+ tablename + champ_vierge
|
||||
|
||||
cur.execute(SQL_vierge)
|
||||
cur.execute(RETURNE)
|
||||
sequence_name = cur.fetchone()[0]
|
||||
|
||||
SQL_pkey = "ALTER TABLE " + schema + "." + tablename + " ADD CONSTRAINT " + tablename[len(schema):] + "_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();"
|
||||
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 "+sequence_name+" TO grp_qgis;"
|
||||
|
||||
cur.execute(SQL_pkey)
|
||||
cur.execute(SQL_GRANT_TABLE)
|
||||
|
||||
if self.couche_vierge_point.isChecked() == 1 :
|
||||
cur.execute(SQL_trigger_coordonnees)
|
||||
|
||||
if self.couche_vierge_ligne.isChecked() == 1 :
|
||||
cur.execute(SQL_trigger_length_m)
|
||||
cur.execute(SQL_trigger_length_km)
|
||||
|
||||
if self.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")
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>table_postgis</class>
|
||||
<widget class="QDialog" name="table_postgis">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>533</width>
|
||||
<height>364</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Ajout d'une table</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="schema_label">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>1977</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Code analytique :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="schema"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Tester mon éligibilite :</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="compte">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Compte</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="couche">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Couche</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Les changement :</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Nouvau nom :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Partie a renommée :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="old_name">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<italic>true</italic>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="new_name"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Département/Animation :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="animation">
|
||||
<property name="text">
|
||||
<string>Animation territoriale</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="departement"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="Titre">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Renommée de table</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>table_postgis</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>table_postgis</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Metabase</string>
|
||||
<string>Journal des modifications</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
@@ -29,9 +29,6 @@
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -41,7 +38,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>547</height>
|
||||
<height>570</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
@@ -56,7 +53,7 @@
|
||||
<property name="title">
|
||||
<string>DevLog</string>
|
||||
</property>
|
||||
<widget class="QWebView" name="viewer" native="true">
|
||||
<widget class="QTextBrowser" name="viewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
@@ -65,11 +62,6 @@
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="url" stdset="0">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
@@ -78,19 +70,12 @@
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::NoButton</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtWebKitWidgets/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1,96 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CenRa_Metabase_editorwidget_base</class>
|
||||
<widget class="QDialog" name="CenRa_Metabase_editorwidget_base">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>471</width>
|
||||
<height>594</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Metabase</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>../../CenRa_Metabase/tools/ui/icon.svg</normaloff>../../CenRa_Metabase/tools/ui/icon.svg</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>547</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>451</width>
|
||||
<height>541</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>DevLog</string>
|
||||
</property>
|
||||
<widget class="QWebView" name="viewer" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>431</width>
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="url" stdset="0">
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">QtWebKitWidgets/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CenRa_Metabase_editorwidget_base</class>
|
||||
<widget class="QDialog" name="CenRa_Metabase_editorwidget_base">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>471</width>
|
||||
<height>594</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Journal des modifications</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>../../CenRa_Metabase/tools/ui/icon.svg</normaloff>../../CenRa_Metabase/tools/ui/icon.svg</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>570</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>451</width>
|
||||
<height>541</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>DevLog</string>
|
||||
</property>
|
||||
<widget class="QTextBrowser" name="viewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>431</width>
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::NoButton</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -12,12 +12,12 @@ ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
os.path.join(
|
||||
str(Path(__file__).resolve().parent.parent),
|
||||
'forms',
|
||||
'sicen_about_form.ui'
|
||||
'CenRa_about_form.ui'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class SicenAboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
class AboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
[general]
|
||||
name=CenRa SICEN
|
||||
qgisMinimumVersion=3.0
|
||||
supportsQt6=True
|
||||
description=Filtre des données saisies dans SICEN et export d'une liste d'espèces.
|
||||
version=1.7
|
||||
version=2.0
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
@@ -21,7 +22,7 @@ email=si_besoin@cen-rhonealpes.fr
|
||||
# Optional items:
|
||||
|
||||
# Uncomment the following line and add your changelog entries:
|
||||
changelog=<h2>CenRa_SICEN:</h2></br><p><h3>13/09/2024 - Version 1.7:</h3> - Il est maintenant possible de sélectionné plusieurs entité pour le filtre par Emprise.</br>- Ajoute d'un changelog.</br>- Ajoute une vérification de mise à jour.</p>
|
||||
changelog=<h2>CenRa_SICEN:</h2></br><p><h3>19/05/2025 - Version 2.0: </h3> Compatible PyQt5 et PyQt6</p></br><p><h3>09/04/2025 - Version 1.11: </h3> - Correctif bug en TT.</p></br><p><h3>09/04/2025 - Version 1.10: </h3> - Optimisation pour le TT.</p></br><p><h3>03/04/2025 - Version 1.9: </h3> - Mise a jour de securite.</p></br><p><h3>07/01/2025 - Version 1.8: </h3> - ByPass du certif ssl ci erreur.</br></p><p><h3>13/09/2024 - Version 1.7:</h3> - Il est maintenant possible de sélectionné plusieurs entité pour le filtre par Emprise.</br>- Ajoute d'un changelog.</br>- Ajoute une vérification de mise à jour.</p>
|
||||
|
||||
# tags are comma separated with spaces allowed
|
||||
tags=cenra, postgis, sicen
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
# Created by: The Resource Compiler for PyQt5 (Qt v5.15.2)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore
|
||||
|
||||
try:
|
||||
from PyQt5 import QtCore
|
||||
except:
|
||||
from PyQt6 import QtCore
|
||||
qt_resource_data = b"\
|
||||
\x00\x00\x0d\x89\
|
||||
\x89\
|
||||
|
||||
@@ -32,8 +32,12 @@ from qgis.utils import iface"""
|
||||
from builtins import str
|
||||
from builtins import object
|
||||
import os
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
try:
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
except:
|
||||
from PyQt6.QtCore import *
|
||||
from PyQt6.QtGui import *
|
||||
from qgis.PyQt import uic
|
||||
from qgis.core import *
|
||||
from qgis.core import QgsDataSourceUri, QgsWkbTypes, QgsLayerTreeGroup, QgsLayerTreeLayer
|
||||
@@ -45,19 +49,24 @@ from qgis.PyQt.QtWidgets import QMenu, QAction, QDialog, QDialogButtonBox, QLabe
|
||||
from . import resources_rc
|
||||
# Import the code for the dialog
|
||||
from .sicendialog import SICENDialog
|
||||
from .tools.PythonSQL import *
|
||||
from .tools.resources import maj_verif
|
||||
|
||||
from .tools.resources import maj_verif,pyperclip
|
||||
pyperclip()
|
||||
try:
|
||||
from .tools.PythonSQL import login_base
|
||||
except:
|
||||
print('Pas de fichier PythonSQL')
|
||||
import os.path
|
||||
import qgis
|
||||
import datetime
|
||||
import csv
|
||||
|
||||
from .forms.about_form import SicenAboutDialog
|
||||
from .forms.about_form import AboutDialog
|
||||
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
import base64
|
||||
#import socket
|
||||
import socket
|
||||
import os
|
||||
#import sys
|
||||
|
||||
@@ -100,6 +109,9 @@ class SICEN(object):
|
||||
self.action = QAction(
|
||||
QIcon(":/plugins/sicen/sicen.png"),
|
||||
u"Ouverture des données SICEN", self.iface.mainWindow())
|
||||
self.action.setEnabled(False)
|
||||
if os.access('N:/',os.R_OK):
|
||||
self.action.setEnabled(True)
|
||||
# connect the action to the run method
|
||||
self.action.triggered.connect(self.ouverture)
|
||||
|
||||
@@ -111,6 +123,14 @@ class SICEN(object):
|
||||
self.action = QAction(
|
||||
QIcon(":/plugins/sicen/sicen_export.png"),
|
||||
u"Export liste d'espèces", self.iface.mainWindow())
|
||||
self.action.setEnabled(False)
|
||||
IPAddr=socket.gethostbyname(socket.gethostname())
|
||||
if IPAddr[0:11] == "100.100.100":
|
||||
self.action.setEnabled(True)
|
||||
elif IPAddr[0:9] == "192.168.0":
|
||||
self.action.setEnabled(True)
|
||||
elif IPAddr[0:9] == "192.168.1":
|
||||
self.action.setEnabled(True)
|
||||
# connect the action to the run method
|
||||
self.action.triggered.connect(self.export)
|
||||
|
||||
@@ -135,8 +155,8 @@ class SICEN(object):
|
||||
self.sicen_export.triggered.connect(self.export)
|
||||
|
||||
def open_about_dialog(self):
|
||||
dialog = SicenAboutDialog(self.iface)
|
||||
dialog.exec_()
|
||||
dialog = AboutDialog(self.iface)
|
||||
dialog.exec()
|
||||
|
||||
def unload(self):
|
||||
# Remove the plugin menu item and icon
|
||||
@@ -146,16 +166,14 @@ class SICEN(object):
|
||||
# run method that performs all the real work
|
||||
def ouverture(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()
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
|
||||
## Creation des listes deroulantes
|
||||
# Listing de valeur des champs
|
||||
@@ -251,20 +269,18 @@ class SICEN(object):
|
||||
# show the dialog
|
||||
self.dlg.show()
|
||||
# Run the dialog event loop
|
||||
result = self.dlg.exec_()
|
||||
result = self.dlg.exec()
|
||||
# See if OK was pressed
|
||||
if result == 1:
|
||||
|
||||
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()
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
|
||||
# Requete filtre observateur
|
||||
if self.dlg.observateur_1.currentIndex() != -1 :
|
||||
@@ -620,15 +636,14 @@ class SICEN(object):
|
||||
|
||||
else :
|
||||
|
||||
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()
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
|
||||
# Creation group de couches
|
||||
#i = qgis.utils.iface
|
||||
@@ -753,15 +768,14 @@ class SICEN(object):
|
||||
|
||||
else :
|
||||
|
||||
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()
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
|
||||
# Creation group de couches
|
||||
i = qgis.utils.iface
|
||||
@@ -862,16 +876,14 @@ class SICEN(object):
|
||||
|
||||
buffer = '100'
|
||||
|
||||
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()
|
||||
account = login_base("account")
|
||||
user = account[0]
|
||||
mdp = account[1]
|
||||
host = account[2]
|
||||
port = account[3]
|
||||
dbname = account[4]
|
||||
cur = account[7]
|
||||
con = account[8]
|
||||
|
||||
SQL_list_sp = u"""SELECT DISTINCT classe::text,ordre::text,nom_complet::text,split_part(nom_vern::text,',',1) as nom_vern,cd_ref::text as cd_ref,max(COALESCE(date_obs, date_debut_obs))::text AS derniere_obs FROM _agregation_ra.observations_table WHERE ST_intersects(geometrie,ST_Buffer(ST_geomFromText('""" + poly + "',2154), " + buffer + " ))GROUP BY classe::text, ordre::text, nom_complet::text, nom_vern::text, cd_ref::text ORDER BY nom_complet::text"""
|
||||
cur.execute(SQL_list_sp)
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
from qgis.core import QgsApplication
|
||||
|
||||
def gitea():
|
||||
file_url = QgsApplication.qgisSettingsDirPath()+'QGIS/QGIS3.ini'
|
||||
recherche_1 = 'plugin_repositories\\github\\url=https://github.com/CEN-Rhone-Alpes/Plugin_QGIS/releases/latest/download/plugins.xml'
|
||||
replace_1 = 'plugin_repositories\\gitea\\url=https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
|
||||
|
||||
recherche_2 = 'github'
|
||||
replace_2 = 'gitea'
|
||||
|
||||
# Read in the file
|
||||
with open(file_url, 'r') as file:
|
||||
filedata = file.read()
|
||||
|
||||
# Replace the target string
|
||||
filedata = filedata.replace(recherche_1, replace_1)
|
||||
filedata = filedata.replace(recherche_2, replace_2)
|
||||
|
||||
# Write the file out again
|
||||
with open(file_url, 'w') as file:
|
||||
file.write(filedata)
|
||||
@@ -1,172 +0,0 @@
|
||||
import sys
|
||||
import socket
|
||||
import os
|
||||
IPAddr=socket.gethostbyname(socket.gethostname())
|
||||
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'
|
||||
|
||||
geom = "geom"
|
||||
champ_travaux_prevus_multipolygon="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, surface_m2 double precision, surface_ha double precision, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
champ_travaux_prevus_multilinestring="""(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, longueur_m double precision, longueur_km double precision, date_creation date, date_maj date, geom geometry(MultiLineString,2154))"""
|
||||
champ_travaux_prevus_point = """(gid serial NOT NULL, groupe_gestion text, gestion_lib text, id_gestion text, datedebut date, datefin date, commentaire text, x_wgs84 double precision, y_wgs84 double precision, date_creation date, date_maj date, geom geometry(Point,2154))"""
|
||||
|
||||
champ_viergePolygone = """(gid serial NOT NULL, commentaire text, surface_m2 double precision, surface_ha double precision, geom geometry(MultiPolygon,2154))"""
|
||||
champ_viergeLigne = """(gid serial NOT NULL, commentaire text, longueur_m double precision, longueur_km double precision, geom geometry(MultiLineString,2154))"""
|
||||
champ_viergePoint = """(gid serial NOT NULL, commentaire text, x_wgs84 double precision, y_wgs84 double precision, geom geometry(Point,2154))"""
|
||||
|
||||
champ_habitat = """(gid serial NOT NULL, cd_cb_01 text, lb_cb97_fr_01 text, occupation_01 integer, cd_cb_02 text, lb_cb97_fr_02 text, occupation_02 integer, cd_cb_03 text, lb_cb97_fr_03 text, occupation_03 integer, milieu_code text, milieu_libelle text, surface_m2 double precision, surface_ha double precision, commentaire text, date_creation date, date_maj date, geom geometry(MultiPolygon,2154))"""
|
||||
|
||||
champ_contour="""(gid serial NOT NULL, date_creation date, date_maj date, utilisateur character varying, dept character(2), nom character varying, surface_m2 double precision, surface_ha double precision, type_site character varying, type_milieu character varying, date_premier_pg integer, date_debut_pg integer, date_fin_pg integer, referent character varying, gestion_deleguee character varying, terrain_militaire character(3), ens character(3), zh character(3), adapt_pmr character(3), inform character(3), guide character(3), ouverture_public character(3), obs character(3), anim character(3), n2000_anim character(3), contrat_n2000_conseil character(3), n2000_op character(3), contrat_n2000_benef character(3), contrat_agri character(3), bc_habitat integer, bc_amphibien integer, bc_coleoptere integer, bc_crustace integer, bc_mammifere integer, bc_chiroptere integer, bc_mollusque integer, bc_odonate integer, bc_oiseau integer, bc_orthoptere integer, bc_poisson integer, bc_reptile integer, bc_rhopalocere integer, bc_heterocere integer, bc_autre_invertebre integer, bc_flore integer, bc_bryophyte integer, bc_champignon integer, suiv_analyse_sol character(3), suiv_piezo character(3), suiv_climat character(3), suiv_topo character(3), suiv_habitat character(3), suiv_amphibien character(3), suiv_coleoptere character(3), suiv_crustace character(3), suiv_mammifere character(3), suiv_chiroptere character(3), suiv_mollusque character(3), suiv_odonate character(3), suiv_oiseau character(3), suiv_orthoptere character(3), suiv_poisson character(3), suiv_reptile character(3), suiv_rhopalocere character(3), suiv_heterocere character(3), suiv_autre_invertebre character(3), suiv_flore character(3), suiv_bryophyte character(3), suiv_champignon character(3), suiv_analyse_eau character(3), suiv_phenologie character(3), suiv_frequentation character(3), suiv_paysager character(3), suiv_autre character(3), commentaire text, geom geometry(MultiPolygon,2154))
|
||||
"""
|
||||
|
||||
champ_vegethab_point = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(Point,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multilinestring = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiLineString,2154)
|
||||
)
|
||||
"""
|
||||
champ_vegethab_multipolygon = """(
|
||||
gid serial NOT NULL ,
|
||||
cd_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_01 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_1 bigint,
|
||||
cd_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_02 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_2 bigint,
|
||||
cd_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
lb_eu_03 character varying(254) COLLATE pg_catalog."default",
|
||||
occupati_3 bigint,
|
||||
milieu_cod character varying(254) COLLATE pg_catalog."default",
|
||||
milieu_lib character varying(254) COLLATE pg_catalog."default",
|
||||
surface_m2 numeric,
|
||||
surface_ha numeric,
|
||||
commentair character varying(254) COLLATE pg_catalog."default",
|
||||
date_creat date,
|
||||
date_maj date,
|
||||
num_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
type_unite character varying(254) COLLATE pg_catalog."default",
|
||||
dynamique character varying(254) COLLATE pg_catalog."default",
|
||||
gestio_obs character varying(254) COLLATE pg_catalog."default",
|
||||
degrad_obs character varying(254) COLLATE pg_catalog."default",
|
||||
eta_conser character varying(254) COLLATE pg_catalog."default",
|
||||
clas_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
syntaxon character varying(254) COLLATE pg_catalog."default",
|
||||
n2000 character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_aura character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbna character varying(254) COLLATE pg_catalog."default",
|
||||
lrr_cbnmc character varying(254) COLLATE pg_catalog."default",
|
||||
vege_enjeu character varying(254) COLLATE pg_catalog."default",
|
||||
num_photo character varying(254) COLLATE pg_catalog."default",
|
||||
nature_obs character varying(254) COLLATE pg_catalog."default",
|
||||
date_sais date,
|
||||
s_al_phyto character varying(254) COLLATE pg_catalog."default",
|
||||
alli_name character varying(254) COLLATE pg_catalog."default",
|
||||
salli_name character varying(254) COLLATE pg_catalog."default",
|
||||
class_name character varying(254) COLLATE pg_catalog."default",
|
||||
geom geometry(MultiPolygon,2154)
|
||||
)
|
||||
"""
|
||||
@@ -3,6 +3,7 @@
|
||||
import configparser
|
||||
import shutil
|
||||
import tempfile
|
||||
import os
|
||||
import base64
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
@@ -89,7 +90,7 @@ def resources_path(*args):
|
||||
:return: Absolute path to the resources folder.
|
||||
:rtype: str
|
||||
"""
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_Metabase\\tools")))
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_SICEN\\tools")))
|
||||
for item in args:
|
||||
path = abspath(join(path, item))
|
||||
return path
|
||||
@@ -107,24 +108,15 @@ def load_ui(*args):
|
||||
|
||||
return ui_class
|
||||
|
||||
def login_base(take=None):
|
||||
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 + "')")
|
||||
res_ident = first_cur.fetchone()
|
||||
mdp = base64.b64decode(str(res_ident[0])).decode('utf-8')
|
||||
user = res_ident[1]
|
||||
def pyperclip():
|
||||
dst = dirname(dirname(__file__))+"\\tools\\"
|
||||
if os.access('N:/',os.R_OK):
|
||||
src = 'N:/SI_Systeme d information/Z_QGIS/PLUGIN/PythonSQL.py'
|
||||
try:
|
||||
shutil.copy(src, dst)
|
||||
except:
|
||||
print('404')
|
||||
|
||||
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
|
||||
@@ -157,7 +149,7 @@ def maj_verif(NAME):
|
||||
|
||||
url = qgis.utils.pluginMetadata(NAME,'repository')
|
||||
#URL = url+'/raw/branch/main/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/releases/plugins.xml'
|
||||
URL = 'https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/plugins.xml'
|
||||
# print(URL)
|
||||
version = qgis.utils.pluginMetadata(NAME,'version')
|
||||
len_version = len(version)
|
||||
@@ -167,15 +159,18 @@ def maj_verif(NAME):
|
||||
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('<version>',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)
|
||||
try:
|
||||
version_web = str(urllib.request.urlopen(URL).read())
|
||||
plugin_num = version_web.find(NAME)
|
||||
valeur_version_web = version_web.find('<version>',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)
|
||||
except:
|
||||
print("error gitea version ssl")
|
||||
else:
|
||||
iface.messageBar().pushMessage("WiFi :", "Pas de connection à internet.", level=Qgis.Warning, duration=30)
|
||||
return version_plugin
|
||||
#return version_plugin
|
||||
|
||||
def devlog(NAME):
|
||||
import qgis
|
||||
|
||||
@@ -33,8 +33,8 @@ class Ui_SICEN(object):
|
||||
SICEN.resize(592, 556)
|
||||
self.buttonBox = QDialogButtonBox(SICEN)
|
||||
self.buttonBox.setGeometry(QtCore.QRect(390, 520, 161, 32))
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
|
||||
#self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QDialogButtonBox.StandardButton(0x00400000)|QDialogButtonBox.StandardButton(0x00000400))
|
||||
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
|
||||
self.Titre = QLabel(SICEN)
|
||||
self.Titre.setGeometry(QtCore.QRect(110, 10, 331, 31))
|
||||
@@ -46,8 +46,8 @@ class Ui_SICEN(object):
|
||||
self.Titre.setObjectName(_fromUtf8("Titre"))
|
||||
self.Emprise = QTabWidget(SICEN)
|
||||
self.Emprise.setGeometry(QtCore.QRect(10, 80, 571, 431))
|
||||
self.Emprise.setTabPosition(QTabWidget.North)
|
||||
self.Emprise.setTabShape(QTabWidget.Rounded)
|
||||
self.Emprise.setTabPosition(QTabWidget.TabPosition(0))
|
||||
self.Emprise.setTabShape(QTabWidget.TabShape(0))
|
||||
self.Emprise.setObjectName(_fromUtf8("Emprise"))
|
||||
self.tab_2 = QWidget()
|
||||
self.tab_2.setObjectName(_fromUtf8("tab_2"))
|
||||
@@ -57,7 +57,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.groupBox_4.setFont(font)
|
||||
self.groupBox_4.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.groupBox_4.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.groupBox_4.setObjectName(_fromUtf8("groupBox_4"))
|
||||
self.gridLayoutWidget_5 = QWidget(self.groupBox_4)
|
||||
self.gridLayoutWidget_5.setGeometry(QtCore.QRect(10, 20, 521, 51))
|
||||
@@ -99,7 +99,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.groupBox_5.setFont(font)
|
||||
self.groupBox_5.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.groupBox_5.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.groupBox_5.setObjectName(_fromUtf8("groupBox_5"))
|
||||
self.gridLayoutWidget_6 = QWidget(self.groupBox_5)
|
||||
self.gridLayoutWidget_6.setGeometry(QtCore.QRect(10, 20, 521, 41))
|
||||
@@ -113,7 +113,7 @@ class Ui_SICEN(object):
|
||||
font.setItalic(True)
|
||||
font.setWeight(50)
|
||||
self.label.setFont(font)
|
||||
self.label.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.label.setObjectName(_fromUtf8("label"))
|
||||
self.gridLayout_6.addWidget(self.label, 0, 0, 1, 1)
|
||||
self.label_2 = QLabel(self.gridLayoutWidget_6)
|
||||
@@ -122,7 +122,7 @@ class Ui_SICEN(object):
|
||||
font.setItalic(True)
|
||||
font.setWeight(50)
|
||||
self.label_2.setFont(font)
|
||||
self.label_2.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_2.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.label_2.setObjectName(_fromUtf8("label_2"))
|
||||
self.gridLayout_6.addWidget(self.label_2, 0, 1, 1, 1)
|
||||
self.nom_com_1 = QComboBox(self.gridLayoutWidget_6)
|
||||
@@ -147,7 +147,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.groupBox_7.setFont(font)
|
||||
self.groupBox_7.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.groupBox_7.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.groupBox_7.setObjectName(_fromUtf8("groupBox_7"))
|
||||
self.gridLayoutWidget_8 = QWidget(self.groupBox_7)
|
||||
self.gridLayoutWidget_8.setGeometry(QtCore.QRect(10, 20, 520, 191))
|
||||
@@ -161,7 +161,7 @@ class Ui_SICEN(object):
|
||||
font.setItalic(True)
|
||||
font.setWeight(50)
|
||||
self.label_3.setFont(font)
|
||||
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_3.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.label_3.setObjectName(_fromUtf8("label_3"))
|
||||
self.gridLayout_8.addWidget(self.label_3, 0, 0, 1, 1)
|
||||
self.label_4 = QLabel(self.gridLayoutWidget_8)
|
||||
@@ -170,7 +170,7 @@ class Ui_SICEN(object):
|
||||
font.setItalic(True)
|
||||
font.setWeight(50)
|
||||
self.label_4.setFont(font)
|
||||
self.label_4.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_4.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.label_4.setObjectName(_fromUtf8("label_4"))
|
||||
self.gridLayout_8.addWidget(self.label_4, 0, 1, 1, 1)
|
||||
self.date_min = QCalendarWidget(self.gridLayoutWidget_8)
|
||||
@@ -188,7 +188,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.groupBox_8.setFont(font)
|
||||
self.groupBox_8.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.groupBox_8.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.groupBox_8.setObjectName(_fromUtf8("groupBox_8"))
|
||||
self.gridLayoutWidget_9 = QWidget(self.groupBox_8)
|
||||
self.gridLayoutWidget_9.setGeometry(QtCore.QRect(10, 20, 491, 21))
|
||||
@@ -202,7 +202,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.Animalia.setFont(font)
|
||||
self.Animalia.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.Animalia.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.Animalia.setObjectName(_fromUtf8("Animalia"))
|
||||
self.gridLayout_9.addWidget(self.Animalia, 0, 0, 1, 1)
|
||||
self.Plantae = QCheckBox(self.gridLayoutWidget_9)
|
||||
@@ -226,8 +226,8 @@ class Ui_SICEN(object):
|
||||
font.setItalic(True)
|
||||
font.setWeight(50)
|
||||
self.label_6.setFont(font)
|
||||
self.label_6.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
self.label_6.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_6.setLayoutDirection(QtCore.Qt.LayoutDirection(0))
|
||||
self.label_6.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.label_6.setObjectName(_fromUtf8("label_6"))
|
||||
self.gridLayout_11.addWidget(self.label_6, 4, 0, 1, 1)
|
||||
self.nom_vern = QComboBox(self.gridLayoutWidget_10)
|
||||
@@ -245,7 +245,7 @@ class Ui_SICEN(object):
|
||||
font.setItalic(True)
|
||||
font.setWeight(50)
|
||||
self.label_5.setFont(font)
|
||||
self.label_5.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_5.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.label_5.setObjectName(_fromUtf8("label_5"))
|
||||
self.gridLayout_11.addWidget(self.label_5, 2, 0, 1, 1)
|
||||
self.nom_complet = QComboBox(self.gridLayoutWidget_10)
|
||||
@@ -271,7 +271,7 @@ class Ui_SICEN(object):
|
||||
font.setItalic(True)
|
||||
font.setWeight(50)
|
||||
self.label_13.setFont(font)
|
||||
self.label_13.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.label_13.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.label_13.setObjectName(_fromUtf8("label_13"))
|
||||
self.gridLayout_11.addWidget(self.label_13, 0, 0, 1, 1)
|
||||
self.Emprise.addTab(self.tab, _fromUtf8(""))
|
||||
@@ -279,8 +279,8 @@ class Ui_SICEN(object):
|
||||
self.tab_3.setObjectName(_fromUtf8("tab_3"))
|
||||
self.protections = QToolBox(self.tab_3)
|
||||
self.protections.setGeometry(QtCore.QRect(10, 10, 511, 391))
|
||||
self.protections.setFrameShape(QFrame.NoFrame)
|
||||
self.protections.setFrameShadow(QFrame.Plain)
|
||||
self.protections.setFrameShape(QFrame.Shape(0))
|
||||
self.protections.setFrameShadow(QFrame.Shadow(0x0010))
|
||||
self.protections.setLineWidth(1)
|
||||
self.protections.setObjectName(_fromUtf8("protections"))
|
||||
self.page_2 = QWidget()
|
||||
@@ -292,7 +292,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.groupBox.setFont(font)
|
||||
self.groupBox.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.groupBox.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.groupBox.setObjectName(_fromUtf8("groupBox"))
|
||||
self.gridLayoutWidget_2 = QWidget(self.groupBox)
|
||||
self.gridLayoutWidget_2.setGeometry(QtCore.QRect(10, 20, 491, 88))
|
||||
@@ -306,7 +306,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.LRD_38.setFont(font)
|
||||
self.LRD_38.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.LRD_38.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.LRD_38.setObjectName(_fromUtf8("LRD_38"))
|
||||
self.gridLayout_2.addWidget(self.LRD_38, 3, 0, 1, 1)
|
||||
self.LRD_01 = QCheckBox(self.gridLayoutWidget_2)
|
||||
@@ -314,7 +314,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.LRD_01.setFont(font)
|
||||
self.LRD_01.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.LRD_01.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.LRD_01.setObjectName(_fromUtf8("LRD_01"))
|
||||
self.gridLayout_2.addWidget(self.LRD_01, 0, 0, 1, 1)
|
||||
self.LRD_07 = QCheckBox(self.gridLayoutWidget_2)
|
||||
@@ -322,7 +322,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.LRD_07.setFont(font)
|
||||
self.LRD_07.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.LRD_07.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.LRD_07.setObjectName(_fromUtf8("LRD_07"))
|
||||
self.gridLayout_2.addWidget(self.LRD_07, 1, 0, 1, 1)
|
||||
self.LRD_26 = QCheckBox(self.gridLayoutWidget_2)
|
||||
@@ -330,7 +330,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.LRD_26.setFont(font)
|
||||
self.LRD_26.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.LRD_26.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.LRD_26.setObjectName(_fromUtf8("LRD_26"))
|
||||
self.gridLayout_2.addWidget(self.LRD_26, 2, 0, 1, 1)
|
||||
self.LRD_42 = QCheckBox(self.gridLayoutWidget_2)
|
||||
@@ -367,7 +367,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.groupBox_2.setFont(font)
|
||||
self.groupBox_2.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.groupBox_2.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
|
||||
self.gridLayoutWidget_3 = QWidget(self.groupBox_2)
|
||||
self.gridLayoutWidget_3.setGeometry(QtCore.QRect(10, 20, 491, 42))
|
||||
@@ -381,7 +381,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.LRR_Flore.setFont(font)
|
||||
self.LRR_Flore.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.LRR_Flore.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.LRR_Flore.setObjectName(_fromUtf8("LRR_Flore"))
|
||||
self.gridLayout_3.addWidget(self.LRR_Flore, 0, 0, 1, 1)
|
||||
self.LRR_Oiseaux = QCheckBox(self.gridLayoutWidget_3)
|
||||
@@ -389,7 +389,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.LRR_Oiseaux.setFont(font)
|
||||
self.LRR_Oiseaux.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.LRR_Oiseaux.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.LRR_Oiseaux.setObjectName(_fromUtf8("LRR_Oiseaux"))
|
||||
self.gridLayout_3.addWidget(self.LRR_Oiseaux, 1, 0, 1, 1)
|
||||
self.LRR_Autre = QCheckBox(self.gridLayoutWidget_3)
|
||||
@@ -405,7 +405,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.groupBox_3.setFont(font)
|
||||
self.groupBox_3.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.groupBox_3.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
|
||||
self.gridLayoutWidget_4 = QWidget(self.groupBox_3)
|
||||
self.gridLayoutWidget_4.setGeometry(QtCore.QRect(10, 20, 491, 42))
|
||||
@@ -426,7 +426,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.LRN_Flore.setFont(font)
|
||||
self.LRN_Flore.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.LRN_Flore.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.LRN_Flore.setObjectName(_fromUtf8("LRN_Flore"))
|
||||
self.gridLayout_4.addWidget(self.LRN_Flore, 0, 0, 1, 1)
|
||||
self.LRN_Oiseaux = QCheckBox(self.gridLayoutWidget_4)
|
||||
@@ -434,7 +434,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.LRN_Oiseaux.setFont(font)
|
||||
self.LRN_Oiseaux.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.LRN_Oiseaux.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.LRN_Oiseaux.setObjectName(_fromUtf8("LRN_Oiseaux"))
|
||||
self.gridLayout_4.addWidget(self.LRN_Oiseaux, 1, 0, 1, 1)
|
||||
self.LRN_Ortho = QCheckBox(self.gridLayoutWidget_4)
|
||||
@@ -456,7 +456,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.UICN.setFont(font)
|
||||
self.UICN.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.UICN.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.UICN.setObjectName(_fromUtf8("UICN"))
|
||||
self.gridLayout_12.addWidget(self.UICN, 0, 0, 1, 1)
|
||||
self.LRE = QCheckBox(self.gridLayoutWidget_11)
|
||||
@@ -485,19 +485,19 @@ class Ui_SICEN(object):
|
||||
self.gridLayout.setHorizontalSpacing(50)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.PATRI38 = QCheckBox(self.gridLayoutWidget)
|
||||
self.PATRI38.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.PATRI38.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.PATRI38.setObjectName(_fromUtf8("PATRI38"))
|
||||
self.gridLayout.addWidget(self.PATRI38, 3, 0, 1, 1)
|
||||
self.PATRI01 = QCheckBox(self.gridLayoutWidget)
|
||||
self.PATRI01.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.PATRI01.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.PATRI01.setObjectName(_fromUtf8("PATRI01"))
|
||||
self.gridLayout.addWidget(self.PATRI01, 0, 0, 1, 1)
|
||||
self.PATRI07 = QCheckBox(self.gridLayoutWidget)
|
||||
self.PATRI07.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.PATRI07.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.PATRI07.setObjectName(_fromUtf8("PATRI07"))
|
||||
self.gridLayout.addWidget(self.PATRI07, 1, 0, 1, 1)
|
||||
self.PATRI26 = QCheckBox(self.gridLayoutWidget)
|
||||
self.PATRI26.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.PATRI26.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.PATRI26.setObjectName(_fromUtf8("PATRI26"))
|
||||
self.gridLayout.addWidget(self.PATRI26, 2, 0, 1, 1)
|
||||
self.PATRI42 = QCheckBox(self.gridLayoutWidget)
|
||||
@@ -529,7 +529,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.groupBox_6.setFont(font)
|
||||
self.groupBox_6.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
|
||||
self.groupBox_6.setAlignment(QtCore.Qt.AlignmentFlag(0x0001)|QtCore.Qt.AlignmentFlag(0x0001)|QtCore.Qt.AlignmentFlag(0x0080))
|
||||
self.groupBox_6.setObjectName(_fromUtf8("groupBox_6"))
|
||||
self.gridLayoutWidget_7 = QWidget(self.groupBox_6)
|
||||
self.gridLayoutWidget_7.setGeometry(QtCore.QRect(10, 20, 491, 21))
|
||||
@@ -550,7 +550,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.PD_38.setFont(font)
|
||||
self.PD_38.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.PD_38.setLayoutDirection(QtCore.Qt.LayoutDirection(1))
|
||||
self.PD_38.setObjectName(_fromUtf8("PD_38"))
|
||||
self.gridLayout_7.addWidget(self.PD_38, 0, 0, 1, 1)
|
||||
self.PR = QCheckBox(self.page_3)
|
||||
@@ -604,14 +604,14 @@ class Ui_SICEN(object):
|
||||
self.label_12.setObjectName(_fromUtf8("label_12"))
|
||||
self.gridLayout_10.addWidget(self.label_12, 1, 1, 1, 1)
|
||||
self.buffer = QLineEdit(self.gridLayoutWidget_12)
|
||||
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
|
||||
sizePolicy = QSizePolicy(QSizePolicy.Policy(4), QSizePolicy.Policy(0))
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.buffer.sizePolicy().hasHeightForWidth())
|
||||
self.buffer.setSizePolicy(sizePolicy)
|
||||
self.buffer.setMaximumSize(QtCore.QSize(100, 16777215))
|
||||
self.buffer.setInputMethodHints(QtCore.Qt.ImhPreferNumbers)
|
||||
self.buffer.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.buffer.setInputMethodHints(QtCore.Qt.InputMethodHint(0x8))
|
||||
self.buffer.setAlignment(QtCore.Qt.Alignment(5))
|
||||
self.buffer.setObjectName(_fromUtf8("buffer"))
|
||||
self.gridLayout_10.addWidget(self.buffer, 2, 2, 1, 1)
|
||||
self.label_8 = QLabel(self.gridLayoutWidget_12)
|
||||
@@ -664,7 +664,7 @@ class Ui_SICEN(object):
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.bouton_geom.setFont(font)
|
||||
self.bouton_geom.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
self.bouton_geom.setLayoutDirection(QtCore.Qt.LayoutDirection(0))
|
||||
self.bouton_geom.setText(_fromUtf8(""))
|
||||
self.bouton_geom.setIconSize(QtCore.QSize(20, 20))
|
||||
self.bouton_geom.setObjectName(_fromUtf8("bouton_geom"))
|
||||
|
||||
@@ -1,4 +1,36 @@
|
||||
# Plugin QGIS
|
||||
---
|
||||
Point de départ de tout les plugin du CEN Rhône Alpes,
|
||||
Pour la création et le partage <3
|
||||
Pour la création et le partage :heart:
|
||||
|Nom|Version|Statue|Date de création|
|
||||
|---|---|---|---|
|
||||
|CenRa_AUTOMAP|1.2|Releases|2024-09-25|
|
||||
|CenRa_COPIE|2.2|Releases|06-02-2024|
|
||||
|CenRa_FLUX|2.5|Releases|06-02-2024|
|
||||
|CenRa_METABASE|0.2.0|Alpha|12-09-2024|
|
||||
|CenRa_PAGERENDER|0.1.5|Alpha|09-10-2024|
|
||||
|CenRa_POSTGIS|2.6|Releases|2024-02-06|
|
||||
|CenRa_SICEN|1.8|Releases|06-02-2024|
|
||||
|
||||
> [!NOTE]
|
||||
> [Releases pour QGIS](https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases)
|
||||
## [AutoMap](CenRa_AUTOMAP) <img src="CenRa_AUTOMAP/tools/icons/icon.png" width="32"/>
|
||||
Outils de création de mise en page automatique, utilisant des modèles préprogrammés pour homogénéiser les rendus, ainsi que de simplifier certains usages.
|
||||
|
||||
## [Copie](CenRa_COPIE) <img src="CenRa_COPIE/tools/icons/icon.png" width="32"/>
|
||||
Permets à un simple utilisateur de réaliser une duplication d'une table se trouvant dans PostGIS, afin de garder les colonnes créées par cet utilisateur à fin de créer une nouvelle donnée pour l'année n+1.
|
||||
|
||||
## [Flux](CenRa_FLUX) <img src="CenRa_FLUX/tools/icons/icon.png" width="32"/>
|
||||
Une interface d'ouverture de données se trouvant dans des bases PostGIS permet une gestion des droits d'accès des utilisateurs.
|
||||
|
||||
## [MetaBase](CenRa_METABASE) <img src="CenRa_METABASE/tools/icons/icon.png" width="32"/>
|
||||
Outils à double utilisation, permettant de consulter les métadonnées des couches se trouvant dans PostGIS, tout en donnant la possibilités de créer des métadonnées qui seront stockées dans PostGIS.
|
||||
|
||||
## [PageRender](CenRa_PAGERENDER) <img src="CenRa_PAGERENDER/tools/icons/icon.png" width="32"/>
|
||||
Plugin permettant de créer les modèles de mise en page qui seront ensuite placés dans l'outils ``CenRa_AUTOMAP``.
|
||||
|
||||
## [Postgis](CenRa_POSTGIS) <img src="CenRa_POSTGIS/tools/icons/icon.png" width="32"/>
|
||||
Permets dans une base PostGIS de créer des schémas au nom d'un projet ainsi que des tables formulaire pour y renseigner Habita, Contour de sites, Travaux prévus et une dernière table malléable au besoin, vient également appliquer des styles pour l'utilisation de formulaire python.
|
||||
|
||||
## [Sicen](CenRa_SICEN) <img src="CenRa_SICEN/sicen.png" width="32"/>
|
||||
Outils de consultation des données SICEN du CEN-RA permettent également d'exporter ces données en csv.
|
||||
@@ -1,8 +1,7 @@
|
||||
<?xml version = '1.0' encoding = 'UTF-8'?>
|
||||
<plugins>
|
||||
<pyqgis_plugin name="CenRa_POSTGIS" version="2.0">
|
||||
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
|
||||
<version>2.0</version>
|
||||
<pyqgis_plugin name="CenRa_POSTGIS" version="3.0">
|
||||
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
|
||||
<version>3.0</version>
|
||||
<qgis_minimum_version>3.16</qgis_minimum_version>
|
||||
<homepage>https://plateformesig.cenra-outils.org/</homepage>
|
||||
<file_name>CenRa_POSTGIS.zip</file_name>
|
||||
@@ -11,15 +10,15 @@
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_POSTGIS.zip</download_url>
|
||||
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
|
||||
<create_date>2024-02-06</create_date>
|
||||
<update_date>2024-10-22</update_date>
|
||||
<update_date>2025-05-19</update_date>
|
||||
<experimental>False</experimental>
|
||||
<deprecated>False</deprecated>
|
||||
<tags>cenra,postgis</tags>
|
||||
</pyqgis_plugin>
|
||||
|
||||
<pyqgis_plugin name="CenRa_COPIE" version="2.0">
|
||||
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
|
||||
<version>2.0</version>
|
||||
<pyqgis_plugin name="CenRa_COPIE" version="3.0">
|
||||
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
|
||||
<version>3.0</version>
|
||||
<qgis_minimum_version>3.16</qgis_minimum_version>
|
||||
<homepage>https://plateformesig.cenra-outils.org/</homepage>
|
||||
<file_name>CenRa_COPIE.zip</file_name>
|
||||
@@ -28,15 +27,15 @@
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_COPIE.zip</download_url>
|
||||
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
|
||||
<create_date>2024-02-06</create_date>
|
||||
<update_date>2024-10-22</update_date>
|
||||
<update_date>2025-05-19</update_date>
|
||||
<experimental>False</experimental>
|
||||
<deprecated>False</deprecated>
|
||||
<tags>cenra,copie</tags>
|
||||
</pyqgis_plugin>
|
||||
|
||||
<pyqgis_plugin name="CenRa_SICEN" version="1.7">
|
||||
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
|
||||
<version>1.7</version>
|
||||
<pyqgis_plugin name="CenRa_SICEN" version="2.0">
|
||||
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
|
||||
<version>2.0</version>
|
||||
<qgis_minimum_version>3.16</qgis_minimum_version>
|
||||
<homepage>https://plateformesig.cenra-outils.org/</homepage>
|
||||
<file_name>CenRa_SICEN.zip</file_name>
|
||||
@@ -45,15 +44,15 @@
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_SICEN.zip</download_url>
|
||||
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
|
||||
<create_date>2024-02-06</create_date>
|
||||
<update_date>2024-09-13</update_date>
|
||||
<update_date>2025-05-19</update_date>
|
||||
<experimental>False</experimental>
|
||||
<deprecated>False</deprecated>
|
||||
<tags>cenra,sicen</tags>
|
||||
</pyqgis_plugin>
|
||||
|
||||
<pyqgis_plugin name="CenRa_FLUX" version="2.1">
|
||||
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
|
||||
<version>2.1</version>
|
||||
<pyqgis_plugin name="CenRa_FLUX" version="3.0">
|
||||
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
|
||||
<version>3.0</version>
|
||||
<qgis_minimum_version>3.16</qgis_minimum_version>
|
||||
<homepage>https://plateformesig.cenra-outils.org/</homepage>
|
||||
<file_name>CenRa_FLUX.zip</file_name>
|
||||
@@ -62,15 +61,15 @@
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_FLUX.zip</download_url>
|
||||
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
|
||||
<create_date>2024-02-06</create_date>
|
||||
<update_date>2024-11-08</update_date>
|
||||
<update_date>2025-05-19</update_date>
|
||||
<experimental>False</experimental>
|
||||
<deprecated>False</deprecated>
|
||||
<tags>cenra,flux</tags>
|
||||
</pyqgis_plugin>
|
||||
|
||||
<pyqgis_plugin name="CenRa_METABASE" version="1.3">
|
||||
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
|
||||
<version>1.3</version>
|
||||
<pyqgis_plugin name="CenRa_METABASE" version="0.3.0">
|
||||
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
|
||||
<version>0.3.0</version>
|
||||
<qgis_minimum_version>3.16</qgis_minimum_version>
|
||||
<homepage>https://plateformesig.cenra-outils.org/</homepage>
|
||||
<file_name>CenRa_METABASE.zip</file_name>
|
||||
@@ -79,15 +78,15 @@
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_METABASE.zip</download_url>
|
||||
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
|
||||
<create_date>2024-09-12</create_date>
|
||||
<update_date>2024-10-08</update_date>
|
||||
<experimental>False</experimental>
|
||||
<update_date>2025-05-19</update_date>
|
||||
<experimental>True</experimental>
|
||||
<deprecated>False</deprecated>
|
||||
<tags>cenra,metabase</tags>
|
||||
</pyqgis_plugin>
|
||||
|
||||
<pyqgis_plugin name="CenRa_AUTOMAP" version="1.7">
|
||||
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
|
||||
<version>1.7</version>
|
||||
<pyqgis_plugin name="CenRa_AUTOMAP" version="2.0">
|
||||
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
|
||||
<version>2.0</version>
|
||||
<qgis_minimum_version>3.16</qgis_minimum_version>
|
||||
<homepage>https://plateformesig.cenra-outils.org/</homepage>
|
||||
<file_name>CenRa_AUTOMAP.zip</file_name>
|
||||
@@ -96,15 +95,15 @@
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_AUTOMAP.zip</download_url>
|
||||
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
|
||||
<create_date>2024-09-25</create_date>
|
||||
<update_date>2024-10-21</update_date>
|
||||
<experimental>True</experimental>
|
||||
<update_date>2025-05-19</update_date>
|
||||
<experimental>False</experimental>
|
||||
<deprecated>False</deprecated>
|
||||
<tags>cenra,mise en page,atlas</tags>
|
||||
</pyqgis_plugin>
|
||||
|
||||
<pyqgis_plugin name="CenRa_PAGERENDER" version="1.3">
|
||||
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
|
||||
<version>1.3</version>
|
||||
<pyqgis_plugin name="CenRa_PAGERENDER" version="0.2.0">
|
||||
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
|
||||
<version>0.2.0</version>
|
||||
<qgis_minimum_version>3.16</qgis_minimum_version>
|
||||
<homepage>https://plateformesig.cenra-outils.org/</homepage>
|
||||
<file_name>CenRa_PAGERENDER.zip</file_name>
|
||||
@@ -113,26 +112,44 @@
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_PAGERENDER.zip</download_url>
|
||||
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
|
||||
<create_date>2024-10-09</create_date>
|
||||
<update_date>2024-11-08</update_date>
|
||||
<update_date>2025-05-19</update_date>
|
||||
<experimental>True</experimental>
|
||||
<deprecated>False</deprecated>
|
||||
<tags>cenra,mise en page,atlas</tags>
|
||||
|
||||
</pyqgis_plugin>
|
||||
<pyqgis_plugin name="CenRa_COMPANIONCUBE" version="1.0">
|
||||
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
|
||||
<version>1.0</version>
|
||||
|
||||
<pyqgis_plugin name="CenRa_gn2qgis" version="0.1.0">
|
||||
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
|
||||
<version>0.1.0</version>
|
||||
<qgis_minimum_version>3.16</qgis_minimum_version>
|
||||
<homepage>https://plateformesig.cenra-outils.org/</homepage>
|
||||
<file_name>CenRa_COMPANIONCUBE.zip</file_name>
|
||||
<file_name>CenRa_gn2qgis.zip</file_name>
|
||||
<icon>CEN-Rhone-Alpes.png</icon>
|
||||
<author_name>CEN-Rhone-Alpes</author_name>
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_COMPANIONCUBE.zip</download_url>
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_gn2qgis.zip</download_url>
|
||||
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
|
||||
<create_date>2024-10-21</create_date>
|
||||
<update_date>2024-10-22</update_date>
|
||||
<create_date>2024-12-11</create_date>
|
||||
<update_date>2024-12-11</update_date>
|
||||
<experimental>True</experimental>
|
||||
<deprecated>False</deprecated>
|
||||
<tags>cenra,ia</tags>
|
||||
<tags>cenra,geonature</tags>
|
||||
</pyqgis_plugin>
|
||||
|
||||
<pyqgis_plugin name="BiodivAURA" version="0.1.0">
|
||||
<description>Depot pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.</description>
|
||||
<version>0.1.0</version>
|
||||
<qgis_minimum_version>3.16</qgis_minimum_version>
|
||||
<homepage>https://plateformesig.cenra-outils.org/</homepage>
|
||||
<file_name>BiodivAURA.zip</file_name>
|
||||
<icon>CEN-Rhone-Alpes.png</icon>
|
||||
<author_name>CEN-Rhone-Alpes</author_name>
|
||||
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/BiodivAURA.zip</download_url>
|
||||
<uploaded_by>CEN-Rhone-Alpes</uploaded_by>
|
||||
<create_date>2024-12-12</create_date>
|
||||
<update_date>2024-12-12</update_date>
|
||||
<experimental>True</experimental>
|
||||
<deprecated>False</deprecated>
|
||||
<tags>cenra,biodiv'aura</tags>
|
||||
</pyqgis_plugin>
|
||||
|
||||
</plugins>
|
||||