Nom Prénom, sécurité d'ecrasement, police

This commit is contained in:
Tom LAVEILLE 2025-01-27 17:14:31 +01:00
parent bbb41400e5
commit cbe6952c9a
4 changed files with 98 additions and 23 deletions

View File

@ -48,6 +48,7 @@ from qgis.PyQt.QtWebKitWidgets import QWebPage
from qgis.PyQt.QtWidgets import ( from qgis.PyQt.QtWidgets import (
QDialog, QDialog,
QAction, QAction,
QMessageBox,
QDockWidget, QDockWidget,
QFileDialog, QFileDialog,
QInputDialog, QInputDialog,
@ -58,6 +59,7 @@ from qgis.PyQt.QtWidgets import (
QVBoxLayout, QVBoxLayout,
) )
from PyQt5 import QtGui from PyQt5 import QtGui
from PyQt5 import QtWidgets
from qgis.PyQt.QtXml import QDomDocument from qgis.PyQt.QtXml import QDomDocument
from qgis.utils import iface from qgis.utils import iface
import glob import glob
@ -321,6 +323,8 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
self.comboBox_6.clear() self.comboBox_6.clear()
self.comboBox_7.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 = [] couches = []
couche_vecteur = [''] couche_vecteur = ['']
mapThemes = [''] mapThemes = ['']
@ -521,7 +525,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
if self.radioButton_9.isChecked() == 1: if self.radioButton_9.isChecked() == 1:
titre = titre + ' [%' + self.comboBox_4.currentText() + '%]' titre = titre + ' [%' + self.comboBox_4.currentText() + '%]'
subtitle.setText(titre) subtitle.setText(titre)
subtitle.setFont(QFont("MS Shell Dlg 2", 10)) subtitle.setFont(QFont("Calibri", 10))
subtitle.setItemRotation(self.template_parameters['Sous_titre_rotate']) subtitle.setItemRotation(self.template_parameters['Sous_titre_rotate'])
subtitle.attemptResize(self.template_parameters['Sous_titre_size']) subtitle.attemptResize(self.template_parameters['Sous_titre_size'])
subtitle.attemptMove(self.template_parameters['Sous_titre_locals']) subtitle.attemptMove(self.template_parameters['Sous_titre_locals'])
@ -628,6 +632,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
self.scalebarnumeric_qpt.setNumberOfSegments(2) self.scalebarnumeric_qpt.setNumberOfSegments(2)
self.scalebarnumeric_qpt.setNumberOfSegmentsLeft(0) self.scalebarnumeric_qpt.setNumberOfSegmentsLeft(0)
self.scalebarnumeric_qpt.setFont(QFont("Calibri", 12))
self.scalebarnumeric_qpt.attemptMove(self.template_parameters['Echelle_locals']) self.scalebarnumeric_qpt.attemptMove(self.template_parameters['Echelle_locals'])
self.scalebarnumeric_qpt.attemptResize(self.template_parameters['Echelle_size']) self.scalebarnumeric_qpt.attemptResize(self.template_parameters['Echelle_size'])
self.scalebarnumeric_qpt.setItemRotation(self.template_parameters['Echelle_rotate']) self.scalebarnumeric_qpt.setItemRotation(self.template_parameters['Echelle_rotate'])
@ -647,6 +652,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
self.scalebar_qpt.setNumberOfSegments(2) self.scalebar_qpt.setNumberOfSegments(2)
self.scalebar_qpt.setNumberOfSegmentsLeft(0) self.scalebar_qpt.setNumberOfSegmentsLeft(0)
self.scalebar_qpt.setFont(QFont("Calibri", 12))
self.scalebar_qpt.attemptMove(self.template_parameters['Echelle_2_locals']) self.scalebar_qpt.attemptMove(self.template_parameters['Echelle_2_locals'])
self.scalebar_qpt.attemptResize(self.template_parameters['Echelle_2_size']) self.scalebar_qpt.attemptResize(self.template_parameters['Echelle_2_size'])
self.scalebar_qpt.setItemRotation(self.template_parameters['Echelle_2_rotate']) self.scalebar_qpt.setItemRotation(self.template_parameters['Echelle_2_rotate'])
@ -664,6 +670,8 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
north.attemptMove(self.template_parameters['Arrow_locals']) north.attemptMove(self.template_parameters['Arrow_locals'])
north.attemptResize(self.template_parameters['Arrow_size']) north.attemptResize(self.template_parameters['Arrow_size'])
north.setItemRotation(self.template_parameters['Arrow_rotate']) north.setItemRotation(self.template_parameters['Arrow_rotate'])
north.setBackgroundEnabled(True)
north.setBackgroundColor(QColor(255, 255, 255, 130))
if self.radioButton_10.isChecked() == 1: if self.radioButton_10.isChecked() == 1:
text_source = ' ' text_source = ' '
@ -674,13 +682,19 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
else: else:
info_text = ["Source : " + self.lineEdit_4.text()][0] info_text = ["Source : " + self.lineEdit_4.text()][0]
# ajout note info: # ajout note info:
info = ["Réalisation : " + "CEN Rhône-Alpes (" + date.today().strftime( if self.radioButton_14.isChecked() == 1:
"%d/%m/%Y") + ")"] 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 = QgsLayoutItemLabel(self.layout)
credit_text.setText(info[0]) credit_text.setText(info[0])
credit_text.setFont(QFont("Calibri", 9)) credit_text.setFont(QFont("Calibri", 9))
credit_text.setHAlign(Qt.AlignRight) credit_text.setHAlign(Qt.AlignRight)
credit_text.setVAlign(Qt.AlignVCenter) credit_text.setVAlign(Qt.AlignVCenter)
credit_text.setBackgroundEnabled(True)
credit_text.setBackgroundColor(QColor(255, 255, 255, 130))
credit_text2 = QgsLayoutItemLabel(self.layout) credit_text2 = QgsLayoutItemLabel(self.layout)
credit_text2.setText(info_text) credit_text2.setText(info_text)
credit_text2.setFont(QFont("Calibri", 9)) credit_text2.setFont(QFont("Calibri", 9))
@ -692,6 +706,8 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
credit_text2.setItemRotation(self.template_parameters['Source_rotate']) credit_text2.setItemRotation(self.template_parameters['Source_rotate'])
credit_text2.attemptResize(self.template_parameters['Source_size']) credit_text2.attemptResize(self.template_parameters['Source_size'])
credit_text2.attemptMove(self.template_parameters['Source_locals']) 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_text)
self.layout.addLayoutItem(credit_text2) self.layout.addLayoutItem(credit_text2)
@ -721,10 +737,13 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
existing_layout = project.layoutManager().layoutByName(self.layout.name()) existing_layout = project.layoutManager().layoutByName(self.layout.name())
if existing_layout: if existing_layout:
self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !","Mise en page existente, la mise en page vas être écraser !",QMessageBox.Yes | QMessageBox.No)
#if self.radioButton_12.isChecked() != 1: #if self.radioButton_12.isChecked() != 1:
project.layoutManager().removeLayout(existing_layout) if self.QMBquestion == QMessageBox.Yes:
project.layoutManager().removeLayout(existing_layout)
result = project.layoutManager().addLayout(self.layout) result = project.layoutManager().addLayout(self.layout)
else:
existing_layout = True
@ -737,8 +756,17 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
fichier_mise_en_page = layout_name fichier_mise_en_page = layout_name
layout_modifie = QgsProject.instance().layoutManager().layoutByName(fichier_mise_en_page) layout_modifie = QgsProject.instance().layoutManager().layoutByName(fichier_mise_en_page)
iface.openLayoutDesigner(layout_modifie) try:
self.close() TryMessage = (self.QMBquestion == QMessageBox.Yes)
del self.QMBquestion
except:
TryMessage = True
print(TryMessage)
if TryMessage == True:
iface.openLayoutDesigner(layout_modifie)
self.close()
else:
self.activateWindow()
def actualisation_mise_en_page(self): def actualisation_mise_en_page(self):
values_page = self.comboBox.currentText() values_page = self.comboBox.currentText()
@ -770,7 +798,6 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
bar_echelle.setUnits(QgsUnitTypes.DistanceKilometers) bar_echelle.setUnits(QgsUnitTypes.DistanceKilometers)
bar_echelle.setUnitLabel("km") bar_echelle.setUnitLabel("km")
bar_echelle.setUnitsPerSegment(round((echelle.scale()*0.04)/1000)) bar_echelle.setUnitsPerSegment(round((echelle.scale()*0.04)/1000))
else: else:
bar_echelle.setUnits(QgsUnitTypes.DistanceMeters) bar_echelle.setUnits(QgsUnitTypes.DistanceMeters)
bar_echelle.setUnitLabel("m") bar_echelle.setUnitLabel("m")

