From 4851339008b28fe5892d633fcf4ce328236a4caf Mon Sep 17 00:00:00 2001 From: Tom LAVEILLE Date: Mon, 21 Jul 2025 11:27:11 +0200 Subject: [PATCH] Fix Erreur sur QMessageBox --- CenRa_FLUX/flux_editor.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/CenRa_FLUX/flux_editor.py b/CenRa_FLUX/flux_editor.py index d0c3e58..18db1d6 100644 --- a/CenRa_FLUX/flux_editor.py +++ b/CenRa_FLUX/flux_editor.py @@ -11,10 +11,14 @@ from qgis.PyQt.QtCore import QSettings from qgis.PyQt import QtWidgets from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog from qgis.PyQt.QtGui import QIcon - -from qgis.PyQt.QtCore import * -from qgis.PyQt.QtGui import * -from qgis.PyQt import QtGui +try: + from PyQt5.QtCore import * + from PyQt5.QtGui import * + from PyQt5 import QtGui +except: + from PyQt6.QtCore import * + from PyQt6.QtGui import * + from PyQt6 import QtGui from qgis.core import * from qgis.core import QgsDataSourceUri @@ -531,11 +535,11 @@ var Travaux = L.geoJSON(TravauxJSON,{ self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !", "Le nombre de flux à charger en une seule fois est limité à 5 pour des questions de performances. Souhaitez vous tout de même charger les " + str( self.tableWidget_2.rowCount()) + " flux sélectionnés ? (risque de plantage de QGIS)", - QMessageBox.Yes | QMessageBox.No) - if self.QMBquestion == QMessageBox.Yes: + QMessageBox.StandardButton(0x00004000)|QMessageBox.StandardButton(0x00010000)) + if self.QMBquestion == QMessageBox.StandardButton(0x00004000): self.chargement_flux() - if self.QMBquestion == QMessageBox.No: + if self.QMBquestion == QMessageBox.StandardButton(0x00001000): print("Annulation du chargement des couches") if self.tableWidget_2.rowCount() <= 5: @@ -623,7 +627,7 @@ var Travaux = L.geoJSON(TravauxJSON,{ # Ajout de la couche au canevas QGIS QgsProject.instance().addMapLayer(layer) else: - self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !","La couche «" + str(self.tableWidget_2.item(row,1).text()) +' '+ str(self.tableWidget_2.item(row,2).text()) + "» ne ce trouve pas dans cette BD !",QMessageBox.Yes) + self.QMBquestion = QMessageBox.question(iface.mainWindow(), u"Attention !","La couche «" + str(self.tableWidget_2.item(row,1).text()) +' '+ str(self.tableWidget_2.item(row,2).text()) + "» ne ce trouve pas dans cette BD !",QMessageBox.StandardButton(0x00004000)) def combobox_custom(self): if dbtype == sigdb: self.toolButton.setEnabled(1)