flake8
This commit is contained in:
parent
1cd816c706
commit
7a3814a429
@ -24,8 +24,9 @@ from pg_metadata.processing.provider import PgMetadataProvider
|
||||
from pg_metadata.qgis_plugin_tools.tools.custom_logging import setup_logger
|
||||
'''
|
||||
import os
|
||||
from qgis.PyQt.QtCore import QSettings
|
||||
from .tools.resources import (
|
||||
plugin_path,
|
||||
# plugin_path,
|
||||
resources_path,
|
||||
pyperclip,
|
||||
maj_verif,
|
||||
@ -37,9 +38,6 @@ from .style_invoke import AutoMap_Style
|
||||
from .about_form import AboutDialog
|
||||
|
||||
|
||||
from qgis.PyQt.QtCore import *
|
||||
|
||||
|
||||
class PgAutoMap:
|
||||
def __init__(self):
|
||||
""" Constructor. """
|
||||
@ -129,6 +127,7 @@ class PgAutoMap:
|
||||
"""
|
||||
dialog = AboutDialog(iface)
|
||||
dialog.exec()
|
||||
|
||||
def open_help():
|
||||
""" Open the online help. """
|
||||
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
|
||||
|
||||
@ -61,8 +61,7 @@ from qgis.PyQt.QtWidgets import (
|
||||
)
|
||||
|
||||
from qgis.PyQt.QtCore import QSettings
|
||||
from qgis.PyQt import QtGui
|
||||
from qgis.PyQt import QtWidgets
|
||||
from qgis.PyQt import QtGui, QtWidgets
|
||||
|
||||
|
||||
from qgis.PyQt.QtXml import QDomDocument
|
||||
@ -71,7 +70,7 @@ import glob
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
send_issues,
|
||||
# send_issues,
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
@ -109,8 +108,8 @@ data_source = [
|
||||
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):
|
||||
|
||||
class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
def __init__(self, parent=None):
|
||||
_ = parent
|
||||
super().__init__()
|
||||
@ -140,13 +139,12 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
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" :
|
||||
# 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", "*.py")):
|
||||
mises_en_page.append(filename)
|
||||
|
||||
|
||||
for i, filename in enumerate(mises_en_page):
|
||||
nom_fichier = os.path.basename(filename)
|
||||
self.comboBox.addItem(nom_fichier)
|
||||
@ -204,8 +202,10 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
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 = []
|
||||
@ -237,16 +237,20 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
try:
|
||||
layout_subtitle = project_subtitle.layoutManager().layoutByName(self.comboBox_7.currentText())
|
||||
self.lineEdit_3.setText(layout_subtitle.itemById("SubTitle").text())
|
||||
except:
|
||||
except NameError:
|
||||
print("")
|
||||
|
||||
def load_ortho(self):
|
||||
global myGroup, last_group
|
||||
runing = False
|
||||
try: myGroup
|
||||
except NameError: runing = True
|
||||
try: last_group
|
||||
except NameError: last_group = ''
|
||||
try:
|
||||
myGroup
|
||||
except NameError:
|
||||
runing = True
|
||||
try:
|
||||
last_group
|
||||
except NameError:
|
||||
last_group = ''
|
||||
if runing or (last_group != '' and last_group != 'ortho'):
|
||||
layername = False
|
||||
layerAll = QgsProject.instance().layerTreeRoot().children()
|
||||
@ -287,10 +291,14 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
def load_osm(self):
|
||||
global myGroup, last_group
|
||||
runing = False
|
||||
try: myGroup
|
||||
except NameError: runing = True
|
||||
try: last_group
|
||||
except NameError: last_group = ''
|
||||
try:
|
||||
myGroup
|
||||
except NameError:
|
||||
runing = True
|
||||
try:
|
||||
last_group
|
||||
except NameError:
|
||||
last_group = ''
|
||||
if runing or (last_group != '' and last_group != 'osm'):
|
||||
layername = False
|
||||
layerAll = QgsProject.instance().layerTreeRoot().children()
|
||||
@ -365,6 +373,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.show_map()
|
||||
else:
|
||||
self.hide_map()
|
||||
|
||||
def show_map(self):
|
||||
self.groupBox_3.setEnabled(True)
|
||||
self.groupBox_3.show()
|
||||
@ -378,6 +387,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.show_titre()
|
||||
else:
|
||||
self.hide_titre()
|
||||
|
||||
def show_titre(self):
|
||||
self.lineEdit_2.setEnabled(False)
|
||||
self.lineEdit_2.hide()
|
||||
@ -395,6 +405,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.show_source()
|
||||
else:
|
||||
self.hide_source()
|
||||
|
||||
def show_source(self):
|
||||
self.lineEdit_4.setEnabled(False)
|
||||
self.lineEdit_4.hide()
|
||||
@ -455,7 +466,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
try:
|
||||
cutLayout = layout_name.index("¶")
|
||||
except:
|
||||
except NameError:
|
||||
cutLayout = 0
|
||||
|
||||
if cutLayout >= 1:
|
||||
@ -473,11 +484,12 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
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":
|
||||
# os.path.basename(filename) == "1. Modèle carto standard (consolidé).qpt":
|
||||
if True:
|
||||
|
||||
self.actualisation_mise_en_page()
|
||||
|
||||
## Add map to layout
|
||||
# Add map to layout
|
||||
self.map_modele_test = QgsLayoutItemMap(self.layout)
|
||||
# Charger une carte vide
|
||||
self.map_modele_test.setRect(20, 20, 20, 20)
|
||||
@ -525,7 +537,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.layout.addLayoutItem(self.map_modele_test)
|
||||
self.map_modele_test.setId("carte_principale")
|
||||
|
||||
## Ajout d'un titre à la mise en page
|
||||
# Ajout d'un titre à la mise en page
|
||||
title = QgsLayoutItemLabel(self.layout)
|
||||
self.layout.addLayoutItem(title)
|
||||
titre = titre_layout_name
|
||||
@ -542,8 +554,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
title.setHAlign(Qt.AlignmentFlag(0x0004))
|
||||
title.setVAlign(Qt.AlignmentFlag(0x0080))
|
||||
|
||||
|
||||
## Ajout d'un sous titre à la mise en page
|
||||
# Ajout d'un sous titre à la mise en page
|
||||
subtitle = QgsLayoutItemLabel(self.layout)
|
||||
self.layout.addLayoutItem(subtitle)
|
||||
titre = self.lineEdit_3.text()
|
||||
@ -561,8 +572,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
subtitle.setHAlign(Qt.AlignmentFlag(0x0004))
|
||||
subtitle.setVAlign(Qt.AlignmentFlag(0x0080))
|
||||
|
||||
|
||||
## Ajout du logo CEN NA en haut à gauche de la page
|
||||
# Ajout du logo CEN NA en haut à gauche de la page
|
||||
logo = QgsLayoutItemPicture(self.layout)
|
||||
logo.setResizeMode(QgsLayoutItemPicture.Zoom)
|
||||
logo.setMode(QgsLayoutItemPicture.FormatRaster)
|
||||
@ -573,8 +583,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
logo.setId('logo')
|
||||
self.layout.addLayoutItem(logo)
|
||||
|
||||
|
||||
## Ajout de la legende :
|
||||
# Ajout de la legende :
|
||||
legend = QgsLayoutItemLegend(self.layout)
|
||||
|
||||
legend.setId('legende_model1')
|
||||
@ -619,7 +628,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
layertreelayer = root.findLayer(layer.id())
|
||||
|
||||
# get the parent of the layer tree layer (layer tree root, or group)
|
||||
if layertreelayer != None:
|
||||
if layertreelayer is not None:
|
||||
parent = layertreelayer.parent()
|
||||
|
||||
# if the parent is a group and has a name, find it and remove the layer
|
||||
@ -630,7 +639,6 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
else:
|
||||
root_group.removeLayer(layer)
|
||||
|
||||
|
||||
legend.setEqualColumnWidth(True)
|
||||
legend.setSplitLayer(True)
|
||||
legend.setColumnSpace(5)
|
||||
@ -647,7 +655,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
legend.updateLegend()
|
||||
legend.attemptMove(self.template_parameters['Legande_locals'])
|
||||
|
||||
## Ajout de l'échelle numeric à la mise en page
|
||||
# Ajout de l'échelle numeric à la mise en page
|
||||
self.scalebarnumeric_qpt = QgsLayoutItemScaleBar(self.layout)
|
||||
self.scalebarnumeric_qpt.setStyle('Numeric')
|
||||
self.scalebarnumeric_qpt.setLinkedMap(self.map_modele_test)
|
||||
@ -667,7 +675,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
self.layout.addLayoutItem(self.scalebarnumeric_qpt)
|
||||
|
||||
## Ajout de l'échelle à la mise en page
|
||||
# Ajout de l'échelle à la mise en page
|
||||
self.scalebar_qpt = QgsLayoutItemScaleBar(self.layout)
|
||||
self.scalebar_qpt.setStyle('Single Box')
|
||||
self.scalebar_qpt.setLinkedMap(self.map_modele_test)
|
||||
@ -736,7 +744,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.layout.addLayoutItem(credit_text)
|
||||
self.layout.addLayoutItem(credit_text2)
|
||||
|
||||
## Ajout du logo credit en bas à droit de la page
|
||||
# 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)
|
||||
@ -792,8 +800,6 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
else:
|
||||
existing_layout = True
|
||||
|
||||
|
||||
|
||||
self.manager.addLayout(self.layout)
|
||||
if self.radioButton_9.isChecked() == 1:
|
||||
self.layout.atlas().setEnabled(True)
|
||||
@ -811,10 +817,10 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
else:
|
||||
TryMessage = False
|
||||
del self.QMBquestion
|
||||
except:
|
||||
except NameError:
|
||||
TryMessage = True
|
||||
|
||||
if TryMessage == True:
|
||||
if TryMessage is True:
|
||||
iface.openLayoutDesigner(layout_modifie)
|
||||
self.close()
|
||||
else:
|
||||
@ -844,7 +850,6 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
eval("exec('self.template_parameters = '+ values_page_import + '.fletch_canvas(self)')")
|
||||
|
||||
def bar_echelle_auto(self, echelle, bar_echelle):
|
||||
|
||||
if True:
|
||||
if echelle.scale() >= 40000:
|
||||
bar_echelle.setUnits(QgsUnitTypes.DistanceKilometers)
|
||||
|
||||
@ -1,10 +1,4 @@
|
||||
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 (
|
||||
@ -35,14 +29,20 @@ from qgis.utils import iface
|
||||
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
# resources_path,
|
||||
send_issues,
|
||||
)
|
||||
|
||||
plugin_dir = os.path.dirname(__file__)
|
||||
end_find = plugin_dir.rfind('\\') + 1
|
||||
|
||||
NAME = plugin_dir[end_find:]
|
||||
# print(NAME)
|
||||
|
||||
EDITOR_CLASS = load_ui('CenRa_IssuesSend.ui')
|
||||
|
||||
class CenRa_Issues(QDialog, EDITOR_CLASS):
|
||||
|
||||
class CenRa_Issues(QDialog, EDITOR_CLASS):
|
||||
def __init__(self, parent=None):
|
||||
_ = parent
|
||||
super().__init__()
|
||||
@ -63,11 +63,16 @@ class CenRa_Issues(QDialog, EDITOR_CLASS):
|
||||
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 statu_bug is True:
|
||||
statu = statu + [1]
|
||||
if statu_aide is True:
|
||||
statu = statu + [3]
|
||||
if statu_question is True:
|
||||
statu = statu + [5]
|
||||
if statu_amelioration is True:
|
||||
statu = statu + [2]
|
||||
if statu_autre is True:
|
||||
statu = statu + [6]
|
||||
|
||||
if len(statu) >= 1:
|
||||
import qgis
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user