Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d04e34ed2 | ||
|
|
ac070f866e | ||
|
|
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 | ||
|
|
7fd53159e9 | ||
|
|
b685580d54 | ||
|
|
4c1a62f54d | ||
|
|
70232ac4c7 | ||
|
|
d360527d20 | ||
|
|
ee029c6b7f | ||
|
|
98b0cfc604 | ||
|
|
1d06bc30ad | ||
|
|
0997a7d6d8 | ||
|
|
675f964145 | ||
|
|
801843fc0e | ||
|
|
8bfa4a557a | ||
|
|
c5fb0aae18 | ||
|
|
b6081c5723 | ||
|
|
52809a56a1 | ||
|
|
0c7c08da44 | ||
|
|
0f90553c63 | ||
|
|
8f2dec8869 | ||
|
|
e90ae04f93 | ||
|
|
7634407810 | ||
|
|
de981982ea | ||
|
|
bf0008be58 |
@@ -1,16 +1,21 @@
|
||||
#Ignores gitignore
|
||||
!.gitignore
|
||||
/.gitignore
|
||||
|
||||
#Ignores all folders
|
||||
/*
|
||||
!plugins.xml
|
||||
|
||||
#Except Plugin folders
|
||||
!/CenRa_COPIE/*
|
||||
!/CenRa_FLUX/*
|
||||
!/CenRa_METABASE/*
|
||||
!/CenRa_POSTGIS/*
|
||||
!/CenRa_SICEN/*
|
||||
!/CenRa_AUTOMAP/*
|
||||
#Skip Ignores
|
||||
!CenRa_AUTOMAP/
|
||||
!CenRa_COPIE/
|
||||
!CenRa_FLUX/
|
||||
!CenRa_METABASE/
|
||||
!CenRa_POSTGIS/
|
||||
!CenRa_SICEN/
|
||||
!CenRa_PAGERENDER/
|
||||
|
||||
|
||||
*__pycache__*
|
||||
#ReIgnore
|
||||
**/__pycache__
|
||||
**/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/'))
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
# CenRa_AutoMap
|
||||
# CenRa_AutoMap
|
||||
---
|
||||
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)
|
||||
@@ -1,10 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
__copyright__ = "Copyright 2021, 3Liz"
|
||||
__license__ = "GPL version 3"
|
||||
__email__ = "info@3liz.org"
|
||||
|
||||
|
||||
# noinspection PyPep8Naming
|
||||
def classFactory(iface): # pylint: disable=invalid-name
|
||||
def classFactory(iface):
|
||||
_ = iface
|
||||
from CenRa_AUTOMAP.CenRa_AutoMap import PgAutoMap
|
||||
return PgAutoMap()
|
||||
|
||||
@@ -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
|
||||
@@ -8,6 +8,7 @@ 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,
|
||||
@@ -43,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,
|
||||
@@ -56,17 +59,22 @@ from qgis.PyQt.QtWidgets import (
|
||||
QTableWidgetItem,
|
||||
QVBoxLayout,
|
||||
)
|
||||
|
||||
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 .tools.mises_en_pages.canvas import (fletch_canvas)
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
from datetime import date
|
||||
|
||||
EDITOR_CLASS = load_ui('CenRa_AutoMap_base.ui')
|
||||
@@ -98,6 +106,9 @@ data_source = [
|
||||
'Plan cadastral informatisé - Etalab - juillet 202X',
|
||||
'Parcellaire Express - IGN - 202X',
|
||||
]
|
||||
A4_size = {'Portrait':{'RIGHT':210,'LEFT':0,'TOP':0,'BOTTOM':297},'Landscape':{'RIGHT':297,'LEFT':0,'TOP':0,'BOTTOM':210}}
|
||||
A3_size = {'Portrait':{'RIGHT':298,'LEFT':0,'TOP':0,'BOTTOM':420},'Landscape':{'RIGHT':420,'LEFT':0,'TOP':0,'BOTTOM':298}}
|
||||
|
||||
class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
@@ -106,6 +117,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.setupUi(self)
|
||||
self.settings = QgsSettings()
|
||||
self.s = QSettings()
|
||||
self.setWindowIcon(QtGui.QIcon(resources_path('icons','icon.png')))
|
||||
|
||||
path = ''
|
||||
ix = 0
|
||||
@@ -113,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)
|
||||
@@ -125,11 +138,12 @@ 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 = []
|
||||
|
||||
for filename in glob.glob(resources_path("mises_en_pages","*.qpt")):
|
||||
for filename in glob.glob(resources_path("mises_en_pages","*.py")):
|
||||
mises_en_page.append(filename)
|
||||
|
||||
|
||||
@@ -139,28 +153,42 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.comboBox.setCurrentIndex(1)
|
||||
|
||||
self.template_parameters = {
|
||||
'map_size': None,
|
||||
'map_position' : None,
|
||||
'position_map_size' : None,
|
||||
'position_map_position' : None,
|
||||
'title_position': None,
|
||||
'title_size': None,
|
||||
'subtitle_position': None,
|
||||
'subtitle_size': None,
|
||||
'logo_position': None,
|
||||
'logo_size': None,
|
||||
'legend_position': None,
|
||||
'legend_size': None,
|
||||
'scalebarnumeric_position':None,
|
||||
'scalebarnumeric_size':None,
|
||||
'scalebar_position': None,
|
||||
'scalebar_size': None,
|
||||
'north_position': None,
|
||||
'north_size': None,
|
||||
'credit_text_position': None,
|
||||
'credit_text_size': None,
|
||||
'credit_text2_position': None,
|
||||
'credit_text2_size': None,
|
||||
'Carte_size': None,
|
||||
'Carte_locals' : None,
|
||||
'Carte_rotate':None,
|
||||
'Carte_2_size' : None,
|
||||
'Carte_2_locals' : None,
|
||||
'Carte_2_rotate':None,
|
||||
'Legande_size': None,
|
||||
'Legande_locals': None,
|
||||
'Legande_rotate':None,
|
||||
'Arrow_size': None,
|
||||
'Arrow_locals': None,
|
||||
'Arrow_rotate':None,
|
||||
'Echelle_size': None,
|
||||
'Echelle_locals': None,
|
||||
'Echelle_rotate':None,
|
||||
'Logo_size': None,
|
||||
'Logo_locals': None,
|
||||
'Logo_rotate':None,
|
||||
'Titre_size':None,
|
||||
'Titre_locals':None,
|
||||
'Titre_rotate':None,
|
||||
'Sous_titre_size':None,
|
||||
'Sous_titre_locals':None,
|
||||
'Sous_titre_rotate':None,
|
||||
'Credit_size': None,
|
||||
'Credit_locals': None,
|
||||
'Credit_rotate':None,
|
||||
'Source_size': None,
|
||||
'Source_locals': None,
|
||||
'Source_rotate':None,
|
||||
'Logo_2_size': None,
|
||||
'Logo_2_locals': None,
|
||||
'Logo_2_rotate': None,
|
||||
'Echelle_2_size': None,
|
||||
'Echelle_2_locals': None,
|
||||
'Echelle_2_rotate': None,
|
||||
# Add more variables as needed
|
||||
}
|
||||
self.update_logo_library()
|
||||
@@ -170,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 = []
|
||||
@@ -301,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 = ['']
|
||||
@@ -414,8 +452,27 @@ 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']
|
||||
if self.radioButton_6.isChecked() and self.radioButton_8.isChecked():
|
||||
logo_div = A4_size['Portrait']['BOTTOM']
|
||||
if self.radioButton_5.isChecked() and self.radioButton_7.isChecked():
|
||||
logo_div = A3_size['Portrait']['RIGHT']
|
||||
if self.radioButton_5.isChecked() and self.radioButton_8.isChecked():
|
||||
logo_div = A3_size['Portrait']['BOTTOM']
|
||||
if True:#os.path.basename(filename) == "1. Modèle carto standard (consolidé).qpt":
|
||||
|
||||
self.actualisation_mise_en_page()
|
||||
@@ -428,9 +485,10 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.map_modele_test.setExtent(iface.mapCanvas().extent())
|
||||
# Position de la carte dans le composeur
|
||||
|
||||
self.map_modele_test.attemptMove(self.template_parameters['map_position'])
|
||||
self.map_modele_test.setItemRotation(self.template_parameters['Carte_rotate'])
|
||||
self.map_modele_test.attemptResize(self.template_parameters['Carte_size'])
|
||||
self.map_modele_test.attemptMove(self.template_parameters['Carte_locals'])
|
||||
# on dimensionne le rendu de la carte (pour référence la page totale est une page A4 donc 297*210)
|
||||
self.map_modele_test.attemptResize(self.template_parameters['map_size'])
|
||||
self.map_modele_test.setKeepLayerSet(True)
|
||||
self.map_modele_test.setKeepLayerStyles(True)
|
||||
if self.radioButton_11.isChecked() == 1:
|
||||
@@ -444,18 +502,20 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.position_map.setExtent(QgsRectangle(641552,6647386, 995856,6331104))
|
||||
self.position_map.setFollowVisibilityPreset(True)
|
||||
self.position_map.setFollowVisibilityPresetName(self.comboBox_6.currentText())
|
||||
self.position_map.attemptMove(self.template_parameters['position_map_position'])
|
||||
self.position_map.attemptResize(self.template_parameters['position_map_size'])
|
||||
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.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'])
|
||||
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)
|
||||
self.layout.addLayoutItem(self.position_map)
|
||||
self.position_map.setId("carte_position")
|
||||
self.position_map.setId("Carte_locals")
|
||||
self.map_modele_test.refresh()
|
||||
|
||||
self.map_modele_test.setBackgroundColor(QColor(255, 255, 255, 255))
|
||||
@@ -468,17 +528,19 @@ 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.attemptMove(self.template_parameters['title_position'])
|
||||
title.attemptResize(self.template_parameters['title_size'])
|
||||
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'])
|
||||
|
||||
title.setBackgroundEnabled(True)
|
||||
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
|
||||
@@ -488,23 +550,25 @@ 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.attemptMove(self.template_parameters['subtitle_position'])
|
||||
subtitle.attemptResize(self.template_parameters['subtitle_size'])
|
||||
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'])
|
||||
subtitle.setId("SubTitle")
|
||||
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
|
||||
logo = QgsLayoutItemPicture(self.layout)
|
||||
logo.setResizeMode(QgsLayoutItemPicture.Zoom)
|
||||
logo.setMode(QgsLayoutItemPicture.FormatRaster)
|
||||
logo.attemptMove(self.template_parameters['logo_position'])
|
||||
logo.setFixedSize(self.template_parameters['logo_size'])
|
||||
logo.setItemRotation(self.template_parameters['Logo_rotate'])
|
||||
logo.setFixedSize(self.template_parameters['Logo_size'])
|
||||
logo.attemptMove(self.template_parameters['Logo_locals'])
|
||||
logo.setPicturePath(resources_path("icons","CEN_RA.png"))
|
||||
logo.setId('logo')
|
||||
self.layout.addLayoutItem(logo)
|
||||
@@ -555,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():
|
||||
@@ -580,8 +645,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.layout.refresh()
|
||||
|
||||
legend.updateLegend()
|
||||
legend.attemptMove(self.template_parameters['legend_position'])
|
||||
|
||||
legend.attemptMove(self.template_parameters['Legande_locals'])
|
||||
|
||||
## Ajout de l'échelle numeric à la mise en page
|
||||
self.scalebarnumeric_qpt = QgsLayoutItemScaleBar(self.layout)
|
||||
@@ -593,8 +657,10 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.scalebarnumeric_qpt.setNumberOfSegments(2)
|
||||
self.scalebarnumeric_qpt.setNumberOfSegmentsLeft(0)
|
||||
|
||||
self.scalebarnumeric_qpt.attemptMove(self.template_parameters['scalebarnumeric_position'])
|
||||
self.scalebarnumeric_qpt.attemptResize(self.template_parameters['scalebarnumeric_size'])
|
||||
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'])
|
||||
self.scalebarnumeric_qpt.setAlignment(QgsScaleBarSettings.Alignment(1))
|
||||
self.scalebarnumeric_qpt.setBackgroundEnabled(True)
|
||||
self.scalebarnumeric_qpt.setBackgroundColor(QColor(255, 255, 255, 130))
|
||||
@@ -611,8 +677,10 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.scalebar_qpt.setNumberOfSegments(2)
|
||||
self.scalebar_qpt.setNumberOfSegmentsLeft(0)
|
||||
|
||||
self.scalebar_qpt.attemptMove(self.template_parameters['scalebar_position'])
|
||||
self.scalebar_qpt.attemptResize(self.template_parameters['scalebar_size'])
|
||||
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'])
|
||||
self.scalebar_qpt.setAlignment(QgsScaleBarSettings.Alignment(1))
|
||||
self.scalebar_qpt.setBackgroundEnabled(True)
|
||||
self.scalebar_qpt.setBackgroundColor(QColor(255, 255, 255, 130))
|
||||
@@ -624,44 +692,62 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
north = QgsLayoutItemPicture(self.layout)
|
||||
north.setPicturePath(resources_path("mises_en_pages","NorthArrow_02.svg"))
|
||||
self.layout.addLayoutItem(north)
|
||||
north.attemptMove(self.template_parameters['north_position'])
|
||||
north.attemptResize(self.template_parameters['north_size'])
|
||||
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.setItemRotation(-90)
|
||||
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_text.attemptMove(self.template_parameters['credit_text_position'])
|
||||
credit_text.attemptResize(self.template_parameters['credit_text_size'])
|
||||
credit_text2.attemptMove(self.template_parameters['credit_text2_position'])
|
||||
credit_text2.attemptResize(self.template_parameters['credit_text2_size'])
|
||||
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)
|
||||
|
||||
## Ajout du logo credit en bas à droit de la page
|
||||
len_item = (len(self.mComboBox_4.checkedItems()))
|
||||
for logo_run in self.mComboBox_4.checkedItems():
|
||||
logo_credit = QgsLayoutItemPicture(self.layout)
|
||||
logo_credit.setResizeMode(QgsLayoutItemPicture.Zoom)
|
||||
logo_credit.setMode(QgsLayoutItemPicture.FormatRaster)
|
||||
cur_x = self.template_parameters['logo_credit_position'].x()
|
||||
logo_credit.attemptMove(self.template_parameters['logo_credit_position'])
|
||||
logo_credit.setPictureAnchor(4)
|
||||
self.template_parameters['logo_credit_position'].setX(cur_x+51)
|
||||
logo_credit.setFixedSize(self.template_parameters['logo_credit_size'])
|
||||
cur_x = self.template_parameters['Logo_2_locals'].x()
|
||||
logo_credit.attemptMove(self.template_parameters['Logo_2_locals'])
|
||||
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] == ' ':
|
||||
logo_credit.setPicturePath(self.s.value("automap/logoteck", 1, type=str)+logo_run[1:])
|
||||
else:
|
||||
@@ -677,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
|
||||
|
||||
|
||||
|
||||
@@ -693,14 +803,24 @@ 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):
|
||||
|
||||
A4_size = {'Portrait':{'RIGHT':210,'LEFT':0,'TOP':0,'BOTTOM':297},'Landscape':{'RIGHT':297,'LEFT':0,'TOP':0,'BOTTOM':210}}
|
||||
A3_size = {'Portrait':{'RIGHT':298,'LEFT':0,'TOP':0,'BOTTOM':420},'Landscape':{'RIGHT':420,'LEFT':0,'TOP':0,'BOTTOM':298}}
|
||||
|
||||
values_page = self.comboBox.currentText()
|
||||
|
||||
if self.radioButton_6.isChecked() and self.radioButton_7.isChecked():
|
||||
@@ -719,19 +839,20 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
pc = self.layout.pageCollection()
|
||||
pc.pages()[0].setPageSize('A3', QgsLayoutItemPage.Landscape)
|
||||
|
||||
self.template_parameters = fletch_canvas(self,values_page)
|
||||
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):
|
||||
|
||||
if True:
|
||||
if echelle.scale() >= 20000:
|
||||
if echelle.scale() >= 40000:
|
||||
bar_echelle.setUnits(QgsUnitTypes.DistanceKilometers)
|
||||
bar_echelle.setUnitLabel("km")
|
||||
bar_echelle.setUnitsPerSegment(round((echelle.scale()*0.02)/1000))
|
||||
|
||||
bar_echelle.setUnitsPerSegment(round((echelle.scale()*0.04)/1000))
|
||||
else:
|
||||
bar_echelle.setUnits(QgsUnitTypes.DistanceMeters)
|
||||
bar_echelle.setUnitLabel("m")
|
||||
bar_echelle.setUnitsPerSegment(round(echelle.scale()*0.02))
|
||||
bar_echelle.setUnitsPerSegment(round(echelle.scale()*0.04))
|
||||
|
||||
bar_echelle.update()
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
[general]
|
||||
name=CenRa_AutoMap
|
||||
qgisMinimumVersion=3.0
|
||||
supportsQt6=True
|
||||
description=CenRa_AutoMap
|
||||
version=1.6
|
||||
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>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 |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 30 KiB |
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Capa_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 470 470"
|
||||
style="enable-background:new 0 0 470 470;"
|
||||
xml:space="preserve"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="north-star-svgrepo-com.svg"><metadata
|
||||
id="metadata41"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs39" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
id="namedview37"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.50212766"
|
||||
inkscape:cx="-58.75"
|
||||
inkscape:cy="235"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Capa_1" /><g
|
||||
id="g3"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,73.669492,121.42372)"><path
|
||||
d="m 464.37,227.737 -137.711,-35.46 55.747,-94.413 c 1.74,-2.946 1.265,-6.697 -1.155,-9.117 -2.42,-2.42 -6.169,-2.894 -9.117,-1.154 L 277.721,143.34 242.263,5.63 C 241.41,2.316 238.422,0 235,0 c -3.422,0 -6.41,2.316 -7.263,5.63 L 192.277,143.341 97.865,87.593 c -2.947,-1.742 -6.697,-1.267 -9.117,1.154 -2.419,2.42 -2.895,6.171 -1.155,9.117 L 143.34,192.277 5.63,227.737 C 2.316,228.59 0,231.578 0,235 c 0,3.422 2.316,6.41 5.63,7.263 l 137.711,35.46 -55.747,94.413 c -1.74,2.946 -1.265,6.697 1.155,9.117 1.445,1.445 3.365,2.196 5.306,2.196 1.308,0 2.625,-0.342 3.811,-1.042 l 94.413,-55.747 35.46,137.71 c 0.854,3.313 3.841,5.63 7.263,5.63 3.422,0 6.41,-2.316 7.263,-5.63 l 35.46,-137.711 94.413,55.748 c 1.187,0.701 2.503,1.042 3.811,1.042 1.94,0 3.86,-0.751 5.306,-2.196 2.419,-2.42 2.895,-6.171 1.155,-9.117 l -55.747,-94.413 137.71,-35.46 c 3.314,-0.853 5.63,-3.841 5.63,-7.263 0,-3.422 -2.319,-6.41 -5.633,-7.263 z m -176.627,60.007 23.796,-6.128 43.142,73.065 -73.065,-43.143 6.127,-23.794 z m 25.697,-22.106 c -0.035,0.009 -0.07,0.019 -0.106,0.027 l -29.473,7.59 -22.344,-22.345 c -2.929,-2.928 -7.678,-2.928 -10.606,0 -2.929,2.93 -2.929,7.678 0,10.607 l 22.344,22.344 -7.59,29.478 c -0.008,0.033 -0.018,0.065 -0.025,0.099 L 235,432.423 204.356,313.413 c -0.004,-0.016 -7.61,-29.552 -7.61,-29.552 l 87.115,-87.116 29.302,7.546 C 313.21,204.303 432.423,235 432.423,235 L 313.44,265.638 Z m -25.697,-83.382 -6.127,-23.795 73.065,-43.143 -43.142,73.064 -23.796,-6.126 z m -22.099,-25.669 c 0.004,0.016 7.61,29.552 7.61,29.552 L 235,224.393 l -38.254,-38.254 7.59,-29.478 c 0.008,-0.033 0.018,-0.065 0.025,-0.099 L 235,37.577 l 30.644,119.01 z m -83.387,25.669 -23.796,6.128 -43.142,-73.065 73.065,43.143 -6.127,23.794 z m 3.882,14.489 L 224.393,235 186.139,273.255 37.577,235 186.139,196.745 Z m -3.882,90.999 6.127,23.795 -73.065,43.143 43.142,-73.064 23.796,6.126 z"
|
||||
id="path5"
|
||||
inkscape:connector-curvature="0" /></g><g
|
||||
id="g7"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g9"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g11"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g13"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g15"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g17"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g19"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g21"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g23"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g25"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g27"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g29"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g31"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g33"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><g
|
||||
id="g35"
|
||||
transform="matrix(0.70762712,0,0,0.70762712,77.669492,133.42372)" /><path
|
||||
inkscape:connector-curvature="0"
|
||||
class="st0"
|
||||
d="m 230.3366,69.68989 20.38,33.826 c 0.404,0.673 0.717,1.188 0.953,1.59 0.487,0.002 1.12,0.004 1.805,0.004 l 20.004,0 c 0.557,0 1.027,-0.471 1.027,-1.028 l 0,-76.944 c 0,-0.557 -0.472,-1.027 -1.027,-1.027 l -20.004,0 c -0.555,0 -1.025,0.471 -1.025,1.027 l 0,33.553 c 0,2.979 -1.948,3.13 -2.338,3.13 -0.958,0 -1.803,-0.599 -2.518,-1.78 l -20.378,-33.826 c -0.498,-0.825 -0.852,-1.429 -1.104,-1.882 -0.4,-0.02 -0.956,-0.036 -1.655,-0.036 l -20.003,0 c -0.557,0 -1.027,0.47 -1.027,1.027 l 0,76.945 c 0,0.557 0.471,1.027 1.027,1.027 l 20.001,0 c 0.557,0 1.027,-0.47 1.027,-1.027 l 0,-33.229 c 0,-2.979 1.948,-3.129 2.338,-3.129 0.959,-10e-4 1.805,0.599 2.517,1.779 z"
|
||||
id="path9" /></svg>
|
||||
|
After Width: | Height: | Size: 5.6 KiB |
@@ -0,0 +1,47 @@
|
||||
<svg viewBox="0 0 61.06 96.62" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(-1.438 30.744)">
|
||||
<g fill="none" stroke="param(outline)">
|
||||
<path d="m61 35c0 16.02-12.984 29-29 29-16.02 0-29-12.984-29-29 0-16.02 12.984-29 29-29 16.02 0 29 12.984 29 29z" stroke-width="3"/>
|
||||
<path d="m55 35c0 12.979-10.521 23.5-23.5 23.5-12.979 0-23.5-10.521-23.5-23.5 0-12.979 10.521-23.5 23.5-23.5 12.979 0 23.5 10.521 23.5 23.5z" stroke-width=".497" transform="matrix(1.01148 0 0 .99988 -.089 .004)"/>
|
||||
<path d="m32 35v-32" stroke-width=".25"/>
|
||||
</g>
|
||||
<path d="m32-9.453l28.938 73.826-29-29-29 29z" fill="param(fill)" stroke="param(outline)" stroke-width="3"/>
|
||||
<path d="m32-9.453l29 73.45-29-29-29 29z" fill="none" stroke="param(outline)" stroke-linecap="square"/>
|
||||
<text fill="param(fill)" font-family="OPEN SANS" font-size="40" letter-spacing="0" line-height="125%" word-spacing="0" x="22.71" y="-10.854">
|
||||
<tspan font-family="Adobe Heiti Std R" font-size="26" x="22.71" y="-10.854">N</tspan>
|
||||
</text>
|
||||
</g>
|
||||
<g fill="none" stroke="param(outline)" stroke-width=".25" transform="translate(0 -3.829)">
|
||||
<path d="m4 92.82l6.74-3.891"/>
|
||||
<path d="m4.603 90.7l10.397-6"/>
|
||||
<path d="m3 95.17l4-2.309"/>
|
||||
<path d="m5.442 88.45l13.856-8"/>
|
||||
<path d="m12 72.26l18.686-10.812"/>
|
||||
<path d="m14.593 65.45l16.09-9.291"/>
|
||||
<path d="m15.343 63.24l15.343-8.858"/>
|
||||
<path d="m16.877 60.58l13.809-7.972"/>
|
||||
<path d="m17.511 58.45l13.174-7.606"/>
|
||||
<path d="m18.412 56.15l12.274-7.087"/>
|
||||
<path d="m19 54.04l11.427-6.597"/>
|
||||
<path d="m20 51.757l10.822-6.311"/>
|
||||
<path d="m20.826 49.45l9.86-5.693"/>
|
||||
<path d="m21.48 47.3l9.206-5.315"/>
|
||||
<path d="m23 44.647l7.686-4.437"/>
|
||||
<path d="m23.744 42.45l6.928-4"/>
|
||||
<path d="m24.549 40.21l6.137-3.543"/>
|
||||
<path d="m25 38.18l5.686-3.283"/>
|
||||
<path d="m26.663 35.446l4.02-2.323"/>
|
||||
<path d="m27.617 33.12l3.069-1.772"/>
|
||||
<path d="m28 31.13l2.686-1.551"/>
|
||||
<path d="m29.15 28.694l1.534-.886"/>
|
||||
<path d="m13 69.909l17.686-10.211"/>
|
||||
<path d="m9.206 79.19l21.48-12.402"/>
|
||||
<path d="m8.36 81.45l22.326-12.89"/>
|
||||
<path d="m7.671 83.62l19.946-11.516"/>
|
||||
<path d="m6.137 86.27l17.02-9.827"/>
|
||||
<path d="m10 76.956l20.686-11.943"/>
|
||||
<path d="m11.279 74.45l19.407-11.205"/>
|
||||
<path d="m14 67.56l16.686-9.634"/>
|
||||
<path d="m30.562 65.744v-43.566" transform="translate(0 3.829)"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,168 @@
|
||||
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(198.85714285714286,175, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(5, 25, 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['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_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.14285714285717,145, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(6, 23, 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['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_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(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
|
||||
@@ -0,0 +1,170 @@
|
||||
|
||||
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_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(210, 297, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(0, 0, 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, 10, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Logo_size'] = QgsLayoutSize(48, 17, 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)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(133, 215, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(64, 7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(3, 288, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(65, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(3, 273, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(12, 12, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(196, 283, 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, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(55, 292, 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(297, 420, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(0, 0, 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(48, 17, 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, 370, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(219, 324, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(64, 7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(3, 410, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(65, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(3, 395, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(24, 24, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(271, 394, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(100, 3.9, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(291, 125, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(100, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(98, 414, 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 page_rotate == 'Landscape':
|
||||
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)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(0, 0, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_size'] = QgsLayoutSize(411, 8, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Titre_locals'] = QgsLayoutPoint(5, 2, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Sous_titre_size'] = QgsLayoutSize(411, 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_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, 247, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(341, 196, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(64, 7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(3, 287, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(65, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(3, 272, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(24, 24, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(394, 271, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_size'] = QgsLayoutSize(100, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Credit_locals'] = QgsLayoutPoint(414, 123, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_size'] = QgsLayoutSize(100, 4, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Source_locals'] = QgsLayoutPoint(185, 292, 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 == '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)
|
||||
self.template_parameters['Carte_locals'] = QgsLayoutPoint(0, 0, 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(48, 17, 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, 185, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_size'] = QgsLayoutSize(405, 203, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Legande_locals'] = QgsLayoutPoint(231, 135, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_size'] = QgsLayoutSize(64, 7, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_locals'] = QgsLayoutPoint(3, 201, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_size'] = QgsLayoutSize(65, 15, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Echelle_2_locals'] = QgsLayoutPoint(3, 186, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_size'] = QgsLayoutSize(12, 12, QgsUnitTypes.LayoutMillimeters)
|
||||
self.template_parameters['Arrow_locals'] = QgsLayoutPoint(283, 196, 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(98, 205, 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
|
||||
|
||||
# Retour des info #
|
||||
return self.template_parameters
|
||||
@@ -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
|
||||
@@ -0,0 +1,120 @@
|
||||
<Layout worldFileMap="" name="test.qpt" printResolution="300" units="mm">
|
||||
<Snapper snapToGrid="0" snapToItems="1" tolerance="5" snapToGuides="1"/>
|
||||
<Grid resolution="10" offsetUnits="mm" offsetX="0" resUnits="mm" offsetY="0"/>
|
||||
<PageCollection>
|
||||
<symbol name="" clip_to_extent="1" type="fill" force_rhr="0" alpha="1">
|
||||
<data_defined_properties>
|
||||
<Option type="Map">
|
||||
<Option name="name" value="" type="QString"/>
|
||||
<Option name="properties"/>
|
||||
<Option name="type" value="collection" type="QString"/>
|
||||
</Option>
|
||||
</data_defined_properties>
|
||||
<layer class="SimpleFill" locked="0" enabled="1" pass="0">
|
||||
<Option type="Map">
|
||||
<Option name="border_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
|
||||
<Option name="color" value="255,255,255,255" type="QString"/>
|
||||
<Option name="joinstyle" value="miter" type="QString"/>
|
||||
<Option name="offset" value="0,0" type="QString"/>
|
||||
<Option name="offset_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
|
||||
<Option name="offset_unit" value="MM" type="QString"/>
|
||||
<Option name="outline_color" value="35,35,35,255" type="QString"/>
|
||||
<Option name="outline_style" value="no" type="QString"/>
|
||||
<Option name="outline_width" value="0.26" type="QString"/>
|
||||
<Option name="outline_width_unit" value="MM" type="QString"/>
|
||||
<Option name="style" value="solid" type="QString"/>
|
||||
</Option>
|
||||
<prop k="border_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
|
||||
<prop k="color" v="255,255,255,255"/>
|
||||
<prop k="joinstyle" v="miter"/>
|
||||
<prop k="offset" v="0,0"/>
|
||||
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
|
||||
<prop k="offset_unit" v="MM"/>
|
||||
<prop k="outline_color" v="35,35,35,255"/>
|
||||
<prop k="outline_style" v="no"/>
|
||||
<prop k="outline_width" v="0.26"/>
|
||||
<prop k="outline_width_unit" v="MM"/>
|
||||
<prop k="style" v="solid"/>
|
||||
<data_defined_properties>
|
||||
<Option type="Map">
|
||||
<Option name="name" value="" type="QString"/>
|
||||
<Option name="properties"/>
|
||||
<Option name="type" value="collection" type="QString"/>
|
||||
</Option>
|
||||
</data_defined_properties>
|
||||
</layer>
|
||||
</symbol>
|
||||
<LayoutItem zValue="0" id="" itemRotation="0" position="0,0,mm" frame="false" templateUuid="{5c80221d-7561-455b-94fd-69a27d877679}" referencePoint="0" opacity="1" frameJoinStyle="miter" uuid="{5c80221d-7561-455b-94fd-69a27d877679}" blendMode="0" size="297,210,mm" groupUuid="" outlineWidthM="0.3,mm" positionOnPage="0,0,mm" type="65638" excludeFromExports="0" positionLock="false" background="true" visibility="1">
|
||||
<FrameColor green="0" blue="0" red="0" alpha="255"/>
|
||||
<BackgroundColor green="255" blue="255" red="255" alpha="255"/>
|
||||
<LayoutObject>
|
||||
<dataDefinedProperties>
|
||||
<Option type="Map">
|
||||
<Option name="name" value="" type="QString"/>
|
||||
<Option name="properties"/>
|
||||
<Option name="type" value="collection" type="QString"/>
|
||||
</Option>
|
||||
</dataDefinedProperties>
|
||||
<customproperties>
|
||||
<Option/>
|
||||
</customproperties>
|
||||
</LayoutObject>
|
||||
<symbol name="" clip_to_extent="1" type="fill" force_rhr="0" alpha="1">
|
||||
<data_defined_properties>
|
||||
<Option type="Map">
|
||||
<Option name="name" value="" type="QString"/>
|
||||
<Option name="properties"/>
|
||||
<Option name="type" value="collection" type="QString"/>
|
||||
</Option>
|
||||
</data_defined_properties>
|
||||
<layer class="SimpleFill" locked="0" enabled="1" pass="0">
|
||||
<Option type="Map">
|
||||
<Option name="border_width_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
|
||||
<Option name="color" value="255,255,255,255" type="QString"/>
|
||||
<Option name="joinstyle" value="miter" type="QString"/>
|
||||
<Option name="offset" value="0,0" type="QString"/>
|
||||
<Option name="offset_map_unit_scale" value="3x:0,0,0,0,0,0" type="QString"/>
|
||||
<Option name="offset_unit" value="MM" type="QString"/>
|
||||
<Option name="outline_color" value="35,35,35,255" type="QString"/>
|
||||
<Option name="outline_style" value="no" type="QString"/>
|
||||
<Option name="outline_width" value="0.26" type="QString"/>
|
||||
<Option name="outline_width_unit" value="MM" type="QString"/>
|
||||
<Option name="style" value="solid" type="QString"/>
|
||||
</Option>
|
||||
<prop k="border_width_map_unit_scale" v="3x:0,0,0,0,0,0"/>
|
||||
<prop k="color" v="255,255,255,255"/>
|
||||
<prop k="joinstyle" v="miter"/>
|
||||
<prop k="offset" v="0,0"/>
|
||||
<prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/>
|
||||
<prop k="offset_unit" v="MM"/>
|
||||
<prop k="outline_color" v="35,35,35,255"/>
|
||||
<prop k="outline_style" v="no"/>
|
||||
<prop k="outline_width" v="0.26"/>
|
||||
<prop k="outline_width_unit" v="MM"/>
|
||||
<prop k="style" v="solid"/>
|
||||
<data_defined_properties>
|
||||
<Option type="Map">
|
||||
<Option name="name" value="" type="QString"/>
|
||||
<Option name="properties"/>
|
||||
<Option name="type" value="collection" type="QString"/>
|
||||
</Option>
|
||||
</data_defined_properties>
|
||||
</layer>
|
||||
</symbol>
|
||||
</LayoutItem>
|
||||
<GuideCollection visible="1"/>
|
||||
</PageCollection>
|
||||
<customproperties>
|
||||
<Option type="Map">
|
||||
<Option name="atlasRasterFormat" value="png" type="QString"/>
|
||||
<Option name="imageAntialias" value="true" type="bool"/>
|
||||
<Option name="imageCropMarginBottom" value="0" type="int"/>
|
||||
<Option name="imageCropMarginLeft" value="0" type="int"/>
|
||||
<Option name="imageCropMarginRight" value="0" type="int"/>
|
||||
<Option name="imageCropMarginTop" value="0" type="int"/>
|
||||
<Option name="imageCropToContents" value="false" type="bool"/>
|
||||
<Option name="singleFile" value="true" type="bool"/>
|
||||
</Option>
|
||||
</customproperties>
|
||||
<Atlas coverageLayer="" pageNameExpression="" filterFeatures="0" filenamePattern="'output_'||@atlas_featurenumber" enabled="0" hideCoverage="0" sortFeatures="0"/>
|
||||
</Layout>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,106 @@
|
||||
__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>
|
||||
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 AboutDialog
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
class PgCopie:
|
||||
def __init__(self):
|
||||
""" Constructor. """
|
||||
self.action_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_COPIE','version')
|
||||
s = QSettings()
|
||||
versionUse = s.value("copie/version", 1, type=str)
|
||||
if str(versionUse) != str(version) :
|
||||
s.setValue("copie/version", str(version))
|
||||
print(versionUse,version)
|
||||
self.open_about_dialog()
|
||||
|
||||
def initGui(self):
|
||||
""" Build the plugin GUI. """
|
||||
|
||||
self.toolBar = iface.addToolBar("CenRa_Copie")
|
||||
self.toolBar.setObjectName("CenRa_Copie")
|
||||
|
||||
icon = QIcon(resources_path('icons', 'icon.png'))
|
||||
|
||||
# Open the online help
|
||||
self.help_action = QAction(icon, "CenRa_Copie", iface.mainWindow())
|
||||
iface.pluginHelpMenu().addAction(self.help_action)
|
||||
self.help_action.triggered.connect(self.open_help)
|
||||
if not self.action_editor:
|
||||
self.action_editor = Copie_Editor()
|
||||
|
||||
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 = AboutDialog(iface)
|
||||
dialog.exec()
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
def open_editor(self):
|
||||
self.action_editor.show()
|
||||
self.action_editor.raise_()
|
||||
|
||||
def unload(self):
|
||||
""" Unload the plugin. """
|
||||
if self.action_editor:
|
||||
iface.removePluginMenu('CenRa_Copie',self.copie_editor)
|
||||
|
||||
|
||||
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
|
||||
@@ -0,0 +1,5 @@
|
||||
# Plugin_COPIE
|
||||
---
|
||||
## Objectif !
|
||||
Vise à faciliter la création table dans PostgreSQL en utilisant des table déja existant,
|
||||
tout en utilisant des modèles homogènes pour la saisie.
|
||||
@@ -1,35 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
/***************************************************************************
|
||||
Copie
|
||||
A QGIS plugin
|
||||
Permet la copie d'une table dans une base PostGis
|
||||
-------------------
|
||||
begin : 2015-04-13
|
||||
copyright : (C) 2015 by Guillaume COSTES - CEN Rhône-Alpes
|
||||
email : guillaume.costes@espaces-naturels.fr
|
||||
git sha : $Format:%H$
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
This script initializes the plugin, making it known to QGIS.
|
||||
"""
|
||||
|
||||
|
||||
# noinspection PyPep8Naming
|
||||
def classFactory(iface): # pylint: disable=invalid-name
|
||||
"""Load Copie class from file Copie.
|
||||
|
||||
:param iface: A QGIS interface instance.
|
||||
:type iface: QgsInterface
|
||||
"""
|
||||
#
|
||||
from .copie import Copie
|
||||
return Copie(iface)
|
||||
def classFactory(iface):
|
||||
_ = iface
|
||||
from CenRa_COPIE.CenRa_Copie import PgCopie
|
||||
return PgCopie()
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import os.path
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from qgis.PyQt import uic
|
||||
from qgis.PyQt.QtGui import QPixmap
|
||||
from qgis.PyQt.QtWidgets import QDialog
|
||||
|
||||
from .tools.resources import devlog
|
||||
|
||||
ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
os.path.join(
|
||||
str(Path(__file__).resolve().parent),
|
||||
'tools/ui',
|
||||
'CenRa_about_form.ui'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class AboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
|
||||
def __init__(self, iface, parent=None):
|
||||
super().__init__(parent)
|
||||
self.iface = iface
|
||||
self.setupUi(self)
|
||||
|
||||
self.viewer.setHtml(devlog('CenRa_COPIE'))
|
||||
|
||||
self.rejected.connect(self.onReject)
|
||||
self.buttonBox.rejected.connect(self.onReject)
|
||||
self.buttonBox.accepted.connect(self.onAccept)
|
||||
|
||||
def onAccept(self):
|
||||
"""
|
||||
Save options when pressing OK button
|
||||
"""
|
||||
self.accept()
|
||||
|
||||
def onReject(self):
|
||||
"""
|
||||
Run some actions when
|
||||
the user closes the dialog
|
||||
"""
|
||||
self.close()
|
||||
@@ -1,376 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
/***************************************************************************
|
||||
Copie
|
||||
A QGIS plugin
|
||||
Permet la copie d'une table dans une base PostGis
|
||||
-------------------
|
||||
begin : 2015-04-13
|
||||
git sha : $Format:%H$
|
||||
copyright : (C) 2015 by Guillaume COSTES - CEN Rhône-Alpes
|
||||
email : guillaume.costes@espaces-naturels.fr
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
#from PyQt4.QtCore import *
|
||||
#from PyQt4.QtGui import *
|
||||
from qgis.PyQt.QtCore import QSettings
|
||||
from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog, QMessageBox
|
||||
from qgis.PyQt.QtGui import QIcon
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from qgis.core import QgsDataSourceUri
|
||||
from builtins import str
|
||||
from builtins import object
|
||||
from qgis.core import *
|
||||
from qgis.gui import *
|
||||
# Initialize Qt resources from file resources.py
|
||||
from . import resources_rc
|
||||
# Import the code for the dialog
|
||||
import qgis
|
||||
from .forms.about_form import CopieAboutDialog
|
||||
from .copie_dialog import CopieDialog
|
||||
import os.path
|
||||
from .tools.PythonSQL import *
|
||||
from .tools.resources import maj_verif
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
import base64
|
||||
#import socket
|
||||
import os
|
||||
#import sys
|
||||
|
||||
class Copie(object):
|
||||
"""QGIS Plugin Implementation."""
|
||||
|
||||
def __init__(self, iface):
|
||||
"""Constructor.
|
||||
|
||||
:param iface: An interface instance that will be passed to this class
|
||||
which provides the hook by which you can manipulate the QGIS
|
||||
application at run time.
|
||||
:type iface: QgsInterface
|
||||
"""
|
||||
# Save reference to the QGIS interface
|
||||
self.iface = iface
|
||||
# initialize plugin directory
|
||||
self.plugin_dir = os.path.dirname(__file__)
|
||||
# initialize locale
|
||||
locale = QSettings().value('locale/userLocale')[0:2]
|
||||
locale_path = os.path.join(
|
||||
self.plugin_dir,
|
||||
'i18n',
|
||||
'Copie_{}.qm'.format(locale))
|
||||
|
||||
if os.path.exists(locale_path):
|
||||
self.translator = QTranslator()
|
||||
self.translator.load(locale_path)
|
||||
|
||||
if qVersion() > '4.3.3':
|
||||
QCoreApplication.installTranslator(self.translator)
|
||||
|
||||
# Create the dialog (after translation) and keep reference
|
||||
self.dlg = CopieDialog()
|
||||
maj_verif('CenRa_COPIE')
|
||||
|
||||
version = qgis.utils.pluginMetadata('CenRa_COPIE','version')
|
||||
# Display About window on first use
|
||||
s = QSettings()
|
||||
versionUse = s.value("copie/version", 1, type=str)
|
||||
if str(versionUse) != str(version) :
|
||||
s.setValue("copie/version", str(version))
|
||||
self.open_about_dialog()
|
||||
|
||||
# Declare instance attributes
|
||||
self.actions = []
|
||||
self.menu = self.tr(u'&Copie')
|
||||
# TODO: We are going to let the user set this up in a future iteration
|
||||
self.toolbar = self.iface.addToolBar(u'Copie')
|
||||
self.toolbar.setObjectName(u'Copie')
|
||||
|
||||
def open_about_dialog(self):
|
||||
dialog = CopieAboutDialog(self.iface)
|
||||
dialog.exec_()
|
||||
|
||||
# noinspection PyMethodMayBeStatic
|
||||
def tr(self, message):
|
||||
"""Get the translation for a string using Qt translation API.
|
||||
|
||||
We implement this ourselves since we do not inherit QObject.
|
||||
|
||||
:param message: String for translation.
|
||||
:type message: str, QString
|
||||
|
||||
:returns: Translated version of message.
|
||||
:rtype: QString
|
||||
"""
|
||||
# noinspection PyTypeChecker,PyArgumentList,PyCallByClass
|
||||
return QCoreApplication.translate('Copie', message)
|
||||
|
||||
|
||||
def add_action(
|
||||
self,
|
||||
icon_path,
|
||||
text,
|
||||
callback,
|
||||
enabled_flag=True,
|
||||
add_to_menu=True,
|
||||
add_to_toolbar=True,
|
||||
status_tip=None,
|
||||
whats_this=None,
|
||||
parent=None):
|
||||
"""Add a toolbar icon to the toolbar.
|
||||
|
||||
:param icon_path: Path to the icon for this action. Can be a resource
|
||||
path (e.g. ':/plugins/foo/bar.png') or a normal file system path.
|
||||
:type icon_path: str
|
||||
|
||||
:param text: Text that should be shown in menu items for this action.
|
||||
:type text: str
|
||||
|
||||
:param callback: Function to be called when the action is triggered.
|
||||
:type callback: function
|
||||
|
||||
:param enabled_flag: A flag indicating if the action should be enabled
|
||||
by default. Defaults to True.
|
||||
:type enabled_flag: bool
|
||||
|
||||
:param add_to_menu: Flag indicating whether the action should also
|
||||
be added to the menu. Defaults to True.
|
||||
:type add_to_menu: bool
|
||||
|
||||
:param add_to_toolbar: Flag indicating whether the action should also
|
||||
be added to the toolbar. Defaults to True.
|
||||
:type add_to_toolbar: bool
|
||||
|
||||
:param status_tip: Optional text to show in a popup when mouse pointer
|
||||
hovers over the action.
|
||||
:type status_tip: str
|
||||
|
||||
:param parent: Parent widget for the new action. Defaults None.
|
||||
:type parent: QWidget
|
||||
|
||||
:param whats_this: Optional text to show in the status bar when the
|
||||
mouse pointer hovers over the action.
|
||||
|
||||
:returns: The action that was created. Note that the action is also
|
||||
added to self.actions list.
|
||||
:rtype: QAction
|
||||
"""
|
||||
|
||||
icon = QIcon(icon_path)
|
||||
action = QAction(icon, text, parent)
|
||||
action.triggered.connect(callback)
|
||||
action.setEnabled(enabled_flag)
|
||||
|
||||
if status_tip is not None:
|
||||
action.setStatusTip(status_tip)
|
||||
|
||||
if whats_this is not None:
|
||||
action.setWhatsThis(whats_this)
|
||||
|
||||
if add_to_toolbar:
|
||||
self.toolbar.addAction(action)
|
||||
|
||||
if add_to_menu:
|
||||
self.iface.addPluginToMenu(
|
||||
self.menu,
|
||||
action)
|
||||
|
||||
self.actions.append(action)
|
||||
|
||||
return action
|
||||
|
||||
def initGui(self):
|
||||
"""Create the menu entries and toolbar icons inside the QGIS GUI."""
|
||||
|
||||
icon_path = ':/plugins/Copie/table_copie.png'
|
||||
self.add_action(
|
||||
icon_path,
|
||||
text=self.tr(u'Copie'),
|
||||
callback=self.run,
|
||||
parent=self.iface.mainWindow())
|
||||
|
||||
|
||||
def unload(self):
|
||||
"""Removes the plugin menu item and icon from QGIS GUI."""
|
||||
for action in self.actions:
|
||||
self.iface.removePluginMenu(
|
||||
self.tr(u'&Copie'),
|
||||
action)
|
||||
self.iface.removeToolBarIcon(action)
|
||||
# remove the toolbar
|
||||
del self.toolbar
|
||||
|
||||
|
||||
def run(self):
|
||||
"""Run method that performs all the real work"""
|
||||
layer = self.iface.activeLayer()
|
||||
|
||||
if layer == None :
|
||||
#self.iface.messageBar().pushMessage(u"Vous devez sélectionner une table !", level=QgsMessageBar.WARNING, duration=5)
|
||||
self.iface.messageBar().pushMessage("Ooops", u"Vous devez sélectionner une table !", level=Qgis.Warning, duration=5)
|
||||
|
||||
else :
|
||||
# Récupération des sources de la couche active
|
||||
list_sources = layer.source().split(" ")
|
||||
# dbname
|
||||
source_db = [s for s in list_sources if "dbname" in s][0].split("'")[1]
|
||||
# schema
|
||||
source_schema = [s for s in list_sources if "table" in s][0].split('"')[1]
|
||||
# tablename
|
||||
source_tablename = [s for s in list_sources if "table" in s][0].split('"')[3]
|
||||
|
||||
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()
|
||||
|
||||
# Creation de la liste des schemas de la base de donnees
|
||||
SQL = """WITH list_schema AS (
|
||||
SELECT catalog_name, schema_name
|
||||
FROM information_schema.schemata
|
||||
WHERE schema_name <> 'information_schema'
|
||||
AND schema_name !~ E'^pg_'
|
||||
ORDER BY schema_name
|
||||
)
|
||||
|
||||
SELECT string_agg(schema_name,',')
|
||||
FROM list_schema
|
||||
GROUP BY catalog_name"""
|
||||
|
||||
cur.execute(SQL)
|
||||
|
||||
list_brut = str(next(cur))
|
||||
|
||||
list = list_brut [2:-3]
|
||||
listItems = list.split(",")
|
||||
|
||||
con.close()
|
||||
|
||||
self.dlg.schema.clear()
|
||||
self.dlg.schema.addItems(listItems)
|
||||
self.dlg.schema.setCurrentIndex(-1) # Pour ne pas commencer la liste au premier schema
|
||||
|
||||
|
||||
self.dlg.table_source.setText(source_schema + "." + source_tablename) # Affiche le nom de la table source
|
||||
# show the dialog
|
||||
self.dlg.show()
|
||||
# Run the dialog event loop
|
||||
result = self.dlg.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()
|
||||
# Récupération de la couche active
|
||||
layer = self.iface.activeLayer()
|
||||
|
||||
# Récupération des sources de la couche active
|
||||
list_sources = layer.source().split(" ")
|
||||
# dbname
|
||||
source_db = [s for s in list_sources if "dbname" in s][0].split("'")[1]
|
||||
# schema
|
||||
source_schema = [s for s in list_sources if "table" in s][0].split('"')[1]
|
||||
# tablename
|
||||
source_tablename = [s for s in list_sources if "table" in s][0].split('"')[3]
|
||||
|
||||
if self.dlg.schema.currentIndex() == -1 :
|
||||
QMessageBox.warning(None, "Oups :", "Veuillez choisir un dossier de destination.")
|
||||
return
|
||||
|
||||
schema = self.dlg.schema.currentText()
|
||||
|
||||
if self.dlg.table_destination.text() == '' :
|
||||
QMessageBox.warning(None, "Oups :", "Veuillez choisir un nom de destination.")
|
||||
return
|
||||
|
||||
if self.dlg.annee.text() == 'aaaa' or self.dlg.annee.text() == '':
|
||||
tablename = schema + "_" + self.dlg.table_destination.text().lower()
|
||||
else :
|
||||
tablename = schema + "_" + self.dlg.table_destination.text().lower() + "_" + self.dlg.annee.text()
|
||||
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
|
||||
if self.dlg.table_vide.isChecked() == 1 :
|
||||
SQL_table = "CREATE TABLE " + schema + "." + tablename + " AS SELECT * FROM " + source_schema + "." + source_tablename + " LIMIT 0;"
|
||||
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);"
|
||||
SQL_sequence_03 = "SELECT setval(\'" + schema + "." + tablename + "_gid_seq\'::regclass, (SELECT max(gid) AS max_gid FROM " + schema + "." + tablename + "));"
|
||||
SQL_sequence_04 = "ALTER SEQUENCE " + schema + "." + tablename + "_gid_seq" + " OWNED BY " + schema + "." + tablename + ".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_table)
|
||||
cur.execute(SQL_pkey)
|
||||
cur.execute(SQL_sequence_01)
|
||||
cur.execute(SQL_sequence_02)
|
||||
cur.execute(SQL_sequence_03)
|
||||
cur.execute(SQL_sequence_04)
|
||||
|
||||
if layer.wkbType() == QgsWkbTypes.PointGeometry :
|
||||
cur.execute(SQL_trigger_coordonnees)
|
||||
|
||||
if layer.wkbType() == QgsWkbTypes.LineGeometry :
|
||||
cur.execute(SQL_trigger_length_m)
|
||||
cur.execute(SQL_trigger_length_km)
|
||||
|
||||
if layer.wkbType() == QgsWkbTypes.PolygonGeometry :
|
||||
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")
|
||||
|
||||
con.commit()
|
||||
con.close()
|
||||
|
||||
#self.iface.messageBar().pushMessage("Table \"" + source_schema + "." + source_tablename + u"\" copiée dans \"" + schema + "." + tablename + "\"." , level=QgsMessageBar.INFO, duration=10)
|
||||
self.iface.messageBar().pushMessage("Bravo!", "Table \"" + source_schema + "." + source_tablename + u"\" copiée dans \"" + schema + "." + tablename + "\".", level=Qgis.Success, duration=5)
|
||||
pass
|
||||
@@ -1,42 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
/***************************************************************************
|
||||
CopieDialog
|
||||
A QGIS plugin
|
||||
Permet la copie d'une table dans une base PostGis
|
||||
-------------------
|
||||
begin : 2015-04-13
|
||||
git sha : $Format:%H$
|
||||
copyright : (C) 2015 by Guillaume COSTES - CEN Rhône-Alpes
|
||||
email : guillaume.costes@espaces-naturels.fr
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from qgis.PyQt import QtCore, QtGui, QtGui, uic
|
||||
from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog
|
||||
|
||||
FORM_CLASS, _ = uic.loadUiType(os.path.join(
|
||||
os.path.dirname(__file__), 'copie_dialog_base.ui'))
|
||||
|
||||
|
||||
class CopieDialog(QDialog, FORM_CLASS):
|
||||
def __init__(self, parent=None):
|
||||
"""Constructor."""
|
||||
super(CopieDialog, self).__init__(parent)
|
||||
# Set up the user interface from Designer.
|
||||
# After setupUI you can access any designer object by doing
|
||||
# self.<objectname>, and you can use autoconnect slots - see
|
||||
# http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
|
||||
# #widgets-and-dialogs-with-auto-connect
|
||||
self.setupUi(self)
|
||||
@@ -1,107 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'copie_dialog_base.ui'
|
||||
#
|
||||
# Created: Tue Apr 14 11:48:04 2015
|
||||
# by: PyQt4 UI code generator 4.10.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from builtins import object
|
||||
from qgis.PyQt import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
def _fromUtf8(s):
|
||||
return s
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
class Ui_CopieDialogBase(object):
|
||||
def setupUi(self, CopieDialogBase):
|
||||
CopieDialogBase.setObjectName(_fromUtf8("CopieDialogBase"))
|
||||
CopieDialogBase.resize(386, 290)
|
||||
self.button_box = QtGui.QDialogButtonBox(CopieDialogBase)
|
||||
self.button_box.setGeometry(QtCore.QRect(100, 250, 161, 32))
|
||||
self.button_box.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.button_box.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||
self.button_box.setObjectName(_fromUtf8("button_box"))
|
||||
self.schema_label = QtGui.QLabel(CopieDialogBase)
|
||||
self.schema_label.setGeometry(QtCore.QRect(20, 100, 121, 29))
|
||||
self.schema_label.setMaximumSize(QtCore.QSize(10000, 16777215))
|
||||
self.schema_label.setObjectName(_fromUtf8("schema_label"))
|
||||
self.label_nom_table = QtGui.QLabel(CopieDialogBase)
|
||||
self.label_nom_table.setGeometry(QtCore.QRect(20, 150, 131, 29))
|
||||
font = QtGui.QFont()
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.label_nom_table.setFont(font)
|
||||
self.label_nom_table.setObjectName(_fromUtf8("label_nom_table"))
|
||||
self.schema = QtGui.QComboBox(CopieDialogBase)
|
||||
self.schema.setGeometry(QtCore.QRect(20, 130, 351, 20))
|
||||
self.schema.setObjectName(_fromUtf8("schema"))
|
||||
self.table_destination = QtGui.QLineEdit(CopieDialogBase)
|
||||
self.table_destination.setGeometry(QtCore.QRect(20, 180, 291, 20))
|
||||
font = QtGui.QFont()
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.table_destination.setFont(font)
|
||||
self.table_destination.setObjectName(_fromUtf8("table_destination"))
|
||||
self.annee = QtGui.QLineEdit(CopieDialogBase)
|
||||
self.annee.setGeometry(QtCore.QRect(320, 180, 50, 20))
|
||||
font = QtGui.QFont()
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.annee.setFont(font)
|
||||
self.annee.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.annee.setObjectName(_fromUtf8("annee"))
|
||||
self.table_vide = QtGui.QCheckBox(CopieDialogBase)
|
||||
self.table_vide.setGeometry(QtCore.QRect(60, 220, 271, 20))
|
||||
font = QtGui.QFont()
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.table_vide.setFont(font)
|
||||
self.table_vide.setObjectName(_fromUtf8("table_vide"))
|
||||
self.table_source = QtGui.QLineEdit(CopieDialogBase)
|
||||
self.table_source.setEnabled(False)
|
||||
self.table_source.setGeometry(QtCore.QRect(20, 60, 351, 20))
|
||||
font = QtGui.QFont()
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.table_source.setFont(font)
|
||||
self.table_source.setObjectName(_fromUtf8("table_source"))
|
||||
self.Titre = QtGui.QLabel(CopieDialogBase)
|
||||
self.Titre.setGeometry(QtCore.QRect(0, 0, 381, 31))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(14)
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.Titre.setFont(font)
|
||||
self.Titre.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.Titre.setObjectName(_fromUtf8("Titre"))
|
||||
self.table_source_label = QtGui.QLabel(CopieDialogBase)
|
||||
self.table_source_label.setGeometry(QtCore.QRect(20, 30, 75, 29))
|
||||
self.table_source_label.setMaximumSize(QtCore.QSize(75, 16777215))
|
||||
self.table_source_label.setObjectName(_fromUtf8("table_source_label"))
|
||||
|
||||
self.retranslateUi(CopieDialogBase)
|
||||
QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("accepted()")), CopieDialogBase.accept)
|
||||
QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("rejected()")), CopieDialogBase.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(CopieDialogBase)
|
||||
|
||||
def retranslateUi(self, CopieDialogBase):
|
||||
CopieDialogBase.setWindowTitle(_translate("CopieDialogBase", "Copie", None))
|
||||
self.schema_label.setText(_translate("CopieDialogBase", "Dossier de destination ", None))
|
||||
self.label_nom_table.setText(_translate("CopieDialogBase", "Nom de la nouvelle table", None))
|
||||
self.annee.setText(_translate("CopieDialogBase", "aaaa", None))
|
||||
self.table_vide.setText(_translate("CopieDialogBase", "Cocher cette case pour vider la table de destination", None))
|
||||
self.Titre.setText(_translate("CopieDialogBase", "Copie d\'une table", None))
|
||||
self.table_source_label.setText(_translate("CopieDialogBase", "Table source ", None))
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
# -*- 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
|
||||
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
|
||||
import os
|
||||
|
||||
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,
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
from qgis.utils import iface
|
||||
import os.path
|
||||
import webbrowser, os
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
import base64
|
||||
|
||||
EDITOR_CLASS = load_ui('CenRa_Copie_base.ui')
|
||||
|
||||
class Copie_Editor(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
|
||||
|
||||
def raise_(self):
|
||||
"""Run method that performs all the real work"""
|
||||
layer = self.iface.activeLayer()
|
||||
|
||||
if layer == None :
|
||||
#self.iface.messageBar().pushMessage(u"Vous devez sélectionner une table !", level=QgsMessageBar.WARNING, duration=5)
|
||||
self.iface.messageBar().pushMessage("Ooops", u"Vous devez sélectionner une table !", level=Qgis.Warning, duration=5)
|
||||
|
||||
else :
|
||||
# Récupération des sources de la couche active
|
||||
list_sources = layer.source().split(" ")
|
||||
# dbname
|
||||
source_db = [s for s in list_sources if "dbname" in s][0].split("'")[1]
|
||||
# schema
|
||||
source_schema = [s for s in list_sources if "table" in s][0].split('"')[1]
|
||||
# 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:
|
||||
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 catalog_name, schema_name
|
||||
FROM information_schema.schemata
|
||||
WHERE schema_name <> 'information_schema'
|
||||
AND schema_name !~ E'^pg_'
|
||||
ORDER BY schema_name
|
||||
)
|
||||
|
||||
SELECT string_agg(schema_name,',')
|
||||
FROM list_schema
|
||||
GROUP BY catalog_name"""
|
||||
|
||||
cur.execute(SQL)
|
||||
|
||||
list_brut = str(next(cur))
|
||||
|
||||
list = list_brut [2:-3]
|
||||
listItems = list.split(",")
|
||||
|
||||
con.close()
|
||||
|
||||
self.schema.clear()
|
||||
self.schema.addItems(listItems)
|
||||
self.schema.setCurrentIndex(-1) # Pour ne pas commencer la liste au premier schema
|
||||
|
||||
|
||||
self.table_source.setText(source_schema + "." + source_tablename) # Affiche le nom de la table source
|
||||
# show the dialog
|
||||
self.show()
|
||||
# Run the dialog event loop
|
||||
result = self.exec()
|
||||
# See if OK was pressed
|
||||
if result:
|
||||
#******************************debut script*********************************
|
||||
|
||||
|
||||
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()
|
||||
|
||||
# Récupération des sources de la couche active
|
||||
list_sources = layer.source().split(" ")
|
||||
# dbname
|
||||
source_db = [s for s in list_sources if "dbname" in s][0].split("'")[1]
|
||||
# schema
|
||||
source_schema = [s for s in list_sources if "table" in s][0].split('"')[1]
|
||||
# tablename
|
||||
source_tablename = [s for s in list_sources if "table" in s][0].split('"')[3]
|
||||
|
||||
if self.schema.currentIndex() == -1 :
|
||||
QMessageBox.warning(None, "Oups :", "Veuillez choisir un dossier de destination.")
|
||||
return
|
||||
|
||||
schema = self.schema.currentText()
|
||||
|
||||
if self.table_destination.text() == '' :
|
||||
QMessageBox.warning(None, "Oups :", "Veuillez choisir un nom de destination.")
|
||||
return
|
||||
|
||||
if self.annee.text() == 'aaaa' or self.annee.text() == '':
|
||||
tablename = schema + "_" + self.table_destination.text().lower()
|
||||
else :
|
||||
tablename = schema + "_" + self.table_destination.text().lower() + "_" + self.annee.text()
|
||||
|
||||
tablename_qgis = tablename[1:] # Permet d'enlever le "_", ajouter a la premiere etape, dans qgis
|
||||
|
||||
if self.table_vide.isChecked() == 1 :
|
||||
SQL_table = "CREATE TABLE " + schema + "." + tablename + " AS SELECT * FROM " + source_schema + "." + source_tablename + " LIMIT 0;"
|
||||
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);"
|
||||
SQL_sequence_03 = "SELECT setval(\'" + schema + "." + tablename + "_gid_seq\'::regclass, (SELECT max(gid) AS max_gid FROM " + schema + "." + tablename + "));"
|
||||
SQL_sequence_04 = "ALTER SEQUENCE " + schema + "." + tablename + "_gid_seq" + " OWNED BY " + schema + "." + tablename + ".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_table)
|
||||
cur.execute(SQL_pkey)
|
||||
cur.execute(SQL_sequence_01)
|
||||
cur.execute(SQL_sequence_02)
|
||||
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)
|
||||
|
||||
if layer.wkbType() == QgsWkbTypes.LineGeometry :
|
||||
cur.execute(SQL_trigger_length_m)
|
||||
cur.execute(SQL_trigger_length_km)
|
||||
|
||||
if layer.wkbType() == QgsWkbTypes.PolygonGeometry :
|
||||
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")
|
||||
|
||||
con.commit()
|
||||
con.close()
|
||||
|
||||
#self.iface.messageBar().pushMessage("Table \"" + source_schema + "." + source_tablename + u"\" copiée dans \"" + schema + "." + tablename + "\"." , level=QgsMessageBar.INFO, duration=10)
|
||||
self.iface.messageBar().pushMessage("Bravo!", "Table \"" + source_schema + "." + source_tablename + u"\" copiée dans \"" + schema + "." + tablename + "\".", level=Qgis.Success, duration=5)
|
||||
pass
|
||||
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,88 @@
|
||||
import os
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
end_find = plugin_dir.rfind('\\')+1
|
||||
|
||||
NAME = plugin_dir[end_find:]
|
||||
|
||||
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)
|
||||
@@ -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=1.5
|
||||
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>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
|
||||
@@ -28,7 +29,7 @@ repository=https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS
|
||||
homepage=https://plateformesig.cenra-outils.org/
|
||||
|
||||
category=Plugins
|
||||
icon=cenra.png
|
||||
icon=icon.png
|
||||
# experimental flag
|
||||
experimental=True
|
||||
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
"""This script uploads a plugin package on the server.
|
||||
Authors: A. Pasotti, V. Picavet
|
||||
git sha : $TemplateVCSFormat
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from builtins import input
|
||||
import sys
|
||||
import getpass
|
||||
import xmlrpc.client
|
||||
from optparse import OptionParser
|
||||
|
||||
# Configuration
|
||||
PROTOCOL = 'http'
|
||||
SERVER = 'plugins.qgis.org'
|
||||
PORT = '80'
|
||||
ENDPOINT = '/plugins/RPC2/'
|
||||
VERBOSE = False
|
||||
|
||||
|
||||
def main(parameters, arguments):
|
||||
"""Main entry point.
|
||||
|
||||
:param parameters: Command line parameters.
|
||||
:param arguments: Command line arguments.
|
||||
"""
|
||||
address = "%s://%s:%s@%s:%s%s" % (
|
||||
PROTOCOL,
|
||||
parameters.username,
|
||||
parameters.password,
|
||||
parameters.server,
|
||||
parameters.port,
|
||||
ENDPOINT)
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("Connecting to: %s" % hide_password(address))
|
||||
|
||||
server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE)
|
||||
|
||||
try:
|
||||
plugin_id, version_id = server.plugin.upload(
|
||||
xmlrpc.client.Binary(open(arguments[0]).read()))
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("Plugin ID: %s" % plugin_id)
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("Version ID: %s" % version_id)
|
||||
except xmlrpc.client.ProtocolError as err:
|
||||
# fix_print_with_import
|
||||
print("A protocol error occurred")
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("URL: %s" % hide_password(err.url, 0))
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("HTTP/HTTPS headers: %s" % err.headers)
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("Error code: %d" % err.errcode)
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("Error message: %s" % err.errmsg)
|
||||
except xmlrpc.client.Fault as err:
|
||||
# fix_print_with_import
|
||||
print("A fault occurred")
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("Fault code: %d" % err.faultCode)
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("Fault string: %s" % err.faultString)
|
||||
|
||||
|
||||
def hide_password(url, start=6):
|
||||
"""Returns the http url with password part replaced with '*'.
|
||||
|
||||
:param url: URL to upload the plugin to.
|
||||
:type url: str
|
||||
|
||||
:param start: Position of start of password.
|
||||
:type start: int
|
||||
"""
|
||||
start_position = url.find(':', start) + 1
|
||||
end_position = url.find('@')
|
||||
return "%s%s%s" % (
|
||||
url[:start_position],
|
||||
'*' * (end_position - start_position),
|
||||
url[end_position:])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser(usage="%prog [options] plugin.zip")
|
||||
parser.add_option(
|
||||
"-w", "--password", dest="password",
|
||||
help="Password for plugin site", metavar="******")
|
||||
parser.add_option(
|
||||
"-u", "--username", dest="username",
|
||||
help="Username of plugin site", metavar="user")
|
||||
parser.add_option(
|
||||
"-p", "--port", dest="port",
|
||||
help="Server port to connect to", metavar="80")
|
||||
parser.add_option(
|
||||
"-s", "--server", dest="server",
|
||||
help="Specify server name", metavar="plugins.qgis.org")
|
||||
options, args = parser.parse_args()
|
||||
if len(args) != 1:
|
||||
# fix_print_with_import
|
||||
print("Please specify zip file.\n")
|
||||
parser.print_help()
|
||||
sys.exit(1)
|
||||
if not options.server:
|
||||
options.server = SERVER
|
||||
if not options.port:
|
||||
options.port = PORT
|
||||
if not options.username:
|
||||
# interactive mode
|
||||
username = getpass.getuser()
|
||||
# fix_print_with_import
|
||||
# fix_print_with_import
|
||||
print("Please enter user name [%s] :" % username, end=' ')
|
||||
res = input()
|
||||
if res != "":
|
||||
options.username = res
|
||||
else:
|
||||
options.username = username
|
||||
if not options.password:
|
||||
# interactive mode
|
||||
options.password = getpass.getpass()
|
||||
main(options, args)
|
||||
@@ -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)
|
||||
)
|
||||
"""
|
||||
|
After Width: | Height: | Size: 910 B |
@@ -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_Metabase\\resources")))
|
||||
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)
|
||||
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CenRa_IssuesSend</class>
|
||||
<widget class="QDialog" name="CenRa_IssuesSend">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>810</width>
|
||||
<height>587</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CEN-RA Metabase</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>icon.svg</normaloff>icon.svg</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>550</y>
|
||||
<width>811</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="annuler_button">
|
||||
<property name="text">
|
||||
<string>Annuler</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<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="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="QPushButton" name="ok_button">
|
||||
<property name="text">
|
||||
<string>Envoyer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>791</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Issues</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="titre_line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>40</y>
|
||||
<width>321</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="messages_plain">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>101</y>
|
||||
<width>571</width>
|
||||
<height>421</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>589</x>
|
||||
<y>100</y>
|
||||
<width>191</width>
|
||||
<height>431</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="formLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>341</width>
|
||||
<height>411</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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="check_bug">
|
||||
<property name="text">
|
||||
<string>Bug</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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="2" column="1">
|
||||
<widget class="QCheckBox" name="check_aide">
|
||||
<property name="text">
|
||||
<string>Aide</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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="3" column="1">
|
||||
<widget class="QCheckBox" name="check_question">
|
||||
<property name="text">
|
||||
<string>Question</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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="4" column="1">
|
||||
<widget class="QCheckBox" name="check_amelioration">
|
||||
<property name="text">
|
||||
<string>Amélioration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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="5" column="1">
|
||||
<widget class="QCheckBox" name="check_autre">
|
||||
<property name="text">
|
||||
<string>Autre</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>20</y>
|
||||
<width>51</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Titre:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Messages:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>600</x>
|
||||
<y>70</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sujet:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>ok_button</tabstop>
|
||||
<tabstop>annuler_button</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +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>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>
|
||||
@@ -0,0 +1,107 @@
|
||||
__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>
|
||||
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 AboutDialog
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
|
||||
class PgFlux:
|
||||
def __init__(self):
|
||||
""" Constructor. """
|
||||
self.action_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_FLUX','version')
|
||||
s = QSettings()
|
||||
versionUse = s.value("flux/version", 1, type=str)
|
||||
if str(versionUse) != str(version) :
|
||||
s.setValue("flux/version", str(version))
|
||||
print(versionUse,version)
|
||||
self.open_about_dialog()
|
||||
|
||||
def initGui(self):
|
||||
""" Build the plugin GUI. """
|
||||
|
||||
self.toolBar = iface.addToolBar("CenRa_Flux")
|
||||
self.toolBar.setObjectName("CenRa_Flux")
|
||||
|
||||
icon = QIcon(resources_path('icons', 'icon.png'))
|
||||
|
||||
# Open the online help
|
||||
self.help_action = QAction(icon, "CenRa_Flux", iface.mainWindow())
|
||||
iface.pluginHelpMenu().addAction(self.help_action)
|
||||
self.help_action.triggered.connect(self.open_help)
|
||||
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 = AboutDialog(iface)
|
||||
dialog.exec()
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
def open_editor(self):
|
||||
self.action_editor.show()
|
||||
self.action_editor.raise_()
|
||||
|
||||
def unload(self):
|
||||
""" Unload the plugin. """
|
||||
if self.action_editor:
|
||||
iface.removePluginMenu('CenRa_Flux',self.flux_editor)
|
||||
|
||||
|
||||
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
|
||||
@@ -1,940 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
/***************************************************************************
|
||||
FluxCEN
|
||||
A QGIS plugin
|
||||
Centralisation des flux WFS/WMS utilisés au CEN NA
|
||||
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
|
||||
-------------------
|
||||
begin : 2022-03-23
|
||||
git sha : $Format:%H$
|
||||
copyright : (C) 2022 by Romain MONTILLET
|
||||
email : r.montillet@cen-na.org
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
"""
|
||||
from qgis.PyQt.QtCore import QSettings, QTranslator, QCoreApplication, Qt, QUrl
|
||||
from qgis.PyQt.QtGui import *
|
||||
from qgis.PyQt.QtWidgets import *
|
||||
from PyQt5 import *
|
||||
|
||||
# Initialize Qt resources from file resources.py
|
||||
from .resources import *
|
||||
# Import the code for the dialog
|
||||
from .FluxCEN_dialog import FluxCENDialog
|
||||
import os.path, os, shutil
|
||||
from qgis.core import *
|
||||
from qgis.gui import *
|
||||
from qgis.utils import *
|
||||
from .forms.about_form import FluxAboutDialog
|
||||
import qgis
|
||||
import processing
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
from PyQt5.QtXml import QDomDocument
|
||||
import csv
|
||||
import os
|
||||
import io
|
||||
import re
|
||||
import random
|
||||
# Deal with SSL
|
||||
import ssl
|
||||
import urllib
|
||||
from urllib import request, parse
|
||||
import socket
|
||||
import json
|
||||
import requests
|
||||
import base64
|
||||
|
||||
ssl._create_default_https_context = ssl._create_unverified_context
|
||||
|
||||
from .tools.resources import maj_verif
|
||||
from .tools.PythonSQL import *
|
||||
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)
|
||||
#from .HubToTea import gitea
|
||||
#gitea()
|
||||
first_conn.close()
|
||||
|
||||
|
||||
'''
|
||||
# Vérifier la connexion à internet
|
||||
try:
|
||||
# Vérifier si l'utilisateur est connecté à internet en ouvrant une connexion avec un site web
|
||||
host = socket.gethostbyname("www.google.com")
|
||||
s = socket.create_connection((host, 80), 2)
|
||||
s.close()
|
||||
except socket.error:
|
||||
# Afficher un message si l'utilisateur n'est pas connecté à internet
|
||||
QMessageBox.warning(None, 'Avertissement',
|
||||
'Vous n\'êtes actuellement pas connecté à internet. Veuillez vous connecter pour pouvoir utiliser FluxCEN !')
|
||||
'''
|
||||
|
||||
class Flux:
|
||||
def __init__(self, t, c, nc, l, u, p):
|
||||
self.type = t
|
||||
self.category = c
|
||||
self.nom_commercial = nc
|
||||
self.layer = l
|
||||
self.url = u
|
||||
self.parameters = p
|
||||
maj_verif('CenRa_FLUX')
|
||||
|
||||
|
||||
class Popup(QWidget):
|
||||
def __init__(self, parent=None):
|
||||
super(Popup, self).__init__(parent)
|
||||
|
||||
self.plugin_dir = os.path.dirname(__file__)
|
||||
|
||||
self.text_edit = QTextBrowser()
|
||||
fp = urllib.request.urlopen("https://raw.githubusercontent.com/CEN-Nouvelle-Aquitaine/fluxcen/main/info_changelog.html")
|
||||
mybytes = fp.read()
|
||||
html_changelog = mybytes.decode("utf8")
|
||||
fp.close()
|
||||
|
||||
self.text_edit.setHtml(html_changelog)
|
||||
self.text_edit.setFont(QtGui.QFont("Calibri",weight=QtGui.QFont.Bold))
|
||||
self.text_edit.anchorClicked.connect(QtGui.QDesktopServices.openUrl)
|
||||
self.text_edit.setOpenLinks(False)
|
||||
|
||||
self.text_edit.setWindowTitle("Nouveautés")
|
||||
self.text_edit.setMinimumSize(600,450)
|
||||
|
||||
class FluxCEN:
|
||||
"""QGIS Plugin Implementation."""
|
||||
|
||||
def __init__(self, iface):
|
||||
"""Constructor.
|
||||
|
||||
:param iface: An interface instance that will be passed to this class
|
||||
which provides the hook by which you can manipulate the QGIS
|
||||
application at run time.
|
||||
:type iface: QgsInterface
|
||||
"""
|
||||
# Save reference to the QGIS interface
|
||||
self.iface = iface
|
||||
# initialize plugin directory
|
||||
self.plugin_dir = os.path.dirname(__file__)
|
||||
# initialize locale
|
||||
#print(QSettings().value('locale/userLocale'))
|
||||
locale = QSettings().value('locale/userLocale')[0:2]
|
||||
locale_path = os.path.join(
|
||||
self.plugin_dir,
|
||||
'i18n',
|
||||
'FluxCEN_{}.qm'.format(locale))
|
||||
|
||||
version = qgis.utils.pluginMetadata('CenRa_FLUX','version')
|
||||
# Display About window on first use
|
||||
s = QSettings()
|
||||
versionUse = s.value("flux/version", 1, type=str)
|
||||
if str(versionUse) != str(version) :
|
||||
s.setValue("flux/version", str(version))
|
||||
self.open_about_dialog()
|
||||
|
||||
if os.path.exists(locale_path):
|
||||
self.translator = QTranslator()
|
||||
self.translator.load(locale_path)
|
||||
QCoreApplication.installTranslator(self.translator)
|
||||
|
||||
# Declare instance attributes
|
||||
self.actions = []
|
||||
self.menu = self.tr(u'&FluxCEN')
|
||||
self.dlg = FluxCENDialog()
|
||||
|
||||
self.plugin_path = os.path.dirname(__file__)
|
||||
|
||||
# Check if plugin was started the first time in current QGIS session
|
||||
# Must be set in initGui() to survive plugin reloads
|
||||
self.first_start = None
|
||||
|
||||
self.dlg.tableWidget.setSelectionBehavior(QTableWidget.SelectRows)
|
||||
self.dlg.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
|
||||
self.dlg.comboBox_2.addItem("SIG")
|
||||
self.dlg.comboBox_2.addItem('REF')
|
||||
# self.dlg.comboBox.addItem('07')
|
||||
# self.dlg.comboBox.addItem('26')
|
||||
# self.dlg.comboBox.addItem('42')
|
||||
# self.dlg.comboBox.addItem('69')
|
||||
# self.dlg.comboBox.addItem('form')
|
||||
|
||||
self.dlg.comboBox.currentIndexChanged.connect(self.initialisation_flux)
|
||||
self.dlg.commandLinkButton.clicked.connect(self.selection_flux)
|
||||
self.dlg.tableWidget.itemDoubleClicked.connect(self.selection_flux)
|
||||
self.dlg.pushButton_2.clicked.connect(self.limite_flux)
|
||||
self.dlg.commandLinkButton_2.clicked.connect(self.suppression_flux)
|
||||
self.dlg.tableWidget_2.itemDoubleClicked.connect(self.suppression_flux)
|
||||
self.dlg.comboBox_2.currentIndexChanged.connect(self.bd_source)
|
||||
#self.dlg.commandLinkButton_3.clicked.connect(self.option_OSM)
|
||||
#self.dlg.commandLinkButton_4.clicked.connect(self.option_google_maps)
|
||||
|
||||
#self.dlg.commandLinkButton_5.clicked.connect(self.popup)
|
||||
# iface.mapCanvas().extentsChanged.connect(self.test5)
|
||||
|
||||
# url_open = urllib.request.urlopen("https://raw.githubusercontent.com/CEN-Rhone-Alpes/Plugin_QGIS/main/flux.csv")
|
||||
# colonnes_flux = csv.DictReader(io.TextIOWrapper(url_open, encoding='utf8'), delimiter=';')
|
||||
|
||||
#mots_cles = [row["categorie"] for row in colonnes_flux if row["categorie"]]
|
||||
#categories = list(set(mots_cles))
|
||||
#categories.sort()
|
||||
|
||||
#self.dlg.comboBox.addItems(categories)
|
||||
layout = QVBoxLayout()
|
||||
self.dlg.lineEdit.textChanged.connect(self.filtre_dynamique)
|
||||
layout.addWidget(self.dlg.lineEdit)
|
||||
self.dlg.lineEdit.mousePressEvent = self._mousePressEvent
|
||||
|
||||
metadonnees_plugin = open(self.plugin_path + '/metadata.txt')
|
||||
infos_metadonnees = metadonnees_plugin.readlines()
|
||||
|
||||
# derniere_version = urllib.request.urlopen("https://sig.dsi-cen.org/qgis/downloads/last_version_fluxcen.txt")
|
||||
# num_last_version = derniere_version.readlines()[0].decode("utf-8")
|
||||
|
||||
# Connect the itemClicked signal to the open_url function
|
||||
#self.dlg.tableWidget.itemClicked.connect(self.open_url)
|
||||
|
||||
# version_utilisateur = infos_metadonnees[8].splitlines()
|
||||
|
||||
# if infos_metadonnees[8].splitlines() == num_last_version.splitlines():
|
||||
# iface.messageBar().pushMessage("Plugin à jour", "Votre version de FluxCEN %s est à jour !" %version_utilisateur, level=Qgis.Success, duration=5)
|
||||
# else:
|
||||
# iface.messageBar().pushMessage("Information :", "Une nouvelle version de FluxCEN est disponible, veuillez mettre à jour le plugin !", level=Qgis.Info, duration=120)
|
||||
|
||||
def open_about_dialog(self):
|
||||
dialog = FluxAboutDialog(self.iface)
|
||||
dialog.exec_()
|
||||
|
||||
def _mousePressEvent(self, event):
|
||||
self.dlg.lineEdit.setText("")
|
||||
self.dlg.lineEdit.mousePressEvent = None
|
||||
|
||||
# noinspection PyMethodMayBeStatic
|
||||
def tr(self, message):
|
||||
"""Get the translation for a string using Qt translation API.
|
||||
|
||||
We implement this ourselves since we do not inherit QObject.
|
||||
|
||||
:param message: String for translation.
|
||||
:type message: str, QString
|
||||
|
||||
:returns: Translated version of message.
|
||||
:rtype: QString
|
||||
"""
|
||||
# noinspection PyTypeChecker,PyArgumentList,PyCallByClass
|
||||
return QCoreApplication.translate('FluxCEN', message)
|
||||
|
||||
|
||||
def add_action(
|
||||
self,
|
||||
icon_path,
|
||||
text,
|
||||
callback,
|
||||
dbtype=None,
|
||||
enabled_flag=True,
|
||||
add_to_menu=True,
|
||||
add_to_toolbar=True,
|
||||
status_tip=None,
|
||||
whats_this=None,
|
||||
parent=None):
|
||||
"""Add a toolbar icon to the toolbar.
|
||||
|
||||
:param icon_path: Path to the icon for this action. Can be a resource
|
||||
path (e.g. ':/plugins/foo/bar.png') or a normal file system path.
|
||||
:type icon_path: str
|
||||
|
||||
:param text: Text that should be shown in menu items for this action.
|
||||
:type text: str
|
||||
|
||||
:param callback: Function to be called when the action is triggered.
|
||||
:type callback: function
|
||||
|
||||
:param enabled_flag: A flag indicating if the action should be enabled
|
||||
by default. Defaults to True.
|
||||
:type enabled_flag: bool
|
||||
|
||||
:param add_to_menu: Flag indicating whether the action should also
|
||||
be added to the menu. Defaults to True.
|
||||
:type add_to_menu: bool
|
||||
|
||||
:param add_to_toolbar: Flag indicating whether the action should also
|
||||
be added to the toolbar. Defaults to True.
|
||||
:type add_to_toolbar: bool
|
||||
|
||||
:param status_tip: Optional text to show in a popup when mouse pointer
|
||||
hovers over the action.
|
||||
:type status_tip: str
|
||||
|
||||
:param parent: Parent widget for the new action. Defaults None.
|
||||
:type parent: QWidget
|
||||
:param whats_this: Optional text to show in the status bar when the
|
||||
mouse pointer hovers over the action.
|
||||
|
||||
:returns: The action that was created. Note that the action is also
|
||||
added to self.actions list.
|
||||
:rtype: QAction
|
||||
"""
|
||||
|
||||
icon = QIcon(icon_path)
|
||||
action = QAction(icon, text, parent)
|
||||
action.triggered.connect(callback)
|
||||
action.setEnabled(enabled_flag)
|
||||
|
||||
if status_tip is not None:
|
||||
action.setStatusTip(status_tip)
|
||||
|
||||
if whats_this is not None:
|
||||
action.setWhatsThis(whats_this)
|
||||
|
||||
if add_to_toolbar:
|
||||
# Adds plugin icon to Plugins toolbar
|
||||
#self.iface.addToolBarIcon(action)
|
||||
self.toolBar.addAction(action)
|
||||
|
||||
if add_to_menu:
|
||||
self.iface.addPluginToMenu(
|
||||
self.menu,
|
||||
action)
|
||||
|
||||
self.actions.append(action)
|
||||
|
||||
return action
|
||||
|
||||
def initGui(self):
|
||||
self.toolBar = self.iface.addToolBar("FluxCEN")
|
||||
self.toolBar.setObjectName("FluxCEN")
|
||||
"""Create the menu entries and toolbar icons inside the QGIS GUI."""
|
||||
icon_path = ':/plugins/CenRa_FLUX/reficon.png'
|
||||
self.add_action(
|
||||
icon_path,
|
||||
text=self.tr(u'SigCEN'),
|
||||
callback=self.bd_source,
|
||||
dbtype='"+dbname+"',
|
||||
parent=self.iface.mainWindow())
|
||||
'''
|
||||
icon_path_2 = ':/plugins/CenRa_FLUX/reficon.png'
|
||||
self.add_action(
|
||||
icon_path_2,
|
||||
text=self.tr(u'RefCEN'),
|
||||
callback=self.run_ref,
|
||||
dbtype='ref_geo4269',
|
||||
parent=self.iface.mainWindow())
|
||||
'''
|
||||
|
||||
# will be set False in run()
|
||||
self.first_start = False
|
||||
|
||||
def unload(self):
|
||||
"""Removes the plugin menu item and icon from QGIS GUI."""
|
||||
for action in self.actions:
|
||||
self.iface.removePluginMenu(
|
||||
self.tr(u'&SigCEN'),
|
||||
action)
|
||||
self.iface.removeToolBarIcon(action)
|
||||
for action in self.actions:
|
||||
self.iface.removePluginMenu(
|
||||
self.tr(u'&RefCEN'),
|
||||
action)
|
||||
self.iface.removeToolBarIcon(action)
|
||||
|
||||
def bd_source(self):
|
||||
self.dlg.activateWindow()
|
||||
bd_origine=self.dlg.comboBox_2.currentText()
|
||||
if bd_origine == 'REF':
|
||||
self.run_ref()
|
||||
if bd_origine == 'SIG':
|
||||
self.run_sig()
|
||||
|
||||
def run_ref(self):
|
||||
"""Run method that performs all the real work"""
|
||||
while self.dlg.tableWidget_2.rowCount() > 0:
|
||||
self.dlg.tableWidget_2.removeRow(self.dlg.tableWidget_2.rowCount()-1)
|
||||
# print(self.dlg.tableWidget_2.rowCount())
|
||||
global cur,con,dbtype
|
||||
dbtype=refdb
|
||||
con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbtype+" user=" + user + " password=" + mdp)
|
||||
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
|
||||
self.initialisation_flux()
|
||||
self.combobox_custom()
|
||||
# Create the dialog with elements (after translation) and keep reference
|
||||
# Only create GUI ONCE in callback, so that it will only load when the plugin is started
|
||||
if self.first_start == True:
|
||||
self.first_start = False
|
||||
# show the dialog
|
||||
self.dlg.show()
|
||||
# Run the dialog event loop
|
||||
result = self.dlg.exec_()
|
||||
# See if OK was pressed
|
||||
if result:
|
||||
# Do something useful here - delete the line containing pass and
|
||||
# substitute with your code.
|
||||
pass
|
||||
|
||||
def run_sig(self):
|
||||
"""Run method that performs all the real work"""
|
||||
while self.dlg.tableWidget_2.rowCount() > 0:
|
||||
self.dlg.tableWidget_2.removeRow(self.dlg.tableWidget_2.rowCount()-1)
|
||||
global cur,con,dbtype
|
||||
dbtype=sigdb
|
||||
con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbtype+" user=" + user + " password=" + mdp)
|
||||
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
|
||||
self.initialisation_flux()
|
||||
self.combobox_custom()
|
||||
# Create the dialog with elements (after translation) and keep reference
|
||||
# Only create GUI ONCE in callback, so that it will only load when the plugin is started
|
||||
if self.first_start == True:
|
||||
self.first_start = False
|
||||
# show the dialog
|
||||
self.dlg.show()
|
||||
# Run the dialog event loop
|
||||
result = self.dlg.exec_()
|
||||
# See if OK was pressed
|
||||
if result:
|
||||
# Do something useful here - delete the line containing pass and
|
||||
# substitute with your code.
|
||||
pass
|
||||
|
||||
def suppression_flux(self):
|
||||
self.dlg.tableWidget_2.removeRow(self.dlg.tableWidget_2.currentRow())
|
||||
'''
|
||||
def option_OSM(self):
|
||||
tms = 'type=xyz&url=https://tile.openstreetmap.org/{z}/{x}/{y}.png&zmax=19&zmin=0'
|
||||
layer = QgsRasterLayer(tms, 'OSM', 'wms')
|
||||
|
||||
if not QgsProject.instance().mapLayersByName("OSM"):
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
else:
|
||||
QMessageBox.question(iface.mainWindow(), u"Fond OSM déjà chargé !", "Le fond de carte OSM est déjà chargé", QMessageBox.Ok)
|
||||
|
||||
OSM_layer = QgsProject.instance().mapLayersByName("OSM")[0]
|
||||
|
||||
root = QgsProject.instance().layerTreeRoot()
|
||||
|
||||
# Move Layer
|
||||
OSM_layer = root.findLayer(OSM_layer.id())
|
||||
myClone = OSM_layer.clone()
|
||||
parent = OSM_layer.parent()
|
||||
parent.insertChildNode(-1, myClone)
|
||||
parent.removeChildNode(OSM_layer)
|
||||
|
||||
|
||||
def option_google_maps(self):
|
||||
tms = 'type=xyz&zmin=0&zmax=20&url=https://mt1.google.com/vt/lyrs%3Ds%26x%3D{x}%26y%3D{y}%26z%3D{z}'
|
||||
layer = QgsRasterLayer(tms, 'Google Satelitte', 'wms')
|
||||
|
||||
if not QgsProject.instance().mapLayersByName("Google Satelitte"):
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
else:
|
||||
QMessageBox.question(iface.mainWindow(), u"Fond Google Sat' déjà chargé !", "Le fond de carte Google Satelitte est déjà chargé", QMessageBox.Ok)
|
||||
|
||||
google_layer = QgsProject.instance().mapLayersByName("Google Satelitte")[0]
|
||||
|
||||
root = QgsProject.instance().layerTreeRoot()
|
||||
|
||||
# Move Layer
|
||||
google_layer = root.findLayer(google_layer.id())
|
||||
myClone = google_layer.clone()
|
||||
parent = google_layer.parent()
|
||||
parent.insertChildNode(-1, myClone)
|
||||
parent.removeChildNode(google_layer)
|
||||
'''
|
||||
|
||||
def open_url(self, item):
|
||||
url = item.data(Qt.UserRole)
|
||||
#if url:
|
||||
# Open the URL, you might use QDesktopServices.openUrl for this in a standalone PyQt application
|
||||
# QDesktopServices.openUrl(QUrl(url))
|
||||
|
||||
def initialisation_flux(self):
|
||||
'''
|
||||
def csv_import(url):
|
||||
url_open = urllib.request.urlopen(url)
|
||||
csvfile = csv.reader(io.TextIOWrapper(url_open, encoding='utf8'), delimiter=';')
|
||||
#on ne lit pas la première ligne correspondant aux noms des colonnes avec next()
|
||||
next(csvfile)
|
||||
return csvfile;
|
||||
|
||||
data = []
|
||||
data2 = []
|
||||
model = QStandardItemModel()
|
||||
|
||||
raw = csv_import(
|
||||
"https://raw.githubusercontent.com/CEN-Rhone-Alpes/Plugin_QGIS/main/flux.csv")
|
||||
for row in raw:
|
||||
data.append(row)
|
||||
data2.append(row)
|
||||
data = [k for k in data if self.dlg.comboBox.currentText() in k]
|
||||
data.sort()
|
||||
data2.sort()
|
||||
items = [
|
||||
QStandardItem(field)
|
||||
for field in row]
|
||||
|
||||
model.appendRow(items)
|
||||
|
||||
row=0
|
||||
data=['a1','a2','a3']
|
||||
data2=[['b1','c1','d1'],['b2','c2','d2'],['b3','c3','d3']]
|
||||
if self.dlg.comboBox.currentText() == 'toutes les catégories':
|
||||
# print(str(data2[0]))
|
||||
# del data2[0]
|
||||
# print(str(data2[0]))
|
||||
nb_row = len(data2)
|
||||
nb_col = len(data2[0])
|
||||
print(data2[row][2])
|
||||
self.dlg.tableWidget.setRowCount(nb_row)
|
||||
self.dlg.tableWidget.setColumnCount(nb_col)
|
||||
for row in range(nb_row):
|
||||
for col in range(nb_col):
|
||||
item = QTableWidgetItem(str(data2[row][col]))
|
||||
# Access the value from the 6th column for the current row (style here)
|
||||
value_from_2nd_column = str(data2[row][2])
|
||||
# Set tooltip for each row
|
||||
tooltip = f"Nom du flux: {value_from_2nd_column}"
|
||||
item.setToolTip(tooltip)
|
||||
|
||||
# Check if the current column is the "Résumé des métadonnées" column
|
||||
if col == 7:
|
||||
# Set icon for the "Résumé des métadonnées" column
|
||||
icon_path = self.plugin_path + '/info_metadata.png' # Replace 'path_to_your_icon.png' with the actual path to your icon
|
||||
icon = QIcon(icon_path)
|
||||
item.setIcon(icon)
|
||||
# Store the URL in the item's data for later retrieval
|
||||
url_from_6th_column = str(data2[row][7]) # Assuming the URL is in the next column
|
||||
item.setData(Qt.UserRole, url_from_6th_column)'''
|
||||
if dbtype == sigdb:
|
||||
if self.dlg.comboBox.currentText() == 'toutes les catégories':
|
||||
custom_list=schemaname_list
|
||||
elif self.dlg.comboBox.currentText() == 'travaux':
|
||||
custom_list="""(SELECT schemaname,tablename from pg_catalog.pg_tables
|
||||
where schemaname like '"""+ str(self.dlg.comboBox.currentText()) +"""%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '"""+ str(self.dlg.comboBox.currentText()) +"""%' order by schemaname,tablename) order by schemaname,tablename;"""
|
||||
else:
|
||||
custom_list="""(SELECT schemaname,tablename from pg_catalog.pg_tables
|
||||
where schemaname like '\_"""+ str(self.dlg.comboBox.currentText()) +"""%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '\_"""+ str(self.dlg.comboBox.currentText()) +"""%' order by schemaname,tablename) order by schemaname,tablename;"""
|
||||
else:
|
||||
if self.dlg.comboBox.currentText() == 'toutes les catégories':
|
||||
custom_list=schemaname_list_ref
|
||||
else:
|
||||
custom_list="""SELECT schemaname,tablename from pg_catalog.pg_tables
|
||||
where schemaname like '"""+ str(self.dlg.comboBox.currentText()) +"""' order by schemaname,tablename;"""
|
||||
cur.execute(custom_list)
|
||||
list_schema = cur.fetchall()
|
||||
|
||||
self.dlg.tableWidget.setRowCount(len(list_schema))
|
||||
self.dlg.tableWidget.setColumnCount(3)
|
||||
i=0
|
||||
for value in list_schema:
|
||||
if dbtype == sigdb:
|
||||
type_val = str(value[0])[1:3]
|
||||
schema_name=str(value[0])[4:]
|
||||
table_name=str(value[1])
|
||||
else:
|
||||
type_val = ''
|
||||
schema_name=str(value[0])
|
||||
table_name=str(value[1])
|
||||
if type_val == 'fo':
|
||||
type_val=str(value[0])[1:5]
|
||||
schema_name=str(value[0])[6:]
|
||||
table_name=str(value[1])
|
||||
elif type_val == 'ra':
|
||||
type_val='travaux'
|
||||
schema_name=str(value[0])
|
||||
table_name=str(value[1])
|
||||
elif type_val != '00' and type_val != '01' and type_val != '07' and type_val != '26' and type_val != '42' and type_val != '69' and type_val != 'ra':
|
||||
type_val='agregation'
|
||||
schema_name=str(value[0])
|
||||
table_name=str(value[1])
|
||||
|
||||
item = QTableWidgetItem(type_val)
|
||||
self.dlg.tableWidget.setItem(i,0,item)
|
||||
item = QTableWidgetItem(schema_name)
|
||||
self.dlg.tableWidget.setItem(i,1,item)
|
||||
item = QTableWidgetItem(table_name)
|
||||
self.dlg.tableWidget.setItem(i,2,item)
|
||||
i=i+1
|
||||
self.dlg.tableWidget.setColumnWidth(0, 20)
|
||||
self.dlg.tableWidget.setColumnWidth(1, 300)
|
||||
self.dlg.tableWidget.setColumnWidth(2, 300)
|
||||
self.dlg.tableWidget.setHorizontalHeaderLabels(["Code","Schema","Table"])
|
||||
'''
|
||||
else:
|
||||
nb_row = len(data)
|
||||
nb_col = len(data[0])
|
||||
self.dlg.tableWidget.setRowCount(nb_row)
|
||||
self.dlg.tableWidget.setColumnCount(nb_col)
|
||||
for row in range(nb_row):
|
||||
for col in range(nb_col):
|
||||
item = QTableWidgetItem(str(data[row][col]))
|
||||
# Access the value from the 6th column for the current row (style here)
|
||||
value_from_2nd_column = str(data[row][1])
|
||||
# Set tooltip for each row
|
||||
tooltip = f"Nom du flux: {value_from_2nd_column}"
|
||||
item.setToolTip(tooltip)
|
||||
|
||||
# Check if the current column is the "Résumé des métadonnées" column
|
||||
if col == 7:
|
||||
# Set icon for the "Résumé des métadonnées" column
|
||||
icon_path = self.plugin_path + '/metadata.png' # Replace 'path_to_your_icon.png' with the actual path to your icon
|
||||
icon = QIcon(icon_path)
|
||||
item.setIcon(icon)
|
||||
# Store the URL in the item's data for later retrieval
|
||||
url_from_6th_column = str(data2[row][7]) # Assuming the URL is in the next column
|
||||
item.setData(Qt.UserRole, url_from_6th_column)
|
||||
|
||||
self.dlg.tableWidget.setItem(row, col, item)
|
||||
|
||||
self.dlg.tableWidget.setHorizontalHeaderLabels(["Service", "Catégorie", "Flux", "Nom technique", "Url d'accès", "Source", "Style", "Infos"])
|
||||
|
||||
self.dlg.tableWidget.setColumnWidth(0, 76)
|
||||
self.dlg.tableWidget.setColumnWidth(1, 0)
|
||||
self.dlg.tableWidget.setColumnWidth(2, 610)
|
||||
self.dlg.tableWidget.setColumnWidth(3, 0)
|
||||
self.dlg.tableWidget.setColumnWidth(4, 0)
|
||||
self.dlg.tableWidget.setColumnWidth(5, 88)
|
||||
self.dlg.tableWidget.setColumnWidth(6, 0)
|
||||
self.dlg.tableWidget.setColumnWidth(7, 30)
|
||||
|
||||
self.dlg.tableWidget.selectRow(0)
|
||||
'''
|
||||
def selection_flux(self):
|
||||
selected_row = 0
|
||||
selected_items = self.dlg.tableWidget.selectedItems()
|
||||
|
||||
# Assuming you want to compare items in the first column for uniqueness
|
||||
new_item_text = selected_items[2].text()
|
||||
|
||||
if not self.item_already_exists(new_item_text):
|
||||
self.dlg.tableWidget_2.insertRow(selected_row)
|
||||
|
||||
for column in range(self.dlg.tableWidget.columnCount()):
|
||||
cloned_item = selected_items[column].clone()
|
||||
self.dlg.tableWidget_2.setHorizontalHeaderLabels(["Code","Schema", "Table"])
|
||||
self.dlg.tableWidget_2.setColumnCount(3)
|
||||
self.dlg.tableWidget_2.setItem(selected_row, column, cloned_item)
|
||||
|
||||
self.dlg.tableWidget_2.setColumnWidth(0, 50)
|
||||
self.dlg.tableWidget_2.setColumnWidth(1, 300)
|
||||
self.dlg.tableWidget_2.setColumnWidth(2, 300)
|
||||
|
||||
|
||||
def item_already_exists(self, new_item_text):
|
||||
# Assuming you want to compare items in the first column for uniqueness
|
||||
existing_items = self.dlg.tableWidget_2.findItems(new_item_text, QtCore.Qt.MatchExactly)
|
||||
|
||||
# Check if there are any existing items with the same text in the first column
|
||||
return len(existing_items) > 0
|
||||
|
||||
|
||||
|
||||
def limite_flux(self):
|
||||
|
||||
if self.dlg.tableWidget_2.rowCount() > 3:
|
||||
self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !",
|
||||
"Le nombre de flux à charger en une seule fois est limité à 3 pour des questions de performances. Souhaitez vous tout de même charger les " + str(
|
||||
self.dlg.tableWidget_2.rowCount()) + " flux sélectionnés ? (risque de plantage de QGIS)",
|
||||
QMessageBox.Yes | QMessageBox.No)
|
||||
if self.QMBquestion == QMessageBox.Yes:
|
||||
self.chargement_flux()
|
||||
|
||||
if self.QMBquestion == QMessageBox.No:
|
||||
print("Annulation du chargement des couches")
|
||||
|
||||
if self.dlg.tableWidget_2.rowCount() <= 3:
|
||||
self.chargement_flux()
|
||||
|
||||
def chargement_flux(self):
|
||||
|
||||
managerAU = QgsApplication.authManager()
|
||||
k = managerAU.availableAuthMethodConfigs().keys()
|
||||
|
||||
def REQUEST(type):
|
||||
switcher = {
|
||||
'WFS': "GetFeature",
|
||||
'WMS': "GetMap",
|
||||
'WMS+Vecteur': "GetMap",
|
||||
'WMS+Raster': "GetMap",
|
||||
'WMTS': "GetMap"
|
||||
}
|
||||
return switcher.get(type, "nothing")
|
||||
|
||||
|
||||
def displayOnWindows(type, uri, name):
|
||||
'''
|
||||
if type == 'WFS':
|
||||
vlayer = QgsVectorLayer(uri, name, "WFS")
|
||||
# vlayer.setScaleBasedVisibility(True)
|
||||
QgsProject.instance().addMapLayer(vlayer)
|
||||
|
||||
layers = QgsProject.instance().mapLayers() # dictionary
|
||||
|
||||
# rowCount() This property holds the number of rows in the table
|
||||
for row in range(self.dlg.tableWidget_2.rowCount()):
|
||||
# item(row, 0) Returns the item for the given row and column if one has been set; otherwise returns nullptr.
|
||||
_item = self.dlg.tableWidget_2.item(row, 2).text()
|
||||
_legend = self.dlg.tableWidget_2.item(row, 6).text()
|
||||
# print(_item)
|
||||
# print(_legend)
|
||||
|
||||
for layer in layers.values():
|
||||
if layer.name() == _item:
|
||||
if len(_legend) > 1:
|
||||
styles_url = 'https://raw.githubusercontent.com/CEN-Nouvelle-Aquitaine/fluxcen/main/styles_couches/' + _legend + '.qml'
|
||||
|
||||
fp = urllib.request.urlopen(styles_url)
|
||||
mybytes = fp.read()
|
||||
|
||||
document = QDomDocument()
|
||||
document.setContent(mybytes)
|
||||
|
||||
res = layer.importNamedStyle(document)
|
||||
layer.triggerRepaint()
|
||||
|
||||
else:
|
||||
print("Pas de style à charger pour cette couche")
|
||||
|
||||
elif type == 'WMS' or type == 'WMS Raster' or type == 'WMS Vecteur' or type == 'WMTS':
|
||||
rlayer = QgsRasterLayer(uri, name, "WMS")
|
||||
QgsProject.instance().addMapLayer(rlayer)
|
||||
else:
|
||||
print("Unknown datatype !")
|
||||
'''
|
||||
p = []
|
||||
|
||||
for row in range(0, self.dlg.tableWidget_2.rowCount()):
|
||||
## supression de la partie de l'url après le point d'interrogation
|
||||
if dbtype == sigdb:
|
||||
code = self.dlg.tableWidget_2.item(row,0).text()
|
||||
schema = '_'+code+'_'+self.dlg.tableWidget_2.item(row,1).text()
|
||||
if code == 'travaux' or code == 'agregation':
|
||||
schema = self.dlg.tableWidget_2.item(row,1).text()
|
||||
table = self.dlg.tableWidget_2.item(row,2).text()#.split("?", 1)[0]
|
||||
if dbtype == refdb:
|
||||
# code = self.dlg.tableWidget_2.item(row,0).text()
|
||||
schema = self.dlg.tableWidget_2.item(row,1).text()
|
||||
table = self.dlg.tableWidget_2.item(row,2).text()#.split("?", 1)[0]
|
||||
uri = QgsDataSourceUri()
|
||||
uri.setConnection(host ,port ,dbtype ,user ,mdp)
|
||||
|
||||
# nom du schéma à remplacer: "hydrographie" à supprimer et mettre "couches_collaboratives" lorsqu'on aura regroupé les couches à modifier dans un même schéma
|
||||
|
||||
uri.setDataSource(schema, table, "geom")
|
||||
uri.setKeyColumn('gid')
|
||||
|
||||
# Chargement de la couche PostGIS
|
||||
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':
|
||||
uri.setWkbType(QgsWkbTypes.MultiPolygon)
|
||||
elif typegeom[0] == 'MultiLineString':
|
||||
uri.setWkbType(QgsWkbTypes.MultiLineString)
|
||||
elif typegeom[0] == 'Point':
|
||||
uri.setWkbType(QgsWkbTypes.Point)
|
||||
if typegeom[0] == 'Polygon':
|
||||
uri.setWkbType(QgsWkbTypes.Polygon)
|
||||
elif typegeom[0] == 'LineString':
|
||||
uri.setWkbType(QgsWkbTypes.LineString)
|
||||
elif typegeom[0] == 'MultiPoint':
|
||||
uri.setWkbType(QgsWkbTypes.MultiPoint)
|
||||
if (typegeom[0] != None and typegeom[0] != 'Polygon'):
|
||||
uri.setSrid('2154')
|
||||
layer = QgsVectorLayer(uri.uri(), table, "postgres")
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
else:
|
||||
layer = QgsVectorLayer(uri.uri(), table, "postgres")
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
'''
|
||||
try:
|
||||
service = re.search('SERVICE=(.+?)&VERSION', self.dlg.tableWidget_2.item(row,4).text()).group(1)
|
||||
except:
|
||||
service = '1.0.0'
|
||||
try:
|
||||
version = re.search('VERSION=(.+?)&REQUEST', self.dlg.tableWidget_2.item(row,4).text()).group(1)
|
||||
except:
|
||||
version = '1.0.0'
|
||||
|
||||
if self.dlg.tableWidget_2.item(row,0).text() == 'WMS' or self.dlg.tableWidget_2.item(row,0).text() == 'WMS Vecteur' or self.dlg.tableWidget_2.item(row,0).text() == 'WMS Raster':
|
||||
a = Flux(
|
||||
self.dlg.tableWidget_2.item(row,0).text(),
|
||||
self.dlg.tableWidget_2.item(row,1).text(),
|
||||
self.dlg.tableWidget_2.item(row,2).text(),
|
||||
self.dlg.tableWidget_2.item(row,3).text(),
|
||||
"url="+url,
|
||||
{
|
||||
'service': self.dlg.tableWidget_2.item(row,0).text(),
|
||||
'version': version,
|
||||
'crs': "EPSG:2154",
|
||||
'format' : "image/png",
|
||||
'layers': self.dlg.tableWidget_2.item(row,3).text()+"&styles"
|
||||
}
|
||||
)
|
||||
|
||||
p.append(a)
|
||||
|
||||
uri = p[row].url + '&' + urllib.parse.unquote(urllib.parse.urlencode(p[row].parameters))
|
||||
# print(uri)
|
||||
if not QgsProject.instance().mapLayersByName(p[row].nom_commercial):
|
||||
displayOnWindows(p[row].type, uri, p[row].nom_commercial)
|
||||
else:
|
||||
print("Couche "+p[row].nom_commercial+" déjà chargée")
|
||||
|
||||
|
||||
elif self.dlg.tableWidget_2.item(row,0).text() == 'WFS':
|
||||
|
||||
a = Flux(
|
||||
self.dlg.tableWidget_2.item(row, 0).text(),
|
||||
self.dlg.tableWidget_2.item(row, 1).text(),
|
||||
self.dlg.tableWidget_2.item(row, 2).text(),
|
||||
self.dlg.tableWidget_2.item(row, 3).text(),
|
||||
url,
|
||||
{
|
||||
'VERSION': version,
|
||||
'TYPENAME': self.dlg.tableWidget_2.item(row, 3).text(),
|
||||
'request': "GetFeature",
|
||||
|
||||
}
|
||||
)
|
||||
|
||||
p.append(a)
|
||||
|
||||
uri = p[row].url + '?' + urllib.parse.unquote(urllib.parse.urlencode(p[row].parameters))
|
||||
|
||||
try:
|
||||
response = requests.get(uri)
|
||||
|
||||
if response.status_code == 401:
|
||||
print("Statut de réponse: 401")
|
||||
|
||||
if len(list(k)) == 0:
|
||||
QMessageBox.question(iface.mainWindow(), u"Attention", "Veuillez ajouter une entrée de configuration d'authentification dans QGIS pour accéder aux flux CEN-NA sécurisés par un mot de passe (Flux 'FoncierCEN')", QMessageBox.Ok)
|
||||
else:
|
||||
# Add 'authcfg' to the parameters dictionary
|
||||
p[row].parameters['authcfg'] = list(k)[0]
|
||||
|
||||
# Update the URI with the modified parameters
|
||||
uri = p[row].url + '?' + urllib.parse.unquote(urllib.parse.urlencode(p[row].parameters))
|
||||
|
||||
# Make the request again with the updated URI
|
||||
response = requests.get(uri)
|
||||
elif response.status_code == 200:
|
||||
print("Statut de réponse: 200.")
|
||||
else:
|
||||
print(f"Statut de réponse: {response.status_code}")
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"problème de requete: {e}")
|
||||
|
||||
|
||||
if not QgsProject.instance().mapLayersByName(p[row].nom_commercial):
|
||||
displayOnWindows(p[row].type, uri, p[row].nom_commercial)
|
||||
else:
|
||||
print("Couche "+p[row].nom_commercial+" déjà chargée")
|
||||
|
||||
|
||||
elif self.dlg.tableWidget_2.item(row, 0).text() == 'PostGIS':
|
||||
|
||||
# Connexion à la base de données PostGIS
|
||||
uri = QgsDataSourceUri()
|
||||
uri.setConnection("sandbox.cen-nouvelle-aquitaine.dev", "5432", "piezo", "", "")
|
||||
# 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("collaboratif", self.dlg.tableWidget_2.item(row, 3).text(), "geom")
|
||||
# Chargement de la couche PostGIS
|
||||
layer = QgsVectorLayer(uri.uri(), self.dlg.tableWidget_2.item(row, 2).text(), "postgres")
|
||||
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
|
||||
else:
|
||||
print("Les flux WMTS et autres ne sont pas encore gérés par le plugin")
|
||||
'''
|
||||
def combobox_custom(self):
|
||||
if dbtype == sigdb:
|
||||
self.dlg.comboBox.clear()
|
||||
self.dlg.comboBox.addItem("toutes les catégories")
|
||||
self.dlg.comboBox.addItem('00')
|
||||
self.dlg.comboBox.addItem('01')
|
||||
self.dlg.comboBox.addItem('07')
|
||||
self.dlg.comboBox.addItem('26')
|
||||
self.dlg.comboBox.addItem('42')
|
||||
self.dlg.comboBox.addItem('69')
|
||||
self.dlg.comboBox.addItem('agregation')
|
||||
self.dlg.comboBox.addItem('travaux')
|
||||
self.dlg.comboBox.addItem('form')
|
||||
if dbtype == refdb:
|
||||
custom_list=schemaname_distinct
|
||||
cur.execute(custom_list)
|
||||
list_schema = cur.fetchall()
|
||||
self.dlg.comboBox.clear()
|
||||
self.dlg.comboBox.addItem("toutes les catégories")
|
||||
for baxval in list_schema:
|
||||
self.dlg.comboBox.addItem(baxval[0])
|
||||
def filtre_dynamique(self, filter_text):
|
||||
|
||||
for i in range(self.dlg.tableWidget.rowCount()):
|
||||
for j in range(self.dlg.tableWidget.columnCount()):
|
||||
item = self.dlg.tableWidget.item(i, j)
|
||||
match = filter_text.lower() not in item.text().lower()
|
||||
self.dlg.tableWidget.setRowHidden(i, match)
|
||||
if not match:
|
||||
break
|
||||
|
||||
|
||||
|
||||
def popup(self):
|
||||
|
||||
self.dialog = Popup() # +++ - self
|
||||
self.dialog.text_edit.show()
|
||||
|
||||
# from owslib.wfs import WebFeatureService
|
||||
# import csv
|
||||
|
||||
# wfs = WebFeatureService(url='https://opendata.cen-nouvelle-aquitaine.org/geoserver/agriculture/wfs')
|
||||
# agriculture = list(wfs.contents)
|
||||
# with open('C:/Users/Romain/Desktop/test.csv', "a+", encoding="ISO-8859-1", newline='') as f:
|
||||
# writer = csv.writer(f)
|
||||
# for row in agriculture:
|
||||
# writer.writerow(row.split())
|
||||
#
|
||||
# from owslib.wms import WebMapService
|
||||
# wms = WebMapService('https://opendata.cen-nouvelle-aquitaine.org/geoserver/fond_carto/wms')
|
||||
# fonds_carto = list(wms.contents)
|
||||
# with open('C:/Users/Romain/Desktop/test.csv', "a+", encoding="ISO-8859-1", newline='') as f:
|
||||
# writer = csv.writer(f)
|
||||
# for row in fonds_carto:
|
||||
# writer.writerow(row.split())
|
||||
#
|
||||
# import csv
|
||||
#
|
||||
# fluxWMS = ['AGG_TMM', '16-014_Brandes_de_Soyaux_2020-05', '17IMERIS_Bois-Charles_Vallée-du-Larry_2022_01', '17IMERIS_Grand-Champ_2022-01', '19PTOR_MNS_filtre_futurs_travaux_2021-10_L93', '19PTOR_MNS_filtre_travaux_realises_2021-10_L93', '19PTOR_ortho_2021-10_L93', '23CELI_marais_du_chancelier_2022_03_24', '23CLAM_Rocher_de_Clamouzat_2020-11', '23DIAB_lande_du_pont_du_diable_nord_2021-10_L93', '23DIAB_lande_du_pont_du_diable_sud_2021-10_L93', '23LAND_RNN_etang_des_landes_2020-08_L93', '33_Lagune-108-2021-08', '79BLVI_Blanchère-de-Viennay_2021-10', '79VGAT_Vallée-du-Gâteau_Pressigny_2020-02', '79VGAT_Vallée-du-Gâteau_Pressigny_2021-10', '86-001_TMM_CA-CD_2020-07', '86-500_Clain-sud_Etang-du-Pin', '86_AT_Chalandray_2021-10', '87CREN_siege_saint_gence_2021-09', '87GRLA_grandes_landes_2021-09-24', '87SANA_sanadie_2021-09-24', 'a_16_030_Prairies_de_Vouharte_2019_09', 'a_17_474_Estauaire_de_la_Gironde_Les_Pr_s_de_la_Rouille_2019_08', 'a_17_474_Estauaire_de_la_Gironde_Moulin_Rompu_2019_08', 'a_17_474_Estuaire_de_la_Gironde_Zone_Humide_de_la_Motte_Ronde_2021_04', 'a_17_IMERIS_Carriere_du_Planton_2021_08_12', 'a_17_LGV_Ragouillis_2021_08_12', 'a_33_Lagune_058_2021_08', 'a_33_Lagune_070_2021_08', 'a_33_Lagune_094_2021_08', 'a_33_Lagune_162_2021_08', 'a_33_Lagune_165_2021_08', 'a_33_Lagunes_207_208_209_2021_08', 'a_79_001_Clussais_la_Pommeraie_2020_11', 'a_79_008_Landes_de_L_Hopiteau_2019_09', 'a_79_020_Bessines_1_avant_travaux_2019_10', 'a_79_020_Bessines_2_pendant_travaux_2019_11', 'a_79_020_Bessines_3_apres_travaux_2020_12', 'a_79_044_Carriere_des_Landes_2020_09', 'a_79_AT_Vernoux_en_Gatine_2020_09', 'a_79_Sources_de_la_Sevre_Niortaise_Pierre_levee_2020_09', 'a_86_001_TMM_AA_2020_06', 'a_86_001_TMM_AB_2020_06', 'a_86_001_TMM_AC_2020_06', 'a_86_001_TMM_AD_2020_06', 'a_86_001_TMM_AE_2020_06', 'a_86_001_TMM_AF_2020_06', 'a_86_001_TMM_AG_2020_07', 'a_86_001_TMM_BA_2020_06', 'a_86_001_TMM_BB_2020_06', 'a_86_001_TMM_BC_2020_06', 'a_86_001_TMM_BD_2020_06', 'a_86_001_TMM_BE_2020_07', 'a_86_001_TMM_BF_2021_06', 'a_86_001_TMM_CB_2020_07', 'a_86_001_TMM_CC_2020_07', 'a_86_001_TMM_CC_2021_06', 'a_86_001_TMM_CD_2021_06', 'a_86_001_TMM_CE_2020_07', 'a_86_001_TMM_CF_2020_09', 'a_86_001_TMM_DA_2020_07', 'a_86_001_TMM_DB_2020_09', 'a_86_001_TMM_DC_2021_06', 'a_86_001_TMM_EA_2020_06', 'a_86_001_TMM_EB_2020_06', 'a_86_001_TMM_EC_2020_06', 'a_86_001_TMM_FA_2020_06', 'a_86_001_TMM_FB_2020_07', 'a_86_001_TMM_FC_2020_07', 'a_86_001_TMM_FC_2021_06', 'a_86_001_TMM_HA_2020_09', 'a_86_001_TMM_IA_2020_06', 'a_86_001_TMM_IB_2020_06', 'a_86_001_TMM_IC_2020_06', 'a_86_001_TMM_JA_2020_07', 'a_86_001_TMM_JB_2020_07', 'a_86_001_TMM_JC_2020_07', 'a_86_001_TMM_JE_2020_07', 'a_86_001_TMM_KA_2020_07', 'a_86_001_TMM_KB_2020_07', 'a_86_003_Falunieres_de_Moulin_Pochas_2019_09', 'a_86_006_Landes_et_pelouses_de_Lussac_Sillars_2019_08', 'a_86_011_Landes_de_Sainte_Marie_2019_09', 'a_86_025_Marais_des_Ragouillis_2020_11', 'a_86_025_Marais_des_Ragouillis_2021_02', 'a_86_026_Etangs_Baro_2019_09', 'a_86_029_Vallee_de_la_Longere_2019_09', 'a_86_037_Tourbiere_des_Regeasses_2021_06', 'a_86_038_Vallees_de_la_Vienne_et_du_Clain_Persac_2019_09', 'a_86_038_Vallees_de_la_Vienne_et_du_Clain_Persac_2020_12', 'a_86_052_Fontaine_le_Comte_nord_2020_11', 'a_86_052_Fontaine_le_Comte_sud_2020_11', 'a_86_054_Vallee_de_la_Vonne_2020_11', 'a_86_058_Carriere_de_Puy_Herve_2021_02_09', 'a_86_058_Carriere_de_Puy_Herve_2021_02_25', 'a_86_060_Bocage_de_la_Geoffronniere_2020_11', 'a_86_Le_Cormier_2021_05']
|
||||
#
|
||||
# with open('C:/Users/Romain/Desktop/test.csv', "a+", encoding="ISO-8859-1", newline='') as f:
|
||||
# writer = csv.writer(f)
|
||||
# for row in fluxWMS:
|
||||
# writer.writerow(row.split())
|
||||
|
||||
#### Récupération des métadonnées des couches quand disponibles:
|
||||
|
||||
# from owslib.wms import WebMapService
|
||||
# wms = WebMapService('http://geoservices.brgm.fr/geologie?service=WMS+Raster', version='1.1.1')
|
||||
# print(list(wms.contents))
|
||||
#
|
||||
# print(wms['IDPR'].abstract)
|
||||
@@ -1,44 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
/***************************************************************************
|
||||
FluxCENDialog
|
||||
A QGIS plugin
|
||||
Flux IGN etc etc
|
||||
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
|
||||
-------------------
|
||||
begin : 2022-04-04
|
||||
git sha : $Format:%H$
|
||||
copyright : (C) 2022 by Romain Montillet
|
||||
email : r.montillet@cen-na.org
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from qgis.PyQt import uic
|
||||
from qgis.PyQt import QtWidgets
|
||||
|
||||
# This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer
|
||||
FORM_CLASS, _ = uic.loadUiType(os.path.join(
|
||||
os.path.dirname(__file__), 'FluxCEN_dialog_base.ui'))
|
||||
|
||||
|
||||
class FluxCENDialog(QtWidgets.QDialog, FORM_CLASS):
|
||||
def __init__(self, parent=None):
|
||||
"""Constructor."""
|
||||
super(FluxCENDialog, self).__init__(parent)
|
||||
# Set up the user interface from Designer through FORM_CLASS.
|
||||
# After self.setupUi() you can access any designer object by doing
|
||||
# self.<objectname>, and you can use autoconnect slots - see
|
||||
# http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
|
||||
# #widgets-and-dialogs-with-auto-connect
|
||||
self.setupUi(self)
|
||||
@@ -1,247 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'FluxCEN_dialog_base.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'FluxCEN_dialog_base.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.4
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
import resources
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.setEnabled(True)
|
||||
Dialog.resize(910, 800)
|
||||
Dialog.setMinimumSize(QtCore.QSize(910, 800))
|
||||
Dialog.setMaximumSize(QtCore.QSize(910, 800))
|
||||
self.comboBox = QtWidgets.QComboBox(Dialog)
|
||||
self.comboBox.setGeometry(QtCore.QRect(260, 130, 171, 22))
|
||||
self.comboBox.setEditable(False)
|
||||
self.comboBox.setCurrentText("")
|
||||
self.comboBox.setObjectName("comboBox")
|
||||
self.comboBox_2 = QtWidgets.QComboBox(Dialog)
|
||||
self.comboBox_2.setGeometry(QtCore.QRect(370, 80, 171, 22))
|
||||
self.comboBox_2.setEditable(False)
|
||||
self.comboBox_2.setCurrentText("")
|
||||
self.comboBox_2.setObjectName("comboBox_2")
|
||||
self.label_3 = QtWidgets.QLabel(Dialog)
|
||||
self.label_3.setGeometry(QtCore.QRect(50, 20, 271, 91))
|
||||
self.label_3.setText("")
|
||||
self.label_3.setPixmap(QtGui.QPixmap(":/plugins/CenRa_FLUX/logo.png"))
|
||||
self.label_3.setScaledContents(True)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.pushButton_2 = QtWidgets.QPushButton(Dialog)
|
||||
self.pushButton_2.setGeometry(QtCore.QRect(370, 750, 171, 23))
|
||||
self.pushButton_2.setObjectName("pushButton_2")
|
||||
self.tableWidget = QtWidgets.QTableWidget(Dialog)
|
||||
self.tableWidget.setEnabled(True)
|
||||
self.tableWidget.setGeometry(QtCore.QRect(30, 170, 850, 281))
|
||||
self.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||
self.tableWidget.setObjectName("tableWidget")
|
||||
self.tableWidget.setColumnCount(0)
|
||||
self.tableWidget.setRowCount(0)
|
||||
self.tableWidget_2 = QtWidgets.QTableWidget(Dialog)
|
||||
self.tableWidget_2.setGeometry(QtCore.QRect(30, 550, 850, 181))
|
||||
self.tableWidget_2.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||
self.tableWidget_2.setObjectName("tableWidget_2")
|
||||
self.tableWidget_2.setColumnCount(0)
|
||||
self.tableWidget_2.setRowCount(0)
|
||||
self.commandLinkButton = QtWidgets.QCommandLinkButton(Dialog)
|
||||
self.commandLinkButton.setGeometry(QtCore.QRect(400, 470, 61, 61))
|
||||
self.commandLinkButton.setText("")
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(":/plugins/CenRa_FLUX/arrow-bottom.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.commandLinkButton.setIcon(icon)
|
||||
self.commandLinkButton.setIconSize(QtCore.QSize(50, 40))
|
||||
self.commandLinkButton.setObjectName("commandLinkButton")
|
||||
self.commandLinkButton_2 = QtWidgets.QCommandLinkButton(Dialog)
|
||||
self.commandLinkButton_2.setGeometry(QtCore.QRect(460, 470, 61, 61))
|
||||
self.commandLinkButton_2.setText("")
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(":/plugins/CenRa_FLUX/arrow-up.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.commandLinkButton_2.setIcon(icon1)
|
||||
self.commandLinkButton_2.setIconSize(QtCore.QSize(50, 40))
|
||||
self.commandLinkButton_2.setObjectName("commandLinkButton_2")
|
||||
self.lineEdit = QtWidgets.QLineEdit(Dialog)
|
||||
self.lineEdit.setEnabled(True)
|
||||
self.lineEdit.setGeometry(QtCore.QRect(480, 130, 171, 21))
|
||||
self.lineEdit.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.lineEdit.setReadOnly(False)
|
||||
self.lineEdit.setClearButtonEnabled(True)
|
||||
self.lineEdit.setObjectName("lineEdit")
|
||||
self.label = QtWidgets.QLabel(Dialog)
|
||||
self.label.setGeometry(QtCore.QRect(40, 150, 161, 16))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Calibri")
|
||||
font.setPointSize(10)
|
||||
font.setItalic(False)
|
||||
self.label.setFont(font)
|
||||
self.label.setObjectName("label")
|
||||
self.label_2 = QtWidgets.QLabel(Dialog)
|
||||
self.label_2.setGeometry(QtCore.QRect(30, 530, 171, 16))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Calibri")
|
||||
font.setPointSize(10)
|
||||
font.setItalic(False)
|
||||
self.label_2.setFont(font)
|
||||
self.label_2.setObjectName("label_2")
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "SIG CEN-RA"))
|
||||
self.pushButton_2.setText(_translate("Dialog", "Charger les couches"))
|
||||
self.tableWidget.setSortingEnabled(True)
|
||||
self.lineEdit.setText(_translate("Dialog", "Recherche par mots-clés"))
|
||||
self.label.setText(_translate("Dialog", "Liste des flux disponibles :"))
|
||||
self.label_2.setText(_translate("Dialog", "Flux sélectionné(s) à charger :"))
|
||||
|
||||
'''
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.setEnabled(True)
|
||||
Dialog.resize(910, 800)
|
||||
Dialog.setMinimumSize(QtCore.QSize(910, 800))
|
||||
Dialog.setMaximumSize(QtCore.QSize(910, 800))
|
||||
self.comboBox = QtWidgets.QComboBox(Dialog)
|
||||
self.comboBox.setGeometry(QtCore.QRect(260, 130, 171, 22))
|
||||
self.comboBox.setEditable(False)
|
||||
self.comboBox.setCurrentText("")
|
||||
self.comboBox.setObjectName("comboBox")
|
||||
self.label_3 = QtWidgets.QLabel(Dialog)
|
||||
self.label_3.setGeometry(QtCore.QRect(350, 20, 221, 71))
|
||||
self.label_3.setText("")
|
||||
self.label_3.setPixmap(QtGui.QPixmap(":/plugins/FluxCEN/logo.png"))
|
||||
self.label_3.setScaledContents(True)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.pushButton_2 = QtWidgets.QPushButton(Dialog)
|
||||
self.pushButton_2.setGeometry(QtCore.QRect(370, 750, 171, 23))
|
||||
self.pushButton_2.setObjectName("pushButton_2")
|
||||
self.tableWidget = QtWidgets.QTableWidget(Dialog)
|
||||
self.tableWidget.setEnabled(True)
|
||||
self.tableWidget.setGeometry(QtCore.QRect(30, 170, 850, 281))
|
||||
self.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||
self.tableWidget.setObjectName("tableWidget")
|
||||
self.tableWidget.setColumnCount(0)
|
||||
self.tableWidget.setRowCount(0)
|
||||
self.tableWidget_2 = QtWidgets.QTableWidget(Dialog)
|
||||
self.tableWidget_2.setGeometry(QtCore.QRect(30, 550, 850, 181))
|
||||
self.tableWidget_2.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||
self.tableWidget_2.setObjectName("tableWidget_2")
|
||||
self.tableWidget_2.setColumnCount(0)
|
||||
self.tableWidget_2.setRowCount(0)
|
||||
self.commandLinkButton = QtWidgets.QCommandLinkButton(Dialog)
|
||||
self.commandLinkButton.setGeometry(QtCore.QRect(400, 470, 61, 61))
|
||||
self.commandLinkButton.setText("")
|
||||
icon = QtGui.QIcon()
|
||||
icon.addPixmap(QtGui.QPixmap(":/plugins/FluxCEN/arrow-bottom.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.commandLinkButton.setIcon(icon)
|
||||
self.commandLinkButton.setIconSize(QtCore.QSize(50, 40))
|
||||
self.commandLinkButton.setObjectName("commandLinkButton")
|
||||
self.commandLinkButton_2 = QtWidgets.QCommandLinkButton(Dialog)
|
||||
self.commandLinkButton_2.setGeometry(QtCore.QRect(460, 470, 61, 61))
|
||||
self.commandLinkButton_2.setText("")
|
||||
icon1 = QtGui.QIcon()
|
||||
icon1.addPixmap(QtGui.QPixmap(":/plugins/FluxCEN/arrow-up.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.commandLinkButton_2.setIcon(icon1)
|
||||
self.commandLinkButton_2.setIconSize(QtCore.QSize(50, 40))
|
||||
self.commandLinkButton_2.setObjectName("commandLinkButton_2")
|
||||
self.lineEdit = QtWidgets.QLineEdit(Dialog)
|
||||
self.lineEdit.setEnabled(True)
|
||||
self.lineEdit.setGeometry(QtCore.QRect(480, 130, 171, 21))
|
||||
self.lineEdit.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.lineEdit.setReadOnly(False)
|
||||
self.lineEdit.setClearButtonEnabled(True)
|
||||
self.lineEdit.setObjectName("lineEdit")
|
||||
self.commandLinkButton_3 = QtWidgets.QCommandLinkButton(Dialog)
|
||||
self.commandLinkButton_3.setGeometry(QtCore.QRect(690, 20, 201, 41))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Segoe UI")
|
||||
font.setPointSize(9)
|
||||
self.commandLinkButton_3.setFont(font)
|
||||
icon2 = QtGui.QIcon()
|
||||
icon2.addPixmap(QtGui.QPixmap(":/plugins/FluxCEN/globe.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.commandLinkButton_3.setIcon(icon2)
|
||||
self.commandLinkButton_3.setIconSize(QtCore.QSize(20, 20))
|
||||
self.commandLinkButton_3.setObjectName("commandLinkButton_3")
|
||||
self.label = QtWidgets.QLabel(Dialog)
|
||||
self.label.setGeometry(QtCore.QRect(40, 150, 161, 16))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Calibri")
|
||||
font.setPointSize(10)
|
||||
font.setItalic(False)
|
||||
self.label.setFont(font)
|
||||
self.label.setObjectName("label")
|
||||
self.label_2 = QtWidgets.QLabel(Dialog)
|
||||
self.label_2.setGeometry(QtCore.QRect(30, 530, 171, 16))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Calibri")
|
||||
font.setPointSize(10)
|
||||
font.setItalic(False)
|
||||
self.label_2.setFont(font)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.commandLinkButton_4 = QtWidgets.QCommandLinkButton(Dialog)
|
||||
self.commandLinkButton_4.setGeometry(QtCore.QRect(690, 60, 201, 41))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Segoe UI")
|
||||
font.setPointSize(9)
|
||||
self.commandLinkButton_4.setFont(font)
|
||||
icon3 = QtGui.QIcon()
|
||||
icon3.addPixmap(QtGui.QPixmap(":/plugins/FluxCEN/orthos.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.commandLinkButton_4.setIcon(icon3)
|
||||
self.commandLinkButton_4.setIconSize(QtCore.QSize(20, 20))
|
||||
self.commandLinkButton_4.setObjectName("commandLinkButton_4")
|
||||
self.commandLinkButton_5 = QtWidgets.QCommandLinkButton(Dialog)
|
||||
self.commandLinkButton_5.setGeometry(QtCore.QRect(860, 750, 41, 41))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Segoe UI")
|
||||
font.setPointSize(9)
|
||||
self.commandLinkButton_5.setFont(font)
|
||||
self.commandLinkButton_5.setText("")
|
||||
icon4 = QtGui.QIcon()
|
||||
icon4.addPixmap(QtGui.QPixmap(":/plugins/FluxCEN/info.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.commandLinkButton_5.setIcon(icon4)
|
||||
self.commandLinkButton_5.setIconSize(QtCore.QSize(25, 25))
|
||||
self.commandLinkButton_5.setObjectName("commandLinkButton_5")
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "FluxCEN"))
|
||||
self.pushButton_2.setText(_translate("Dialog", "Charger les couches"))
|
||||
self.tableWidget.setSortingEnabled(True)
|
||||
self.lineEdit.setText(_translate("Dialog", "Recherche par mots-clés"))
|
||||
self.commandLinkButton_3.setText(_translate("Dialog", " Ajouter fond de carte OSM"))
|
||||
self.label.setText(_translate("Dialog", "Liste des flux disponibles :"))
|
||||
self.label_2.setText(_translate("Dialog", "Flux sélectionné(s) à charger :"))
|
||||
self.commandLinkButton_4.setText(_translate("Dialog", "Ajouter Ortho (Google sat\')"))
|
||||
|
||||
'''
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
Dialog = QtWidgets.QDialog()
|
||||
ui = Ui_Dialog()
|
||||
ui.setupUi(Dialog)
|
||||
Dialog.show()
|
||||
sys.exit(app.exec_())
|
||||
@@ -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.
|
||||
@@ -1,36 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
/***************************************************************************
|
||||
FluxCEN
|
||||
A QGIS plugin
|
||||
Flux IGN etc etc
|
||||
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
|
||||
-------------------
|
||||
begin : 2022-04-04
|
||||
copyright : (C) 2022 by Romain Montillet
|
||||
email : r.montillet@cen-na.org
|
||||
git sha : $Format:%H$
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
This script initializes the plugin, making it known to QGIS.
|
||||
"""
|
||||
|
||||
|
||||
# noinspection PyPep8Naming
|
||||
def classFactory(iface): # pylint: disable=invalid-name
|
||||
"""Load FluxCEN class from file FluxCEN.
|
||||
|
||||
:param iface: A QGIS interface instance.
|
||||
:type iface: QgsInterface
|
||||
"""
|
||||
#
|
||||
from .FluxCEN import FluxCEN
|
||||
return FluxCEN(iface)
|
||||
def classFactory(iface):
|
||||
_ = iface
|
||||
from CenRa_FLUX.CenRa_Flux import PgFlux
|
||||
return PgFlux()
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import os.path
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from qgis.PyQt import uic
|
||||
from qgis.PyQt.QtGui import QPixmap
|
||||
from qgis.PyQt.QtWidgets import QDialog
|
||||
|
||||
from .tools.resources import devlog
|
||||
|
||||
ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
os.path.join(
|
||||
str(Path(__file__).resolve().parent),
|
||||
'tools/ui',
|
||||
'CenRa_about_form.ui'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class AboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
|
||||
def __init__(self, iface, parent=None):
|
||||
super().__init__(parent)
|
||||
self.iface = iface
|
||||
self.setupUi(self)
|
||||
|
||||
self.viewer.setHtml(devlog('CenRa_FLUX'))
|
||||
|
||||
self.rejected.connect(self.onReject)
|
||||
self.buttonBox.rejected.connect(self.onReject)
|
||||
self.buttonBox.accepted.connect(self.onAccept)
|
||||
|
||||
def onAccept(self):
|
||||
"""
|
||||
Save options when pressing OK button
|
||||
"""
|
||||
self.accept()
|
||||
|
||||
def onReject(self):
|
||||
"""
|
||||
Run some actions when
|
||||
the user closes the dialog
|
||||
"""
|
||||
self.close()
|
||||
@@ -0,0 +1,769 @@
|
||||
# -*- 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 import QtCore
|
||||
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
|
||||
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.QtSvg import QSvgWidget
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
QDialog,
|
||||
QAction,
|
||||
QDockWidget,
|
||||
QFileDialog,
|
||||
QInputDialog,
|
||||
QMenu,
|
||||
QToolButton,
|
||||
QTableWidget,
|
||||
QTableWidgetItem,
|
||||
QMessageBox,
|
||||
QVBoxLayout,
|
||||
)
|
||||
from .tools.SQLRequet import *
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
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
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
import base64
|
||||
|
||||
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):
|
||||
|
||||
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.first_start = None
|
||||
self.iface = iface
|
||||
self.label_3.setPixmap(QtGui.QPixmap(resources_path('ui','logo.png')))
|
||||
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.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)
|
||||
self.commandLinkButton.clicked.connect(self.selection_flux)
|
||||
self.tableWidget.itemDoubleClicked.connect(self.selection_flux)
|
||||
self.pushButton_2.clicked.connect(self.limite_flux)
|
||||
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')
|
||||
#infos_metadonnees = metadonnees_plugin.readlines()
|
||||
|
||||
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()
|
||||
bd_origine=self.comboBox_2.currentText()
|
||||
if bd_origine == 'REF':
|
||||
self.run_ref()
|
||||
if bd_origine == 'SIG':
|
||||
self.run_sig()
|
||||
|
||||
def run_ref(self):
|
||||
"""Run method that performs all the real work"""
|
||||
while self.tableWidget_2.rowCount() > 0:
|
||||
self.tableWidget_2.removeRow(self.tableWidget_2.rowCount()-1)
|
||||
# print(self.tableWidget_2.rowCount())
|
||||
global cur,con,dbtype
|
||||
dbtype=refdb
|
||||
con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbtype+" user=" + user + " password=" + mdp)
|
||||
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
|
||||
self.initialisation_flux()
|
||||
self.combobox_custom()
|
||||
# Create the dialog with elements (after translation) and keep reference
|
||||
# Only create GUI ONCE in callback, so that it will only load when the plugin is started
|
||||
if self.first_start == True:
|
||||
self.first_start = False
|
||||
# show the dialog
|
||||
self.show()
|
||||
# Run the dialog event loop
|
||||
result = self.exec()
|
||||
# See if OK was pressed
|
||||
if result:
|
||||
# Do something useful here - delete the line containing pass and
|
||||
# substitute with your code.
|
||||
pass
|
||||
|
||||
def run_sig(self):
|
||||
"""Run method that performs all the real work"""
|
||||
while self.tableWidget_2.rowCount() > 0:
|
||||
self.tableWidget_2.removeRow(self.tableWidget_2.rowCount()-1)
|
||||
global cur,con,dbtype
|
||||
dbtype=sigdb
|
||||
con = psycopg2.connect("host=" + host + " port=" + port + " dbname="+dbtype+" user=" + user + " password=" + mdp)
|
||||
cur = con.cursor(cursor_factory = psycopg2.extras.DictCursor)
|
||||
self.initialisation_flux()
|
||||
self.combobox_custom()
|
||||
# Create the dialog with elements (after translation) and keep reference
|
||||
# Only create GUI ONCE in callback, so that it will only load when the plugin is started
|
||||
if self.first_start == True:
|
||||
self.first_start = False
|
||||
# show the dialog
|
||||
self.show()
|
||||
# Run the dialog event loop
|
||||
result = self.exec()
|
||||
# See if OK was pressed
|
||||
if result:
|
||||
# Do something useful here - delete the line containing pass and
|
||||
# substitute with your code.
|
||||
pass
|
||||
|
||||
def suppression_flux(self):
|
||||
self.tableWidget_2.removeRow(self.tableWidget_2.currentRow())
|
||||
|
||||
def open_url(self, item):
|
||||
url = item.data(Qt.UserRole)
|
||||
|
||||
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':
|
||||
custom_list="""(SELECT schemaname,tablename from pg_catalog.pg_tables
|
||||
where schemaname like '"""+ str(self.comboBox.currentText()) +"""%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '"""+ str(self.comboBox.currentText()) +"""%' order by schemaname,tablename) order by schemaname,tablename;"""
|
||||
else:
|
||||
custom_list="""(SELECT schemaname,tablename from pg_catalog.pg_tables
|
||||
where schemaname like '\_"""+ str(self.comboBox.currentText()) +"""%' order by schemaname,tablename) UNION (SELECT schemaname,matviewname AS tablename FROM pg_catalog.pg_matviews where schemaname like '\_"""+ str(self.comboBox.currentText()) +"""%' order by schemaname,tablename) order by schemaname,tablename;"""
|
||||
else:
|
||||
if self.comboBox.currentText() == 'toutes les catégories':
|
||||
custom_list=schemaname_list_ref
|
||||
else:
|
||||
custom_list="""SELECT schemaname,tablename from pg_catalog.pg_tables
|
||||
where schemaname like '"""+ str(self.comboBox.currentText()) +"""' order by schemaname,tablename;"""
|
||||
cur.execute(custom_list)
|
||||
list_schema = cur.fetchall()
|
||||
|
||||
SQLraster = """SELECT concat(r_table_schema,'.',r_table_name) from public.raster_columns; """
|
||||
cur.execute(SQLraster)
|
||||
list_raster = cur.fetchall()
|
||||
RasterList = []
|
||||
for rasterFind in list_raster:
|
||||
RasterList.append(rasterFind[0])
|
||||
|
||||
self.tableWidget.setRowCount(len(list_schema))
|
||||
self.tableWidget.setColumnCount(3)
|
||||
i=0
|
||||
for value in list_schema:
|
||||
if dbtype == sigdb:
|
||||
type_val = str(value[0])[1:3]
|
||||
schema_name=str(value[0])[4:]
|
||||
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])
|
||||
table_name=str(value[1])
|
||||
if type_val == 'fo':
|
||||
type_val=str(value[0])[1:5]
|
||||
schema_name=str(value[0])[6:]
|
||||
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])
|
||||
table_name=str(value[1])
|
||||
elif type_val != '00' and type_val != '01' and type_val != '07' and type_val != '26' and type_val != '42' and type_val != '69' and type_val != 'ra':
|
||||
if dbtype == refdb:
|
||||
if (schema_name+'.'+table_name) in RasterList:
|
||||
SVG = 'mIconRaster.svg'
|
||||
else:
|
||||
SVG = 'mIconWfs.svg'
|
||||
svgWidget = QSvgWidget(resources_path('icons',SVG))
|
||||
else:
|
||||
type_val='agregation'
|
||||
schema_name=str(value[0])
|
||||
table_name=str(value[1])
|
||||
|
||||
item = QTableWidgetItem(type_val)
|
||||
if dbtype == refdb:
|
||||
self.tableWidget.setCellWidget(i,0,svgWidget)
|
||||
self.tableWidget.setItem(i,0,QTableWidgetItem(''))
|
||||
else:
|
||||
self.tableWidget.setCellWidget(i,0,None)
|
||||
self.tableWidget.setItem(i,0,item)
|
||||
item = QTableWidgetItem(schema_name)
|
||||
self.tableWidget.setItem(i,1,item)
|
||||
item = QTableWidgetItem(table_name)
|
||||
self.tableWidget.setItem(i,2,item)
|
||||
i=i+1
|
||||
self.tableWidget.setColumnWidth(0, 20)
|
||||
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()
|
||||
|
||||
# Assuming you want to compare items in the first column for uniqueness
|
||||
svgTake = (selected_items[2].tableWidget().cellWidget(0,0))
|
||||
new_item_text = selected_items[2].text()
|
||||
|
||||
if not self.item_already_exists(new_item_text):
|
||||
self.tableWidget_2.insertRow(selected_row)
|
||||
|
||||
for column in range(self.tableWidget.columnCount()):
|
||||
cloned_item = selected_items[column].clone()
|
||||
self.tableWidget_2.setHorizontalHeaderLabels(["Code","Schema", "Table"])
|
||||
self.tableWidget_2.setColumnCount(3)
|
||||
self.tableWidget_2.setItem(selected_row, column, cloned_item)
|
||||
|
||||
self.tableWidget_2.setColumnWidth(0, 50)
|
||||
self.tableWidget_2.setColumnWidth(1, 300)
|
||||
self.tableWidget_2.setColumnWidth(2, 300)
|
||||
|
||||
|
||||
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.MatchFlag(0))
|
||||
|
||||
# Check if there are any existing items with the same text in the first column
|
||||
return len(existing_items) > 0
|
||||
|
||||
|
||||
|
||||
def limite_flux(self):
|
||||
|
||||
if self.tableWidget_2.rowCount() > 5:
|
||||
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.StandardButton(0x00004000)|QMessageBox.StandardButton(0x00010000))
|
||||
if self.QMBquestion == QMessageBox.StandardButton(0x00004000):
|
||||
self.chargement_flux()
|
||||
|
||||
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)
|
||||
|
||||
if (schema+'.'+table) in RasterList:
|
||||
uri.setDataSource(schema, table, "rast")
|
||||
uri.setKeyColumn('rid')
|
||||
uri.setSrid('2154')
|
||||
layer = QgsRasterLayer(uri.uri(), table, "postgresraster")
|
||||
else:
|
||||
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):
|
||||
|
||||
managerAU = QgsApplication.authManager()
|
||||
k = managerAU.availableAuthMethodConfigs().keys()
|
||||
|
||||
def REQUEST(type):
|
||||
switcher = {
|
||||
'WFS': "GetFeature",
|
||||
'WMS': "GetMap",
|
||||
'WMS+Vecteur': "GetMap",
|
||||
'WMS+Raster': "GetMap",
|
||||
'WMTS': "GetMap"
|
||||
}
|
||||
return switcher.get(type, "nothing")
|
||||
|
||||
|
||||
|
||||
def displayOnWindows(type, uri, name):
|
||||
p = []
|
||||
|
||||
SQLraster = """SELECT concat(r_table_schema,'.',r_table_name) from public.raster_columns; """
|
||||
cur.execute(SQLraster)
|
||||
list_raster = cur.fetchall()
|
||||
RasterList = []
|
||||
for rasterFind in list_raster:
|
||||
RasterList.append(rasterFind[0])
|
||||
|
||||
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()
|
||||
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()
|
||||
table = self.tableWidget_2.item(row,2).text()#.split("?", 1)[0]
|
||||
uri = QgsDataSourceUri()
|
||||
uri.setConnection(host ,port ,dbtype ,user ,mdp)
|
||||
|
||||
# nom du schéma à remplacer: "hydrographie" à supprimer et mettre "couches_collaboratives" lorsqu'on aura regroupé les couches à modifier dans un même schéma
|
||||
|
||||
if (schema+'.'+table) in RasterList:
|
||||
uri.setDataSource(schema, table, "rast")
|
||||
uri.setKeyColumn('rid')
|
||||
uri.setSrid('2154')
|
||||
layer = QgsRasterLayer(uri.uri(), table, "postgresraster")
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
else:
|
||||
uri.setDataSource(schema, table, "geom")
|
||||
uri.setKeyColumn('gid')
|
||||
|
||||
# Chargement de la couche PostGIS
|
||||
geom_type ='SELECT right(st_geometrytype(geom),-3) as a FROM '+schema+'.'+table+' GROUP BY a'
|
||||
cur.execute(geom_type)
|
||||
list_typegeom = cur.fetchall()
|
||||
if len(list_typegeom) > 1:
|
||||
for typegeom in list_typegeom:
|
||||
if typegeom[0] == 'MultiPolygon':
|
||||
uri.setWkbType(QgsWkbTypes.MultiPolygon)
|
||||
elif typegeom[0] == 'MultiLineString':
|
||||
uri.setWkbType(QgsWkbTypes.MultiLineString)
|
||||
elif typegeom[0] == 'Point':
|
||||
uri.setWkbType(QgsWkbTypes.Point)
|
||||
if typegeom[0] == 'Polygon':
|
||||
uri.setWkbType(QgsWkbTypes.Polygon)
|
||||
elif typegeom[0] == 'LineString':
|
||||
uri.setWkbType(QgsWkbTypes.LineString)
|
||||
elif typegeom[0] == 'MultiPoint':
|
||||
uri.setWkbType(QgsWkbTypes.MultiPoint)
|
||||
if (typegeom[0] != None and typegeom[0] != 'Polygon'):
|
||||
uri.setSrid('2154')
|
||||
layer = QgsVectorLayer(uri.uri(), table, "postgres")
|
||||
# Ajout de la couche au canevas QGIS
|
||||
QgsProject.instance().addMapLayer(layer)
|
||||
else:
|
||||
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')
|
||||
self.comboBox.addItem('01')
|
||||
self.comboBox.addItem('07')
|
||||
self.comboBox.addItem('26')
|
||||
self.comboBox.addItem('42')
|
||||
self.comboBox.addItem('69')
|
||||
self.comboBox.addItem('agregation')
|
||||
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()
|
||||
self.comboBox.clear()
|
||||
self.comboBox.addItem("toutes les catégories")
|
||||
for baxval in list_schema:
|
||||
self.comboBox.addItem(baxval[0])
|
||||
|
||||
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)
|
||||
match = filter_text.lower() not in item.text().lower()
|
||||
self.tableWidget.setRowHidden(i, match)
|
||||
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
|
||||
self.dialog.text_edit.show()
|
||||
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,88 @@
|
||||
import os
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
end_find = plugin_dir.rfind('\\')+1
|
||||
|
||||
NAME = plugin_dir[end_find:]
|
||||
|
||||
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)
|
||||
@@ -5,8 +5,9 @@
|
||||
[general]
|
||||
name=CenRa_FLUX
|
||||
qgisMinimumVersion=3.0
|
||||
supportsQt6=True
|
||||
description=Permet d'ouvrire une table dans la base PostGis
|
||||
version=1.14
|
||||
version=3.1
|
||||
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
|
||||
email=si_besoin@cen-rhonealpes.fr
|
||||
|
||||
@@ -28,11 +29,11 @@ homepage=https://plateformesig.cenra-outils.org/
|
||||
tracker=https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS
|
||||
|
||||
category=Plugins
|
||||
icon=cenra.png
|
||||
icon=icon.png
|
||||
# experimental flag
|
||||
experimental=False
|
||||
|
||||
changelog=<h1>CenRA_FLUX:</h1></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>21/07/2025 - Version 3.1: </h3> - Bug fix pour l'ouverture de plus de 5 couches.</p></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,111 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
"""This script uploads a plugin package to the plugin repository.
|
||||
Authors: A. Pasotti, V. Picavet
|
||||
git sha : $TemplateVCSFormat
|
||||
"""
|
||||
|
||||
import sys
|
||||
import getpass
|
||||
import xmlrpc.client
|
||||
from optparse import OptionParser
|
||||
|
||||
standard_library.install_aliases()
|
||||
|
||||
# Configuration
|
||||
PROTOCOL = 'https'
|
||||
SERVER = 'plugins.qgis.org'
|
||||
PORT = '443'
|
||||
ENDPOINT = '/plugins/RPC2/'
|
||||
VERBOSE = False
|
||||
|
||||
|
||||
def main(parameters, arguments):
|
||||
"""Main entry point.
|
||||
|
||||
:param parameters: Command line parameters.
|
||||
:param arguments: Command line arguments.
|
||||
"""
|
||||
address = "{protocol}://{username}:{password}@{server}:{port}{endpoint}".format(
|
||||
protocol=PROTOCOL,
|
||||
username=parameters.username,
|
||||
password=parameters.password,
|
||||
server=parameters.server,
|
||||
port=parameters.port,
|
||||
endpoint=ENDPOINT)
|
||||
print("Connecting to: %s" % hide_password(address))
|
||||
|
||||
server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE)
|
||||
|
||||
try:
|
||||
with open(arguments[0], 'rb') as handle:
|
||||
plugin_id, version_id = server.plugin.upload(
|
||||
xmlrpc.client.Binary(handle.read()))
|
||||
print("Plugin ID: %s" % plugin_id)
|
||||
print("Version ID: %s" % version_id)
|
||||
except xmlrpc.client.ProtocolError as err:
|
||||
print("A protocol error occurred")
|
||||
print("URL: %s" % hide_password(err.url, 0))
|
||||
print("HTTP/HTTPS headers: %s" % err.headers)
|
||||
print("Error code: %d" % err.errcode)
|
||||
print("Error message: %s" % err.errmsg)
|
||||
except xmlrpc.client.Fault as err:
|
||||
print("A fault occurred")
|
||||
print("Fault code: %d" % err.faultCode)
|
||||
print("Fault string: %s" % err.faultString)
|
||||
|
||||
|
||||
def hide_password(url, start=6):
|
||||
"""Returns the http url with password part replaced with '*'.
|
||||
|
||||
:param url: URL to upload the plugin to.
|
||||
:type url: str
|
||||
|
||||
:param start: Position of start of password.
|
||||
:type start: int
|
||||
"""
|
||||
start_position = url.find(':', start) + 1
|
||||
end_position = url.find('@')
|
||||
return "%s%s%s" % (
|
||||
url[:start_position],
|
||||
'*' * (end_position - start_position),
|
||||
url[end_position:])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser(usage="%prog [options] plugin.zip")
|
||||
parser.add_option(
|
||||
"-w", "--password", dest="password",
|
||||
help="Password for plugin site", metavar="******")
|
||||
parser.add_option(
|
||||
"-u", "--username", dest="username",
|
||||
help="Username of plugin site", metavar="user")
|
||||
parser.add_option(
|
||||
"-p", "--port", dest="port",
|
||||
help="Server port to connect to", metavar="80")
|
||||
parser.add_option(
|
||||
"-s", "--server", dest="server",
|
||||
help="Specify server name", metavar="plugins.qgis.org")
|
||||
options, args = parser.parse_args()
|
||||
if len(args) != 1:
|
||||
print("Please specify zip file.\n")
|
||||
parser.print_help()
|
||||
sys.exit(1)
|
||||
if not options.server:
|
||||
options.server = SERVER
|
||||
if not options.port:
|
||||
options.port = PORT
|
||||
if not options.username:
|
||||
# interactive mode
|
||||
username = getpass.getuser()
|
||||
print("Please enter user name [%s] :" % username, end=' ')
|
||||
|
||||
res = input()
|
||||
if res != "":
|
||||
options.username = res
|
||||
else:
|
||||
options.username = username
|
||||
if not options.password:
|
||||
# interactive mode
|
||||
options.password = getpass.getpass()
|
||||
main(options, args)
|
||||
@@ -1,8 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/plugins/CenRa_FLUX" >
|
||||
<file>reficon.png</file>
|
||||
<file>arrow-up.png</file>
|
||||
<file>arrow-bottom.png</file>
|
||||
<file>logo.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -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)
|
||||
)
|
||||
"""
|
||||
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
@@ -0,0 +1,230 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="24"
|
||||
height="24"
|
||||
id="svg5692"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="mActionAddRasterLayer.svg"
|
||||
inkscape:export-filename="/home/denis/Desktop/oracle.png"
|
||||
inkscape:export-xdpi="67.5"
|
||||
inkscape:export-ydpi="67.5">
|
||||
<title
|
||||
id="title2829">GIS icon theme 0.2</title>
|
||||
<defs
|
||||
id="defs5694">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 16 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="32 : 16 : 1"
|
||||
inkscape:persp3d-origin="16 : 10.666667 : 1"
|
||||
id="perspective3486" />
|
||||
<inkscape:perspective
|
||||
id="perspective3496"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3600"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective7871"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective8710"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective9811"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective4762"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="22.539029"
|
||||
inkscape:cx="0.66325675"
|
||||
inkscape:cy="15.235866"
|
||||
inkscape:current-layer="layer2"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
borderlayer="false"
|
||||
inkscape:window-width="1855"
|
||||
inkscape:window-height="1056"
|
||||
inkscape:window-x="65"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-global="true"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:snap-object-midpoints="false"
|
||||
inkscape:snap-grids="true"
|
||||
inkscape:object-paths="false">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid5700"
|
||||
empspacing="5"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true"
|
||||
dotted="true"
|
||||
originx="2.5px"
|
||||
originy="2.5px" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata5697">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>GIS icon theme 0.2</dc:title>
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Robert Szczepanek</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title>Robert Szczepanek</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>GIS icons</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
<dc:coverage>GIS icons</dc:coverage>
|
||||
<dc:description>http://robert.szczepanek.pl/</dc:description>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="Layer"
|
||||
style="display:inline"
|
||||
transform="translate(0,-8)">
|
||||
<rect
|
||||
style="fill:#6e97c4;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="rect6419"
|
||||
width="7.999999"
|
||||
height="7.999999"
|
||||
x="7.9999986"
|
||||
y="7.9999995" />
|
||||
<rect
|
||||
style="fill:#2b3b4d;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
id="rect6419-6"
|
||||
width="7.999999"
|
||||
height="7.999999"
|
||||
x="16.000002"
|
||||
y="7.9999995" />
|
||||
<rect
|
||||
style="fill:#2b3b4d;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
id="rect6419-6-9"
|
||||
width="7.999999"
|
||||
height="7.999999"
|
||||
x="7.9999986"
|
||||
y="16"
|
||||
inkscape:transform-center-x="-3.9999992"
|
||||
inkscape:transform-center-y="-5.3333316" />
|
||||
<rect
|
||||
style="fill:#6d97c4;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
id="rect6419-0"
|
||||
width="7.999999"
|
||||
height="7.999999"
|
||||
x="16.000002"
|
||||
y="16" />
|
||||
<rect
|
||||
style="fill:#2d3e4d;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
id="rect6419-6-7"
|
||||
width="7.999999"
|
||||
height="7.999999"
|
||||
x="-4.7683716e-07"
|
||||
y="7.9999995" />
|
||||
<rect
|
||||
style="fill:#6d97c4;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
id="rect6419-3"
|
||||
width="7.999999"
|
||||
height="7.999999"
|
||||
x="-4.7683716e-07"
|
||||
y="16" />
|
||||
<rect
|
||||
style="fill:#6d97c4;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
id="rect6419-5"
|
||||
width="7.999999"
|
||||
height="7.999999"
|
||||
x="7.9999986"
|
||||
y="24.000002" />
|
||||
<rect
|
||||
style="fill:#2b3b4d;fill-opacity:1;fill-rule:nonzero;stroke:none;display:inline"
|
||||
id="rect6419-6-6"
|
||||
width="7.999999"
|
||||
height="7.999999"
|
||||
x="-4.7683716e-07"
|
||||
y="24.000002" />
|
||||
<rect
|
||||
style="fill:none;stroke:none"
|
||||
id="rect6554"
|
||||
width="23.999998"
|
||||
height="23.999998"
|
||||
x="-4.7683716e-07"
|
||||
y="7.9999995" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.2 KiB |
@@ -0,0 +1,312 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="24"
|
||||
height="24"
|
||||
id="svg5692"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="mActionAddWfsLayer.svg"
|
||||
inkscape:export-filename="/media/home1/robert/svn/graphics/trunk/toolbar-icons/32x32/layer-vector.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<title
|
||||
id="title2829">GIS icon theme 0.2</title>
|
||||
<defs
|
||||
id="defs5694">
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 16 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="32 : 16 : 1"
|
||||
inkscape:persp3d-origin="16 : 10.666667 : 1"
|
||||
id="perspective3486" />
|
||||
<inkscape:perspective
|
||||
id="perspective3496"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3600"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective7871"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective8710"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective9811"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective4762"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
id="perspective4762-4" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
id="perspective9811-2" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
id="perspective8710-0" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
id="perspective7871-7" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
id="perspective3600-9" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 0.5 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="1 : 0.5 : 1"
|
||||
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
|
||||
id="perspective3496-4" />
|
||||
<inkscape:perspective
|
||||
id="perspective3486-0"
|
||||
inkscape:persp3d-origin="16 : 10.666667 : 1"
|
||||
inkscape:vp_z="32 : 16 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 16 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<inkscape:perspective
|
||||
id="perspective3952"
|
||||
inkscape:persp3d-origin="12 : 8 : 1"
|
||||
inkscape:vp_z="24 : 12 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 12 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="16"
|
||||
inkscape:cx="-0.094554179"
|
||||
inkscape:cy="17.125349"
|
||||
inkscape:current-layer="layer2"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
borderlayer="false"
|
||||
inkscape:window-width="1855"
|
||||
inkscape:window-height="1056"
|
||||
inkscape:window-x="65"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-global="true"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:snap-object-midpoints="true"
|
||||
inkscape:snap-grids="false"
|
||||
inkscape:object-paths="false"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:object-nodes="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid5700"
|
||||
empspacing="5"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true"
|
||||
dotted="true"
|
||||
originx="2.5px"
|
||||
originy="2.5px" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata5697">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title>GIS icon theme 0.2</dc:title>
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Robert Szczepanek</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title>Robert Szczepanek</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<dc:subject>
|
||||
<rdf:Bag>
|
||||
<rdf:li>GIS icons</rdf:li>
|
||||
</rdf:Bag>
|
||||
</dc:subject>
|
||||
<dc:coverage>GIS icons</dc:coverage>
|
||||
<dc:description>http://robert.szczepanek.pl/</dc:description>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="Layer"
|
||||
style="display:inline"
|
||||
transform="translate(0,-8)">
|
||||
<g
|
||||
id="g3028"
|
||||
transform="matrix(0.75161647,0,0,0.75161647,-0.02586348,9.4769448)">
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3775"
|
||||
d="m 16.000001,1.0775438 c 9.467477,4.6992805 8.114981,22.3215822 0,25.8460432"
|
||||
style="fill:none;stroke:#749fcf;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3773"
|
||||
d="m 1.1225356,14.000566 29.7549294,0"
|
||||
style="fill:none;stroke:#749fcf;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3773-1"
|
||||
d="m 2.9484075,6.9340877 c 7.5739815,1.0094969 18.3939565,1.0094969 25.9679385,0"
|
||||
style="fill:none;stroke:#749fcf;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3773-4"
|
||||
d="m 2.9484075,21.067042 c 7.5739815,-1.009496 18.3939565,-1.009496 25.9679385,0"
|
||||
style="fill:none;stroke:#749fcf;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3777"
|
||||
d="m 16.000001,1.0775438 c -8.1149812,3.5244605 -9.467478,21.1467632 0,25.8460432"
|
||||
style="fill:none;stroke:#749fcf;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
<path
|
||||
transform="matrix(1.2562074,0,0,1.0871977,22.465232,-1.0129089)"
|
||||
d="m 6.9656949,13.809332 c 0,6.713955 -5.4228716,12.15669 -12.1123228,12.15669 -6.6894511,0 -12.1123231,-5.442735 -12.1123231,-12.15669 0,-6.7139549 5.422872,-12.1566907 12.1123231,-12.1566907 6.6894512,0 12.1123228,5.4427358 12.1123228,12.1566907 z"
|
||||
sodipodi:ry="12.156691"
|
||||
sodipodi:rx="12.112323"
|
||||
sodipodi:cy="13.809332"
|
||||
sodipodi:cx="-5.1466279"
|
||||
id="path3003"
|
||||
style="fill:none;stroke:#5488c4;stroke-width:1.28353083;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
sodipodi:type="arc" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccc"
|
||||
id="path2960"
|
||||
d="M 7.3400991,7.2779254 13.185401,22.026434 19.613856,7.4154701 24.89957,7.3945152"
|
||||
style="color:#000000;fill:none;stroke:#172739;stroke-width:1.29794168;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
transform="matrix(1.5475161,0,0,1.6212881,1.923793,-12.988176)"
|
||||
d="m 4.5,12.5 c 0,0.552285 -0.4477153,1 -1,1 -0.5522847,0 -1,-0.447715 -1,-1 0,-0.552285 0.4477153,-1 1,-1 0.5522847,0 1,0.447715 1,1 z"
|
||||
sodipodi:ry="1"
|
||||
sodipodi:rx="1"
|
||||
sodipodi:cy="12.5"
|
||||
sodipodi:cx="3.5"
|
||||
id="path2958"
|
||||
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#172739;stroke-width:0.94698602;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
sodipodi:type="arc" />
|
||||
<path
|
||||
transform="matrix(1.5839392,0,0,1.6212881,7.641614,1.7603321)"
|
||||
d="m 4.5,12.5 c 0,0.552285 -0.4477153,1 -1,1 -0.5522847,0 -1,-0.447715 -1,-1 0,-0.552285 0.4477153,-1 1,-1 0.5522847,0 1,0.447715 1,1 z"
|
||||
sodipodi:ry="1"
|
||||
sodipodi:rx="1"
|
||||
sodipodi:cy="12.5"
|
||||
sodipodi:cx="3.5"
|
||||
id="path2958-0"
|
||||
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#172739;stroke-width:0.93603462;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
sodipodi:type="arc" />
|
||||
<path
|
||||
transform="matrix(1.5475161,0,0,1.6212881,14.034218,-12.884972)"
|
||||
d="m 4.5,12.5 c 0,0.552285 -0.4477153,1 -1,1 -0.5522847,0 -1,-0.447715 -1,-1 0,-0.552285 0.4477153,-1 1,-1 0.5522847,0 1,0.447715 1,1 z"
|
||||
sodipodi:ry="1"
|
||||
sodipodi:rx="1"
|
||||
sodipodi:cy="12.5"
|
||||
sodipodi:cx="3.5"
|
||||
id="path2958-9"
|
||||
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#172739;stroke-width:0.94698602;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
sodipodi:type="arc" />
|
||||
<path
|
||||
transform="matrix(1.5475161,0,0,1.6212881,19.483264,-12.871586)"
|
||||
d="m 4.5,12.5 c 0,0.552285 -0.4477153,1 -1,1 -0.5522847,0 -1,-0.447715 -1,-1 0,-0.552285 0.4477153,-1 1,-1 0.5522847,0 1,0.447715 1,1 z"
|
||||
sodipodi:ry="1"
|
||||
sodipodi:rx="1"
|
||||
sodipodi:cy="12.5"
|
||||
sodipodi:cx="3.5"
|
||||
id="path2958-6"
|
||||
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#172739;stroke-width:0.94698602;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
sodipodi:type="arc" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -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.
|
||||
@@ -89,7 +95,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_FLUX\\tools")))
|
||||
for item in args:
|
||||
path = abspath(join(path, item))
|
||||
return path
|
||||
@@ -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>
|
||||
@@ -0,0 +1,396 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>890</width>
|
||||
<height>810</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>890</width>
|
||||
<height>810</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>SIG CEN-RA</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<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/>
|
||||
</ui>
|
||||
@@ -0,0 +1,332 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CenRa_IssuesSend</class>
|
||||
<widget class="QDialog" name="CenRa_IssuesSend">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>810</width>
|
||||
<height>587</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CEN-RA Metabase</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>icon.svg</normaloff>icon.svg</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>550</y>
|
||||
<width>811</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="annuler_button">
|
||||
<property name="text">
|
||||
<string>Annuler</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<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="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="QPushButton" name="ok_button">
|
||||
<property name="text">
|
||||
<string>Envoyer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>791</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Issues</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="titre_line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>40</y>
|
||||
<width>321</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="messages_plain">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>101</y>
|
||||
<width>571</width>
|
||||
<height>421</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>589</x>
|
||||
<y>100</y>
|
||||
<width>191</width>
|
||||
<height>431</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="formLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>341</width>
|
||||
<height>411</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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="check_bug">
|
||||
<property name="text">
|
||||
<string>Bug</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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="2" column="1">
|
||||
<widget class="QCheckBox" name="check_aide">
|
||||
<property name="text">
|
||||
<string>Aide</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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="3" column="1">
|
||||
<widget class="QCheckBox" name="check_question">
|
||||
<property name="text">
|
||||
<string>Question</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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="4" column="1">
|
||||
<widget class="QCheckBox" name="check_amelioration">
|
||||
<property name="text">
|
||||
<string>Amélioration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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="5" column="1">
|
||||
<widget class="QCheckBox" name="check_autre">
|
||||
<property name="text">
|
||||
<string>Autre</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>20</y>
|
||||
<width>51</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Titre:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Messages:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>600</x>
|
||||
<y>70</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sujet:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>ok_button</tabstop>
|
||||
<tabstop>annuler_button</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +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>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>
|
||||
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 56 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
|
||||
@@ -0,0 +1,45 @@
|
||||
import os.path
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from qgis.PyQt import uic
|
||||
from qgis.PyQt.QtGui import QPixmap
|
||||
from qgis.PyQt.QtWidgets import QDialog
|
||||
|
||||
from .tools.resources import devlog
|
||||
|
||||
ABOUT_FORM_CLASS, _ = uic.loadUiType(
|
||||
os.path.join(
|
||||
str(Path(__file__).resolve().parent),
|
||||
'tools/ui',
|
||||
'CenRa_about_form.ui'
|
||||
)
|
||||
)
|
||||
|
||||
class MetabaseAboutDialog(QDialog, ABOUT_FORM_CLASS):
|
||||
|
||||
""" About - Let the user display the about dialog. """
|
||||
|
||||
def __init__(self, iface, parent=None):
|
||||
super().__init__(parent)
|
||||
self.iface = iface
|
||||
self.setupUi(self)
|
||||
|
||||
self.viewer.setHtml(devlog('CenRa_METABASE'))
|
||||
|
||||
self.rejected.connect(self.onReject)
|
||||
self.buttonBox.rejected.connect(self.onReject)
|
||||
self.buttonBox.accepted.connect(self.onAccept)
|
||||
|
||||
def onAccept(self):
|
||||
"""
|
||||
Save options when pressing OK button
|
||||
"""
|
||||
self.accept()
|
||||
|
||||
def onReject(self):
|
||||
"""
|
||||
Run some actions when
|
||||
the user closes the dialog
|
||||
"""
|
||||
self.close()
|
||||
@@ -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=False
|
||||
|
||||
# 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
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
body {
|
||||
font-family: Ubuntu, Lucida Grande, Segoe UI, Arial, sans-serif;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
margin-top: 0px;
|
||||
font-size: 14px;
|
||||
}
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
img.logo{
|
||||
display: inline-block;
|
||||
margin-left:0px;
|
||||
margin-right: 0px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
vertical-align: top;
|
||||
width:25%
|
||||
}
|
||||
h2, h3 {
|
||||
color: #fff;
|
||||
background-color: #8cb63c;
|
||||
line-height: 2;
|
||||
padding-left:5px;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
font-size: 13px;
|
||||
}
|
||||
th{
|
||||
color: #2c4491
|
||||
}
|
||||
table tr th, table tr td {
|
||||
text-align: left;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
table.table-striped {
|
||||
border: 1px solid #BBB;
|
||||
}
|
||||
table.table-striped tr td {
|
||||
border: 1px solid #BBB;
|
||||
}
|
||||
table.table-striped tr th {
|
||||
border: 1px solid #BBB;
|
||||
}
|
||||
table.table-striped tr:nth-child(even) {
|
||||
background: #EEE;
|
||||
}
|
||||
table.table-striped tr:nth-child(odd) {
|
||||
background: #FFF;
|
||||
}
|
||||
|
||||
#map {
|
||||
padding: 5px;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
box-shadow: 0 0 10px #999;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<tr>
|
||||
<td>[% contact_role %]</td>
|
||||
<td>[% name %]</td>
|
||||
<td>[% organisation_name %] ([% organisation_unit %])</td>
|
||||
<td><a href="mailto:[% email %]">[% email %]</a></td>
|
||||
<td>[% phone %]</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,7 @@
|
||||
<tr>
|
||||
<td><span title="[% type_label %]">[% type %]</span></td>
|
||||
<td><a title="[% description %]" href="[% url %]" target="_blank">[% name %]</a></td>
|
||||
<td><span title="[% mime_label %]">[% mime %]</span></td>
|
||||
<td>[% format %]</td>
|
||||
<td>[% size %]</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,123 @@
|
||||
<div>
|
||||
<h3>Identification</h3>
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<th>Title</th><td>[% title %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Abstract</th><td>[% abstract %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Categories</th><td>[% categories %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Themes</th><td>[% themes %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Keywords</th><td>[% keywords %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Data last update</th><td>[% data_last_update %]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3>Spatial properties</h3>
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<th>Level</th><td>[% spatial_level %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Minimum scale</th><td>[% minimum_optimal_scale %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Maximum scale</th><td>[% maximum_optimal_scale %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Feature count</th><td>[% feature_count %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Geometry</th><td>[% geometry_type %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Extent</th><td>[% spatial_extent %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Projection name</th><td>[% projection_name %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Projection ID</th><td>[% projection_authid %]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3>Publication</h3>
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<th>Date</th><td>[% publication_date %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Frequency</th><td>[% publication_frequency %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>License</th><td>[% license %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>License attribution / number</th><td>[% license_attribution %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Confidentiality</th><td>[% confidentiality %]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3>Links</h3>
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Name</th>
|
||||
<th>MIME</th>
|
||||
<th>Format</th>
|
||||
<th>Size</th>
|
||||
</tr>
|
||||
[% meta_links %]
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3>Contacts</h3>
|
||||
<table class="table table-condensed table-striped table-bordered">
|
||||
<tr>
|
||||
<th>Role</th>
|
||||
<th>Name</th>
|
||||
<th>Organisation</th>
|
||||
<th>Email</th>
|
||||
<th>Phone</th>
|
||||
</tr>
|
||||
[% meta_contacts %]
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h3>Metadata</h3>
|
||||
<table class="table table-condensed">
|
||||
<tr>
|
||||
<th>Table</th><td>[% table_name %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Schema</th><td>[% schema_name %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Creation</th><td>[% creation_date %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Update</th><td>[% update_date %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>UUID</th><td>[% uid %]</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,177 @@
|
||||
"""Tools to work with resource files."""
|
||||
|
||||
import configparser
|
||||
import shutil
|
||||
import tempfile
|
||||
import os
|
||||
from os.path import abspath, join, pardir, dirname
|
||||
from qgis.PyQt.QtWidgets import QApplication
|
||||
from qgis.PyQt import uic
|
||||
|
||||
__copyright__ = "Copyright 2019, 3Liz"
|
||||
__license__ = "GPL version 3"
|
||||
__email__ = "info@3liz.org"
|
||||
__revision__ = "$Format:%H$"
|
||||
|
||||
|
||||
def plugin_path(*args):
|
||||
"""Get the path to plugin root folder.
|
||||
|
||||
:param args List of path elements e.g. ['img', 'logos', 'image.png']
|
||||
:type args: str
|
||||
|
||||
:return: Absolute path to the plugin path.
|
||||
:rtype: str
|
||||
"""
|
||||
path = dirname(dirname(__file__))
|
||||
path = abspath(abspath(join(path, pardir)))
|
||||
for item in args:
|
||||
path = abspath(join(path, item))
|
||||
|
||||
return path
|
||||
|
||||
|
||||
def plugin_name():
|
||||
"""Return the plugin name according to metadata.txt.
|
||||
|
||||
:return: The plugin name.
|
||||
:rtype: basestring
|
||||
"""
|
||||
metadata = metadata_config()
|
||||
name = metadata["general"]["name"]
|
||||
return name
|
||||
|
||||
|
||||
def metadata_config() -> configparser:
|
||||
"""Get the INI config parser for the metadata file.
|
||||
|
||||
:return: The config parser object.
|
||||
:rtype: ConfigParser
|
||||
"""
|
||||
path = plugin_path("metadata.txt")
|
||||
config = configparser.ConfigParser()
|
||||
config.read(path, encoding='utf8')
|
||||
return config
|
||||
|
||||
|
||||
def plugin_test_data_path(*args, copy=False):
|
||||
"""Get the path to the plugin test data path.
|
||||
|
||||
:param args List of path elements e.g. ['img', 'logos', 'image.png']
|
||||
:type args: str
|
||||
|
||||
:param copy: If the file must be copied into a temporary directory first.
|
||||
:type copy: bool
|
||||
|
||||
:return: Absolute path to the resources folder.
|
||||
:rtype: str
|
||||
"""
|
||||
path = abspath(abspath(join(plugin_path(), "test", "data")))
|
||||
for item in args:
|
||||
path = abspath(join(path, item))
|
||||
|
||||
if copy:
|
||||
temp = tempfile.mkdtemp()
|
||||
shutil.copy(path, temp)
|
||||
return join(temp, args[-1])
|
||||
else:
|
||||
return path
|
||||
|
||||
|
||||
def resources_path(*args):
|
||||
"""Get the path to our resources folder.
|
||||
|
||||
:param args List of path elements e.g. ['img', 'logos', 'image.png']
|
||||
:type args: str
|
||||
|
||||
:return: Absolute path to the resources folder.
|
||||
:rtype: str
|
||||
"""
|
||||
path = abspath(abspath(join(plugin_path(), "CenRa_METABASE\\tools")))
|
||||
for item in 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.
|
||||
|
||||
:param args List of path elements e.g. ['img', 'logos', 'image.png']
|
||||
:type args: str
|
||||
|
||||
:return: Compiled UI file.
|
||||
"""
|
||||
ui_class, _ = uic.loadUiType(resources_path("ui", *args))
|
||||
|
||||
return ui_class
|
||||
|
||||
def 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
|
||||
|
||||
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:
|
||||
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 tr(text, context="@default"):
|
||||
return QApplication.translate(context, text)
|
||||
|
||||
def devlog(NAME):
|
||||
import qgis
|
||||
devmaj = '<head><style>* {margin:0; padding:0; }</style></head>'
|
||||
devmaj = devmaj+qgis.utils.pluginMetadata(NAME,'changelog')
|
||||
return devmaj
|
||||
@@ -0,0 +1,332 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CenRa_IssuesSend</class>
|
||||
<widget class="QDialog" name="CenRa_IssuesSend">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>810</width>
|
||||
<height>587</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CEN-RA Metabase</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>icon.svg</normaloff>icon.svg</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>550</y>
|
||||
<width>811</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="annuler_button">
|
||||
<property name="text">
|
||||
<string>Annuler</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<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="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="QPushButton" name="ok_button">
|
||||
<property name="text">
|
||||
<string>Envoyer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>791</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Issues</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="titre_line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>40</y>
|
||||
<width>321</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="messages_plain">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>101</y>
|
||||
<width>571</width>
|
||||
<height>421</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>589</x>
|
||||
<y>100</y>
|
||||
<width>191</width>
|
||||
<height>431</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="formLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>341</width>
|
||||
<height>411</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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="check_bug">
|
||||
<property name="text">
|
||||
<string>Bug</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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="2" column="1">
|
||||
<widget class="QCheckBox" name="check_aide">
|
||||
<property name="text">
|
||||
<string>Aide</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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="3" column="1">
|
||||
<widget class="QCheckBox" name="check_question">
|
||||
<property name="text">
|
||||
<string>Question</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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="4" column="1">
|
||||
<widget class="QCheckBox" name="check_amelioration">
|
||||
<property name="text">
|
||||
<string>Amélioration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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="5" column="1">
|
||||
<widget class="QCheckBox" name="check_autre">
|
||||
<property name="text">
|
||||
<string>Autre</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>20</y>
|
||||
<width>51</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Titre:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Messages:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>600</x>
|
||||
<y>70</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sujet:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>ok_button</tabstop>
|
||||
<tabstop>annuler_button</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CenRa_MetabaseDockWidgetBase</class>
|
||||
<widget class="QDockWidget" name="CenRa_MetabaseDockWidgetBase">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>329</width>
|
||||
<height>515</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>CenRa MetaBase</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="save_button">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QToolButton" name="config">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::NoArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="flatten_dataset_table">
|
||||
<property name="text">
|
||||
<string notr="true">...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="external_help">
|
||||
<property name="text">
|
||||
<string notr="true">help</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="viewer"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +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>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>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" ?>
|
||||
<rdf:RDF
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:dct="http://purl.org/dc/terms/"
|
||||
xmlns:dcat="http://www.w3.org/ns/dcat#"
|
||||
xmlns:owl="http://www.w3.org/2002/07/owl#"
|
||||
xmlns:foaf="http://xmlns.com/foaf/0.1/"
|
||||
xmlns:adms="http://www.w3.org/ns/adms#"
|
||||
xmlns:vcard="http://www.w3.org/2006/vcard/ns#"
|
||||
xmlns:schema="http://schema.org/"
|
||||
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
|
||||
|
||||
<dcat:Catalog>
|
||||
<dct:description>CEN-RA DCAT RDF catalog</dct:description>
|
||||
<dct:language>{language}</dct:language>
|
||||
<dct:title>CEN-RA Metadata</dct:title>
|
||||
<dcat:dataset>
|
||||
|
||||
<dcat:Dataset>
|
||||
{content}
|
||||
</dcat:Dataset>
|
||||
|
||||
</dcat:dataset>
|
||||
|
||||
</dcat:Catalog>
|
||||
</rdf:RDF>
|
||||