flake8 automap
This commit is contained in:
parent
9b7ab9ab15
commit
133e785568
@ -4,9 +4,9 @@ __email__ = "info@3liz.org"
|
||||
|
||||
|
||||
from qgis.core import QgsApplication
|
||||
from qgis.PyQt.QtCore import QCoreApplication, Qt, QTranslator, QUrl
|
||||
from qgis.PyQt.QtCore import Qt, QUrl
|
||||
from qgis.PyQt.QtGui import QDesktopServices, QIcon
|
||||
from qgis.PyQt.QtWidgets import QAction, QMessageBox
|
||||
from qgis.PyQt.QtWidgets import QAction
|
||||
from qgis.utils import iface
|
||||
import qgis
|
||||
|
||||
@ -25,6 +25,7 @@ from pg_metadata.qgis_plugin_tools.tools.custom_logging import setup_logger
|
||||
'''
|
||||
import os
|
||||
from qgis.PyQt.QtCore import QSettings
|
||||
from .about_form import AboutDialog
|
||||
from .tools.resources import (
|
||||
# plugin_path,
|
||||
resources_path,
|
||||
@ -35,7 +36,6 @@ pyperclip()
|
||||
|
||||
from .canvas_editor import AutoMap_Editor
|
||||
from .style_invoke import AutoMap_Style
|
||||
from .about_form import AboutDialog
|
||||
|
||||
|
||||
class PgAutoMap:
|
||||
@ -88,39 +88,6 @@ class PgAutoMap:
|
||||
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)
|
||||
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
|
||||
|
||||
@ -3,7 +3,7 @@ import os.path
|
||||
from pathlib import Path
|
||||
|
||||
from qgis.PyQt import uic
|
||||
from qgis.PyQt.QtGui import QPixmap
|
||||
# from qgis.PyQt.QtGui import QPixmap
|
||||
from qgis.PyQt.QtWidgets import QDialog
|
||||
|
||||
from .tools.resources import devlog
|
||||
|
||||
@ -1,79 +1,41 @@
|
||||
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,
|
||||
)
|
||||
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.QtCore import Qt
|
||||
from qgis.PyQt.QtGui import QColor, QFont
|
||||
from qgis.PyQt.QtWidgets import (
|
||||
QDialog,
|
||||
QAction,
|
||||
QMessageBox,
|
||||
QPushButton,
|
||||
QDockWidget,
|
||||
QFileDialog,
|
||||
QInputDialog,
|
||||
QMenu,
|
||||
QToolButton,
|
||||
QTableWidget,
|
||||
QTableWidgetItem,
|
||||
QVBoxLayout,
|
||||
)
|
||||
|
||||
from qgis.PyQt.QtCore import QSettings
|
||||
from qgis.PyQt import QtGui, QtWidgets
|
||||
|
||||
|
||||
from qgis.PyQt import QtGui
|
||||
from qgis.PyQt.QtXml import QDomDocument
|
||||
from qgis.utils import iface
|
||||
import glob
|
||||
from .tools.resources import (
|
||||
load_ui,
|
||||
resources_path,
|
||||
# send_issues,
|
||||
)
|
||||
from .issues import CenRa_Issues
|
||||
|
||||
from datetime import date
|
||||
|
||||
EDITOR_CLASS = load_ui('CenRa_AutoMap_base.ui')
|
||||
@ -210,11 +172,11 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
self.mComboBox_4.clear()
|
||||
logo_library = []
|
||||
custome_bibliotech = glob.glob(self.s.value("automap/logoteck", 1, type=str) + '*.*')
|
||||
for l, logo_x in enumerate(custome_bibliotech):
|
||||
for number, logo_x in enumerate(custome_bibliotech):
|
||||
logo_library.append(' ' + os.path.basename(logo_x))
|
||||
|
||||
bibliotech = glob.glob(resources_path("logo_library", "*.png"))
|
||||
for l, logo_x in enumerate(bibliotech):
|
||||
for number, logo_x in enumerate(bibliotech):
|
||||
logo_library.append(os.path.basename(logo_x))
|
||||
self.mComboBox_4.addItems(sorted(logo_library))
|
||||
|
||||
@ -452,13 +414,13 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
layout_name = self.comboBox_7.currentText()
|
||||
else:
|
||||
layout_name = self.lineEdit_2.text()
|
||||
layouts_list = self.manager.printLayouts()
|
||||
# layouts_list = self.manager.printLayouts()
|
||||
|
||||
for filename in glob.glob(resources_path("mises_en_pages", "*.qpt")):
|
||||
with open(os.path.join(os.getcwd(), filename), 'r') as f:
|
||||
self.layout = QgsPrintLayout(project)
|
||||
self.layout.initializeDefaults()
|
||||
myAtlas = self.layout.atlas()
|
||||
# myAtlas = self.layout.atlas()
|
||||
template_content = f.read()
|
||||
doc = QDomDocument()
|
||||
doc.setContent(template_content)
|
||||
@ -466,7 +428,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
|
||||
try:
|
||||
cutLayout = layout_name.index("¶")
|
||||
except:
|
||||
except ValueError:
|
||||
cutLayout = 0
|
||||
|
||||
if cutLayout >= 1:
|
||||
@ -782,7 +744,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
# if self.radioButton_12.isChecked() != 1:
|
||||
if self.QMBquestion == QMessageBox.StandardButton(0x00004000):
|
||||
project.layoutManager().removeLayout(existing_layout)
|
||||
result = project.layoutManager().addLayout(self.layout)
|
||||
# result = project.layoutManager().addLayout(self.layout)
|
||||
elif self.QMBquestion != QMessageBox.StandardButton(0x00010000):
|
||||
LayoutCOUNT = 0
|
||||
arrayManager = []
|
||||
@ -817,7 +779,7 @@ class AutoMap_Editor(QDialog, EDITOR_CLASS):
|
||||
else:
|
||||
TryMessage = False
|
||||
del self.QMBquestion
|
||||
except:
|
||||
except ValueError:
|
||||
TryMessage = True
|
||||
|
||||
if TryMessage is True:
|
||||
|
||||
@ -11,7 +11,7 @@ from qgis.utils import iface
|
||||
import qgis
|
||||
|
||||
# include <QSettings>
|
||||
|
||||
from .about_form import AboutDialog
|
||||
import os
|
||||
from .tools.resources import (
|
||||
pyperclip,
|
||||
@ -21,7 +21,6 @@ from .tools.resources import (
|
||||
pyperclip()
|
||||
|
||||
from .flux_editor import Flux_Editor
|
||||
from .about_form import AboutDialog
|
||||
|
||||
|
||||
class PgFlux:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user