View File

@ -6,7 +6,7 @@
name=CenRa_AutoMap name=CenRa_AutoMap
qgisMinimumVersion=3.0 qgisMinimumVersion=3.0
description=CenRa_AutoMap description=CenRa_AutoMap
version=0.1.10 version=1.0
author=Conservatoire d'Espaces Naturels de Rhône-Alpes author=Conservatoire d'Espaces Naturels de Rhône-Alpes
email=si_besoin@cen-rhonealpes.fr email=si_besoin@cen-rhonealpes.fr
@ -21,7 +21,7 @@ tracker=https://gitea.cenra-outils.org/api/v1/repos/CEN-RA/Plugin_QGIS/issues
hasProcessingProvider=no hasProcessingProvider=no
# Uncomment the following line and add your changelog: # Uncomment the following line and add your changelog:
changelog=<h2>CenRa_AutoMap:</h2></br><p><h3>13/01/2025 - Version 0.1.10: </h3> - Correctif.</br></p></br><p><h3>07/01/2025 - Version 0.1.9: </h3> - ByPass du certif ssl ci erreur.</br></p><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> changelog=<h2>CenRa_AutoMap:</h2></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 are comma separated with spaces allowed
tags=python tags=python

View File

@ -93,9 +93,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>20</x>
<y>70</y> <y>50</y>
<width>391</width> <width>391</width>
<height>611</height> <height>631</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
@ -305,7 +305,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>40</x>
<y>470</y> <y>490</y>
<width>290</width> <width>290</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -342,7 +342,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>30</x>
<y>450</y> <y>470</y>
<width>161</width> <width>161</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -485,7 +485,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>270</x> <x>270</x>
<y>570</y> <y>590</y>
<width>82</width> <width>82</width>
<height>15</height> <height>15</height>
</rect> </rect>
@ -621,7 +621,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>40</x> <x>40</x>
<y>530</y> <y>550</y>
<width>310</width> <width>310</width>
<height>20</height> <height>20</height>
</rect> </rect>
@ -658,7 +658,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>30</x>
<y>510</y> <y>530</y>
<width>111</width> <width>111</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -681,7 +681,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>340</x> <x>340</x>
<y>470</y> <y>490</y>
<width>42</width> <width>42</width>
<height>21</height> <height>21</height>
</rect> </rect>
@ -697,7 +697,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>30</x> <x>30</x>
<y>560</y> <y>580</y>
<width>111</width> <width>111</width>
<height>23</height> <height>23</height>
</rect> </rect>
@ -706,6 +706,52 @@
<string>Custom Bibliotheque</string> <string>Custom Bibliotheque</string>
</property> </property>
</widget> </widget>
<widget class="QRadioButton" name="radioButton_14">
<property name="geometry">
<rect>
<x>50</x>
<y>440</y>
<width>121</width>
<height>21</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>7</pointsize>
</font>
</property>
<property name="text">
<string>Prénom Nom</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_5">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>140</x>
<y>440</y>
<width>201</width>
<height>21</height>
</rect>
</property>
<property name="text">
<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>
<zorder>label_14</zorder> <zorder>label_14</zorder>
<zorder>label_8</zorder> <zorder>label_8</zorder>
<zorder>label_7</zorder> <zorder>label_7</zorder>
@ -728,6 +774,8 @@
<zorder>lineEdit_3</zorder> <zorder>lineEdit_3</zorder>
<zorder>lineEdit_4</zorder> <zorder>lineEdit_4</zorder>
<zorder>lineEdit_2</zorder> <zorder>lineEdit_2</zorder>
<zorder>radioButton_14</zorder>
<zorder>lineEdit_5</zorder>
</widget> </widget>
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="geometry"> <property name="geometry">

