diff --git a/gn_tools/processing/draw.py b/gn_tools/processing/draw.py index f2aa469..8456364 100644 --- a/gn_tools/processing/draw.py +++ b/gn_tools/processing/draw.py @@ -1,9 +1,9 @@ # Import PyQt libs -from PyQt5.QtCore import ( +from qgis.PyQt.QtCore import ( pyqtSignal, Qt, ) -from PyQt5.QtGui import QColor +from qgis.PyQt.QtGui import QColor # Import PyQgis libs from qgis.core import ( QgsRectangle, @@ -42,7 +42,7 @@ class RectangleFeatureTool(QgsMapTool): # Mouse button pressed. def canvasPressEvent(self, event: QgsMapMouseEvent): - if event.button() == Qt.LeftButton: + if event.button() == Qt.MouseButton(0x00000001): self.start_point = self.toMapCoordinates(event.pos()) self.end_point = self.start_point self.is_left_button_pressed = True @@ -58,7 +58,7 @@ class RectangleFeatureTool(QgsMapTool): # The mouse button is released. def canvasReleaseEvent(self, event: QgsMapMouseEvent): # if the left mouse button was released - if event.button() == Qt.LeftButton: + if event.button() == Qt.MouseButton(0x00000001): if event.type() == 3: # get the rectangle created from the click point and # left mouse button release points diff --git a/gn_tools/processing/filter_synthese.py b/gn_tools/processing/filter_synthese.py index 341dbb6..a3e3c6a 100644 --- a/gn_tools/processing/filter_synthese.py +++ b/gn_tools/processing/filter_synthese.py @@ -77,15 +77,15 @@ class GetFilterFromAPI(QDialog): self._pending_downloads -= 1 # If reply is an error or reply is a redirection, login is not accepted print(reply.attribute( - QNetworkRequest.HttpStatusCodeAttribute + QNetworkRequest.Attribute(0) )) print(reply.error(),' : ',reply.dtype) self.network_manager.cookieStatus = reply.attribute( - QNetworkRequest.HttpStatusCodeAttribute + QNetworkRequest.Attribute(0) ) QApplication.restoreOverrideCursor() if ( - reply.error() != QNetworkReply.NoError + reply.error() != QNetworkReply.NetworkError(0) or self.network_manager.cookieStatus != 200 ): # Error code 299 means the logins are invalid @@ -126,7 +126,7 @@ class GetFilterFromAPI(QDialog): def get_jdd(self): self._pending_downloads += 1 - QApplication.setOverrideCursor(Qt.WaitCursor) + QApplication.setOverrideCursor(Qt.CursorShape(3)) self.dlg.jdd_box.setEnabled(True) url_api = self.domain_url + 'api/meta/datasets?' @@ -142,7 +142,7 @@ class GetFilterFromAPI(QDialog): def get_phylog(self): self._pending_downloads += 2 - QApplication.setOverrideCursor(Qt.WaitCursor) + QApplication.setOverrideCursor(Qt.CursorShape(3)) self.dlg.regne.setEnabled(True) if self.parent.src_name == 'GéoNature': @@ -154,7 +154,7 @@ class GetFilterFromAPI(QDialog): def get_taxon_tree(self): - QApplication.setOverrideCursor(Qt.WaitCursor) + QApplication.setOverrideCursor(Qt.CursorShape(3)) if self.parent.src_name == 'GéoNature': url_api = self.tax_url + 'api/synthese/taxons_tree' @@ -170,8 +170,8 @@ class GetFilterFromAPI(QDialog): def send_request(self,url,type_request,type_param): print(url) request = QNetworkRequest(url) - request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") - request.setHeader(QNetworkRequest.CookieHeader, self.cookie) + request.setHeader(QNetworkRequest.KnownHeaders(0), "application/json") + request.setHeader(QNetworkRequest.KnownHeaders(4), self.cookie) if type_request == 'GET': reply = self.network_manager.get(request) elif type_request == 'POST':