diff --git a/swiss_locator/core/filters/swiss_locator_filter.py b/swiss_locator/core/filters/swiss_locator_filter.py index b763123..ee5669e 100644 --- a/swiss_locator/core/filters/swiss_locator_filter.py +++ b/swiss_locator/core/filters/swiss_locator_filter.py @@ -24,11 +24,11 @@ import sys import traceback -from PyQt5.QtCore import Qt, QTimer -from PyQt5.QtGui import QColor -from PyQt5.QtWidgets import QLabel, QWidget, QTabWidget -from PyQt5.QtCore import QUrl, pyqtSignal, QEventLoop -from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply, QNetworkAccessManager +from qgis.PyQt.QtCore import Qt, QTimer +from qgis.PyQt.QtGui import QColor +from qgis.PyQt.QtWidgets import QLabel, QWidget, QTabWidget +from qgis.PyQt.QtCore import QUrl, pyqtSignal, QEventLoop +from qgis.PyQt.QtNetwork import QNetworkRequest, QNetworkReply, QNetworkAccessManager from qgis.core import ( Qgis, @@ -120,7 +120,7 @@ def __init__( self.minimum_search_length = 2 self.nam = QNetworkAccessManager() - self.nam.setRedirectPolicy(QNetworkRequest.NoLessSafeRedirectPolicy) + self.nam.setRedirectPolicy(QNetworkRequest.RedirectPolicy.NoLessSafeRedirectPolicy) self.network_replies = dict() if crs: @@ -133,20 +133,20 @@ def __init__( self.map_canvas = iface.mapCanvas() self.map_canvas.destinationCrsChanged.connect(self.create_transforms) - self.rubber_band = QgsRubberBand(self.map_canvas, QgsWkbTypes.PointGeometry) + self.rubber_band = QgsRubberBand(self.map_canvas, QgsWkbTypes.GeometryType.PointGeometry) self.rubber_band.setColor(QColor(255, 255, 50, 200)) self.rubber_band.setIcon(self.rubber_band.ICON_CIRCLE) self.rubber_band.setIconSize(15) self.rubber_band.setWidth(4) - self.rubber_band.setBrushStyle(Qt.NoBrush) + self.rubber_band.setBrushStyle(Qt.BrushStyle.NoBrush) self.feature_rubber_band = QgsRubberBand( - self.map_canvas, QgsWkbTypes.PolygonGeometry + self.map_canvas, QgsWkbTypes.GeometryType.PolygonGeometry ) self.feature_rubber_band.setColor(QColor(255, 50, 50, 200)) self.feature_rubber_band.setFillColor(QColor(255, 255, 50, 160)) - self.feature_rubber_band.setBrushStyle(Qt.SolidPattern) - self.feature_rubber_band.setLineStyle(Qt.SolidLine) + self.feature_rubber_band.setBrushStyle(Qt.BrushStyle.SolidPattern) + self.feature_rubber_band.setLineStyle(Qt.PenStyle.SolidLine) self.feature_rubber_band.setWidth(4) self.create_transforms() @@ -170,8 +170,8 @@ def prefix(self): ) def clearPreviousResults(self): - self.rubber_band.reset(QgsWkbTypes.PointGeometry) - self.feature_rubber_band.reset(QgsWkbTypes.PolygonGeometry) + self.rubber_band.reset(QgsWkbTypes.GeometryType.PointGeometry) + self.feature_rubber_band.reset(QgsWkbTypes.GeometryType.PolygonGeometry) if self.map_tip is not None: del self.map_tip self.map_tip = None @@ -185,10 +185,10 @@ def hasConfigWidget(self): def openConfigWidget(self, parent=None): dlg = ConfigDialog(parent) - wid = dlg.findChild(QTabWidget, "tabWidget", Qt.FindDirectChildrenOnly) + wid = dlg.findChild(QTabWidget, "tabWidget", Qt.FindChildOption.FindDirectChildrenOnly) tab = wid.findChild(QWidget, self.type.value) wid.setCurrentWidget(tab) - dlg.exec_() + dlg.exec() def create_transforms(self): # this should happen in the main thread @@ -249,7 +249,7 @@ def handle_reply(self, url: str, feedback: QgsFeedback, slot, data=None): reply = self.network_replies[url] try: - if reply.error() != QNetworkReply.NoError: + if reply.error() != QNetworkReply.NetworkError.NoError: self.info(f"could not load url: {reply.errorString()}") else: content = reply.readAll().data().decode("utf-8") @@ -259,16 +259,16 @@ def handle_reply(self, url: str, feedback: QgsFeedback, slot, data=None): slot(content, feedback) except Exception as e: - self.info(e, Qgis.Critical) + self.info(e, Qgis.MessageLevel.Critical) exc_type, exc_obj, exc_traceback = sys.exc_info() filename = os.path.split(exc_traceback.tb_frame.f_code.co_filename)[1] self.info( "{} {} {}".format(exc_type, filename, exc_traceback.tb_lineno), - Qgis.Critical, + Qgis.MessageLevel.Critical, ) self.info( traceback.print_exception(exc_type, exc_obj, exc_traceback), - Qgis.Critical, + Qgis.MessageLevel.Critical, ) # clean nam @@ -306,7 +306,7 @@ def fetch_requests( # Let the requests end and catch all exceptions (and clean up requests) if len(self.network_replies) > 0: - self.event_loop.exec_(QEventLoop.ExcludeUserInputEvents) + self.event_loop.exec(QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents) def fetchResults( self, search: str, context: QgsLocatorContext, feedback: QgsFeedback @@ -327,16 +327,16 @@ def fetchResults( self.resultFetched.emit(result) except Exception as e: - self.info(e, Qgis.Critical) + self.info(e, Qgis.MessageLevel.Critical) exc_type, exc_obj, exc_traceback = sys.exc_info() filename = os.path.split(exc_traceback.tb_frame.f_code.co_filename)[1] self.info( "{} {} {}".format(exc_type, filename, exc_traceback.tb_lineno), - Qgis.Critical, + Qgis.MessageLevel.Critical, ) self.info( traceback.print_exception(exc_type, exc_obj, exc_traceback), - Qgis.Critical, + Qgis.MessageLevel.Critical, ) def triggerResult(self, result: QgsLocatorResult): @@ -354,7 +354,7 @@ def triggerResult(self, result: QgsLocatorResult): self.tr( "QGIS Swiss Locator encountered an error. Please update to QGIS 3.16.2 or newer." ), - Qgis.Warning, + Qgis.MessageLevel.Warning, None, ) return @@ -383,8 +383,8 @@ def triggerResult(self, result: QgsLocatorResult): self.info(f"Loading layer: {url_with_params}") ch_layer = QgsRasterLayer(url_with_params, result.displayString, "wms") label = QLabel() - label.setTextFormat(Qt.RichText) - label.setTextInteractionFlags(Qt.TextBrowserInteraction) + label.setTextFormat(Qt.TextFormat.RichText) + label.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction) label.setOpenExternalLinks(True) if "geo.admin.ch" in swiss_result.url.lower(): @@ -402,7 +402,7 @@ def triggerResult(self, result: QgsLocatorResult): swiss_result.title, swiss_result.layer ) ) - level = Qgis.Warning + level = Qgis.MessageLevel.Warning self.info(msg, level) else: msg = self.tr( @@ -410,7 +410,7 @@ def triggerResult(self, result: QgsLocatorResult): swiss_result.title, swiss_result.layer ) ) - level = Qgis.Info + level = Qgis.MessageLevel.Info QgsProject.instance().addMapLayer(ch_layer) @@ -447,7 +447,7 @@ def triggerResult(self, result: QgsLocatorResult): swiss_result.title ) ) - level = Qgis.Warning + level = Qgis.MessageLevel.Warning self.info(msg, level) else: ch_layer.setLabelsEnabled(True) @@ -463,7 +463,7 @@ def triggerResult(self, result: QgsLocatorResult): "; ".join([sublayer.name() for sublayer in sublayers]) ) ) - level = Qgis.Info + level = Qgis.MessageLevel.Info self.info(msg, level) if error or warnings: msg = self.tr( @@ -473,7 +473,7 @@ def triggerResult(self, result: QgsLocatorResult): "; ".join(warnings) ) ) - level = Qgis.Warning + level = Qgis.MessageLevel.Warning self.info(msg, level) msg = self.tr( @@ -481,7 +481,7 @@ def triggerResult(self, result: QgsLocatorResult): swiss_result.title ) ) - level = Qgis.Info + level = Qgis.MessageLevel.Info self.info(msg, level) # Load basemap layers at the bottom of the layer tree @@ -546,14 +546,14 @@ def parse_map_tip_response(self, content, feedback, point): def highlight(self, point, bbox=None): if bbox is None: bbox = point - self.rubber_band.reset(QgsWkbTypes.PointGeometry) + self.rubber_band.reset(QgsWkbTypes.GeometryType.PointGeometry) self.rubber_band.addGeometry(point, None) rect = bbox.boundingBox() rect.scale(1.1) self.map_canvas.setExtent(rect) self.map_canvas.refresh() - def info(self, msg="", level=Qgis.Info): + def info(self, msg="", level=Qgis.MessageLevel.Info): self.logMessage(str(msg), level) def dbg_info(self, msg=""): diff --git a/swiss_locator/core/filters/swiss_locator_filter_feature.py b/swiss_locator/core/filters/swiss_locator_filter_feature.py index dfe60cd..fd1085c 100644 --- a/swiss_locator/core/filters/swiss_locator_filter_feature.py +++ b/swiss_locator/core/filters/swiss_locator_filter_feature.py @@ -19,7 +19,7 @@ import json -from PyQt5.QtGui import QIcon +from qgis.PyQt.QtGui import QIcon from qgis.core import ( Qgis, @@ -72,7 +72,7 @@ def perform_fetch_results(self, search: str, feedback: QgsFeedback): except IOError: self.info( "Layers data file not found. Please report an issue.", - Qgis.Critical, + Qgis.MessageLevel.Critical, ) self.fetch_requests(requests, feedback, self.handle_content) @@ -96,7 +96,7 @@ def handle_content(self, content: str, feedback: QgsFeedback): f"Layer {layer} is not in the list of searchable layers." " Please report issue." ), - Qgis.Warning, + Qgis.MessageLevel.Warning, ) layer_display = layer result.group = layer_display diff --git a/swiss_locator/core/filters/swiss_locator_filter_location.py b/swiss_locator/core/filters/swiss_locator_filter_location.py index bc57863..7d24e61 100644 --- a/swiss_locator/core/filters/swiss_locator_filter_location.py +++ b/swiss_locator/core/filters/swiss_locator_filter_location.py @@ -99,16 +99,16 @@ def handle_content(self, content: str, feedback: QgsFeedback): self.resultFetched.emit(result) except Exception as e: - self.info(str(e), Qgis.Critical) + self.info(str(e), Qgis.MessageLevel.Critical) exc_type, exc_obj, exc_traceback = sys.exc_info() filename = os.path.split(exc_traceback.tb_frame.f_code.co_filename)[1] self.info( f"{exc_type} {filename} {exc_traceback.tb_lineno}", - Qgis.Critical, + Qgis.MessageLevel.Critical, ) self.info( traceback.print_exception(exc_type, exc_obj, exc_traceback), - Qgis.Critical, + Qgis.MessageLevel.Critical, ) def fetch_feature(self, layer, feature_id): @@ -135,7 +135,7 @@ def parse_feature_response(self, content, feedback: QgsFeedback): geometry = QgsGeometry.fromPolygonXY(rings) geometry.transform(self.transform_ch) - self.feature_rubber_band.reset(QgsWkbTypes.PolygonGeometry) + self.feature_rubber_band.reset(QgsWkbTypes.GeometryType.PolygonGeometry) self.feature_rubber_band.addGeometry(geometry, None) def group_info(self, group: str) -> (str, str): diff --git a/swiss_locator/core/filters/swiss_locator_filter_wmts.py b/swiss_locator/core/filters/swiss_locator_filter_wmts.py index 7592178..5ebd014 100644 --- a/swiss_locator/core/filters/swiss_locator_filter_wmts.py +++ b/swiss_locator/core/filters/swiss_locator_filter_wmts.py @@ -73,7 +73,7 @@ def clone(self): nam.get(request, forceRefresh=True) reply = nam.reply() if ( - reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200 + reply.attribute(QNetworkRequest.Attribute.HttpStatusCodeAttribute) == 200 ): # other codes are handled by NetworkAccessManager self.capabilities = ET.fromstring(reply.content().data().decode("utf8")) else: @@ -100,7 +100,7 @@ def handle_capabilities_response(self): else: self.info( "The Swiss Locator filter for WMTS layers could not fetch capabilities", - Qgis.Critical + Qgis.MessageLevel.Critical ) def perform_fetch_results(self, search: str, feedback: QgsFeedback): diff --git a/swiss_locator/core/language.py b/swiss_locator/core/language.py index 2f00b9e..ad3712a 100644 --- a/swiss_locator/core/language.py +++ b/swiss_locator/core/language.py @@ -24,7 +24,7 @@ # # --------------------------------------------------------------------- -from PyQt5.QtCore import QLocale, QSettings +from qgis.PyQt.QtCore import QLocale, QSettings from .settings import Settings from qgis.core import NULL diff --git a/swiss_locator/core/profiles/profile_generator.py b/swiss_locator/core/profiles/profile_generator.py index 29b2749..aa9ee36 100644 --- a/swiss_locator/core/profiles/profile_generator.py +++ b/swiss_locator/core/profiles/profile_generator.py @@ -64,7 +64,7 @@ def __get_profile_from_rest_api(self): QgsMessageLog.logMessage( "Unable to parse results from Profile service. Details: {}".format(e.msg), "Swiss locator", - Qgis.Critical + Qgis.MessageLevel.Critical ) return result @@ -85,7 +85,7 @@ def generateProfile(self, context): # QgsProfileGenerationContext except QgsCsException as e: QgsMessageLog.logMessage("Error transforming profile line to EPSG:2056.", "Swiss locator", - Qgis.Critical) + Qgis.MessageLevel.Critical) return False self.__results = SwissProfileResults() @@ -94,7 +94,7 @@ def generateProfile(self, context): # QgsProfileGenerationContext result = self.__get_profile_from_rest_api() if "error" in result: - QgsMessageLog.logMessage(result["error"], "Swiss locator", Qgis.Critical) + QgsMessageLog.logMessage(result["error"], "Swiss locator", Qgis.MessageLevel.Critical) return False cartesian_d = 0 diff --git a/swiss_locator/core/profiles/profile_results.py b/swiss_locator/core/profiles/profile_results.py index 2790b50..ebc355e 100644 --- a/swiss_locator/core/profiles/profile_results.py +++ b/swiss_locator/core/profiles/profile_results.py @@ -123,8 +123,8 @@ def __render_continuous_surface(self, context): if not painter: return - painter.setBrush(Qt.NoBrush) - painter.setPen(Qt.NoPen) + painter.setBrush(Qt.BrushStyle.NoBrush) + painter.setPen(Qt.PenStyle.NoPen) min_distance = context.distanceRange().lower() max_distance = context.distanceRange().upper() @@ -187,8 +187,8 @@ def __render_markers(self, context): if not painter: return - painter.setBrush(Qt.NoBrush) - painter.setPen(Qt.NoPen) + painter.setBrush(Qt.BrushStyle.NoBrush) + painter.setPen(Qt.PenStyle.NoPen) minDistance = context.distanceRange().lower() maxDistance = context.distanceRange().upper() diff --git a/swiss_locator/core/settings.py b/swiss_locator/core/settings.py index c2889a6..d67e0d1 100644 --- a/swiss_locator/core/settings.py +++ b/swiss_locator/core/settings.py @@ -62,7 +62,7 @@ def __init__(self): Enum( f"{FilterType.Location.value}_priority", Scope.Global, - QgsLocatorFilter.Highest, + QgsLocatorFilter.Priority.Highest, ) ) self.add_setting(Integer(f"{FilterType.Location.value}_limit", Scope.Global, 8)) @@ -70,7 +70,7 @@ def __init__(self): Enum( f"{FilterType.WMTS.value}_priority", Scope.Global, - QgsLocatorFilter.Highest, + QgsLocatorFilter.Priority.Highest, ) ) self.add_setting(Integer(f"{FilterType.WMTS.value}_limit", Scope.Global, 8)) @@ -78,7 +78,7 @@ def __init__(self): Enum( f"{FilterType.VectorTiles.value}_priority", Scope.Global, - QgsLocatorFilter.Medium, + QgsLocatorFilter.Priority.Medium, ) ) self.add_setting(Integer(f"{FilterType.VectorTiles.value}_limit", Scope.Global, 8)) @@ -86,7 +86,7 @@ def __init__(self): Enum( f"{FilterType.Feature.value}_priority", Scope.Global, - QgsLocatorFilter.Highest, + QgsLocatorFilter.Priority.Highest, ) ) self.add_setting(Integer(f"{FilterType.Feature.value}_limit", Scope.Global, 8)) @@ -94,7 +94,7 @@ def __init__(self): Enum( f"{FilterType.Layers.value}_priority", Scope.Global, - QgsLocatorFilter.High, + QgsLocatorFilter.Priority.High, ) ) self.add_setting(Integer(f"{FilterType.Layers.value}_limit", Scope.Global, 5)) diff --git a/swiss_locator/gui/config_dialog.py b/swiss_locator/gui/config_dialog.py index a1d7a20..cab1315 100644 --- a/swiss_locator/gui/config_dialog.py +++ b/swiss_locator/gui/config_dialog.py @@ -22,8 +22,8 @@ """ import os -from PyQt5.QtCore import Qt, pyqtSlot -from PyQt5.QtWidgets import QDialog, QTableWidgetItem, QAbstractItemView, QComboBox +from qgis.PyQt.QtCore import Qt, pyqtSlot +from qgis.PyQt.QtWidgets import QDialog, QTableWidgetItem, QAbstractItemView, QComboBox from qgis.PyQt.uic import loadUiType from qgis.core import QgsLocatorFilter @@ -56,11 +56,11 @@ def __init__(self, parent=None): for filter_type in FilterType: cb = self.findChild(QComboBox, "{}_priority".format(filter_type.value)) if cb is not None: # Some filters might not have a config dialog - cb.addItem(self.tr("Highest"), QgsLocatorFilter.Highest) - cb.addItem(self.tr("High"), QgsLocatorFilter.High) - cb.addItem(self.tr("Medium"), QgsLocatorFilter.Medium) - cb.addItem(self.tr("Low"), QgsLocatorFilter.Low) - cb.addItem(self.tr("Lowest"), QgsLocatorFilter.Lowest) + cb.addItem(self.tr("Highest"), QgsLocatorFilter.Priority.Highest) + cb.addItem(self.tr("High"), QgsLocatorFilter.Priority.High) + cb.addItem(self.tr("Medium"), QgsLocatorFilter.Priority.Medium) + cb.addItem(self.tr("Low"), QgsLocatorFilter.Priority.Low) + cb.addItem(self.tr("Lowest"), QgsLocatorFilter.Priority.Lowest) self.crs.addItem( self.tr("Use map CRS if possible, defaults to CH1903+"), "project" @@ -80,15 +80,15 @@ def __init__(self, parent=None): (self.tr("Layer"), self.tr("Description")) ) self.feature_search_layers_list.setSelectionBehavior( - QAbstractItemView.SelectRows + QAbstractItemView.SelectionBehavior.SelectRows ) self.feature_search_layers_list.setSelectionMode( - QAbstractItemView.SingleSelection + QAbstractItemView.SelectionMode.SingleSelection ) r = 0 for layer, description in layers.items(): item = QTableWidgetItem(layer) - item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) + item.setFlags(Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable) # item.setCheckState(Qt.Unchecked) self.feature_search_layers_list.setItem(r, 0, item) self.feature_search_layers_list.setItem(r, 1, QTableWidgetItem(description)) @@ -107,12 +107,12 @@ def __init__(self, parent=None): def select_all(self, select: bool = True): for r in range(self.feature_search_layers_list.rowCount()): item = self.feature_search_layers_list.item(r, 0) - item.setCheckState(Qt.Checked if select else Qt.Unchecked) + item.setCheckState(Qt.CheckState.Checked if select else Qt.CheckState.Unchecked) @pyqtSlot(str) def filter_rows(self, text: str): if text: - items = self.feature_search_layers_list.findItems(text, Qt.MatchContains) + items = self.feature_search_layers_list.findItems(text, Qt.MatchFlag.MatchContains) print(text) print(len(items)) shown_rows = [] diff --git a/swiss_locator/gui/maptip.py b/swiss_locator/gui/maptip.py index 3b8f190..520446e 100644 --- a/swiss_locator/gui/maptip.py +++ b/swiss_locator/gui/maptip.py @@ -21,17 +21,17 @@ ***************************************************************************/ """ -from PyQt5.QtCore import Qt, QPoint, pyqtSignal -from PyQt5.QtWidgets import QSizePolicy, QDockWidget -from PyQt5.QtGui import QPalette, QDesktopServices, QCloseEvent +from qgis.PyQt.QtCore import Qt, QPoint, pyqtSignal +from qgis.PyQt.QtWidgets import QSizePolicy, QDockWidget +from qgis.PyQt.QtGui import QPalette, QDesktopServices, QCloseEvent from qgis.core import Qgis, QgsPointXY, QgsMessageLog from qgis.gui import QgisInterface from swiss_locator import DEBUG from swiss_locator.gui.qtwebkit_conf import with_qt_web_kit if with_qt_web_kit(): - from PyQt5.QtWebKit import QWebSettings - from PyQt5.QtWebKitWidgets import QWebView, QWebPage + from qgis.PyQt.QtWebKit import QWebSettings + from qgis.PyQt.QtWebKitWidgets import QWebView, QWebPage class MapTip(QDockWidget): @@ -50,7 +50,7 @@ def __init__(self, iface: QgisInterface, html: str, point: QgsPointXY): QWebPage.DelegateAllLinks ) # Handle link clicks by yourself self.web_view.setContextMenuPolicy( - Qt.NoContextMenu + Qt.ContextMenuPolicy.NoContextMenu ) # No context menu is allowed if you don't need it self.web_view.linkClicked.connect(self.on_link_clicked) @@ -61,7 +61,7 @@ def __init__(self, iface: QgisInterface, html: str, point: QgsPointXY): QWebSettings.JavascriptEnabled, True ) - self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) self.setWidget(self.web_view) # assure the map tip is never larger than half the map canvas @@ -82,10 +82,10 @@ def __init__(self, iface: QgisInterface, html: str, point: QgsPointXY): # bg=background_color.name(QColor.HexArgb))) palette = self.web_view.palette() - palette.setBrush(QPalette.Base, Qt.transparent) - palette.setBrush(QPalette.Base, background_color) + palette.setBrush(QPalette.ColorRole.Base, Qt.GlobalColor.transparent) + palette.setBrush(QPalette.ColorRole.Base, background_color) self.web_view.page().setPalette(palette) - self.web_view.setAttribute(Qt.WA_OpaquePaintEvent, False) + self.web_view.setAttribute(Qt.WidgetAttribute.WA_OpaquePaintEvent, False) body_style = "background-color: {bg}; margin: 0".format(bg=background_color) container_style = "display: inline-block; margin: 0px" @@ -114,7 +114,7 @@ def __init__(self, iface: QgisInterface, html: str, point: QgsPointXY): # self.resize(width, height) - iface.addDockWidget(Qt.RightDockWidgetArea, self) + iface.addDockWidget(Qt.DockWidgetArea.RightDockWidgetArea, self) self.setFeatures(QDockWidget.AllDockWidgetFeatures) self.setFloating(True) self.setWindowOpacity(0.9) @@ -135,7 +135,7 @@ def on_link_clicked(self, url): def closeEvent(self, event: QCloseEvent): self.closed.emit() - def info(self, msg="", level=Qgis.Info): + def info(self, msg="", level=Qgis.MessageLevel.Info): QgsMessageLog.logMessage( "{} {}".format(self.__class__.__name__, msg), "Locator bar", level ) diff --git a/swiss_locator/gui/qtwebkit_conf.py b/swiss_locator/gui/qtwebkit_conf.py index 0f58c2b..13513c0 100644 --- a/swiss_locator/gui/qtwebkit_conf.py +++ b/swiss_locator/gui/qtwebkit_conf.py @@ -6,8 +6,8 @@ def with_qt_web_kit() -> bool: global _WITH_QTWEBKIT if _WITH_QTWEBKIT is None: try: - from PyQt5.QtWebKit import QWebSettings - from PyQt5.QtWebKitWidgets import QWebView, QWebPage + from qgis.PyQt.QtWebKit import QWebSettings + from qgis.PyQt.QtWebKitWidgets import QWebView, QWebPage except ModuleNotFoundError: _WITH_QTWEBKIT = False else: diff --git a/swiss_locator/swiss_locator_plugin.py b/swiss_locator/swiss_locator_plugin.py index acb6020..6771926 100644 --- a/swiss_locator/swiss_locator_plugin.py +++ b/swiss_locator/swiss_locator_plugin.py @@ -18,8 +18,8 @@ """ import os -from PyQt5.QtCore import QCoreApplication, QLocale, QSettings, QTranslator -from PyQt5.QtWidgets import QWidget +from qgis.PyQt.QtCore import QCoreApplication, QLocale, QSettings, QTranslator +from qgis.PyQt.QtWidgets import QWidget from qgis.core import Qgis, QgsApplication, QgsMessageLog, NULL from qgis.gui import QgisInterface, QgsMessageBarItem @@ -79,7 +79,7 @@ def initGui(self): QgsMessageLog.logMessage( "Swiss profile source has been registered!", "Swiss locator", - Qgis.Info + Qgis.MessageLevel.Info ) def unload(self): @@ -92,7 +92,7 @@ def unload(self): QgsMessageLog.logMessage( "Swiss profile source has been unregistered!", "Swiss locator", - Qgis.Info + Qgis.MessageLevel.Info ) def show_message(