View File

@ -85,9 +85,9 @@
<tags>cenra,metabase</tags> <tags>cenra,metabase</tags>
</pyqgis_plugin> </pyqgis_plugin>
<pyqgis_plugin name="CenRa_AUTOMAP" version="0.1.10"> <pyqgis_plugin name="CenRa_AUTOMAP" version="1.0">
<description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description> <description><![CDATA[Dépôt pour les extensiont QGIS du CEN Rhone-Alpes, sur GitHub.]]></description>
<version>0.1.10</version> <version>1.0</version>
<qgis_minimum_version>3.16</qgis_minimum_version> <qgis_minimum_version>3.16</qgis_minimum_version>
<homepage>https://plateformesig.cenra-outils.org/</homepage> <homepage>https://plateformesig.cenra-outils.org/</homepage>
<file_name>CenRa_AUTOMAP.zip</file_name> <file_name>CenRa_AUTOMAP.zip</file_name>
@ -96,7 +96,7 @@
<download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_AUTOMAP.zip</download_url> <download_url>https://gitea.cenra-outils.org/CEN-RA/Plugin_QGIS/releases/download/latest/CenRa_AUTOMAP.zip</download_url>
<uploaded_by>CEN-Rhone-Alpes</uploaded_by> <uploaded_by>CEN-Rhone-Alpes</uploaded_by>
<create_date>2024-09-25</create_date> <create_date>2024-09-25</create_date>
<update_date>2025-01-13</update_date> <update_date>2025-01-27</update_date>
<experimental>False</experimental> <experimental>False</experimental>
<deprecated>False</deprecated> <deprecated>False</deprecated>
<tags>cenra,mise en page,atlas</tags> <tags>cenra,mise en page,atlas</tags>