Plugin PyQt5 and PyQt6 compatible & CenRa_Copie bug fix

This commit is contained in:
2025-05-19 14:00:58 +02:00
parent 3b0758ea5c
commit 3ef37aa696
37 changed files with 434 additions and 321 deletions
+15 -9
View File
@@ -11,9 +11,15 @@ 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 PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5 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
from qgis.PyQt.QtWidgets import (
@@ -196,8 +202,8 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.commandLinkButton.setIcon(QtGui.QIcon(resources_path('ui','arrow-bottom.png')))
self.commandLinkButton_2.setIcon(QtGui.QIcon(resources_path('ui','arrow-up.png')))
self.tableWidget.setSelectionBehavior(QTableWidget.SelectRows)
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
#self.tableWidget.setSelectionBehavior(QTableWidget.selectRow)
self.tableWidget.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger(0))
self.toolButton.setIcon(QtGui.QIcon(resources_path('ui','find.png')))
self.comboBox_2.addItem("SIG")
self.comboBox_2.addItem('REF')
@@ -213,7 +219,7 @@ class Flux_Editor(QDialog, EDITOR_CLASS):
self.toolButton.clicked.connect(self.getCanevas)
layout = QVBoxLayout()
self.lineEdit.textChanged.connect(self.filtre_dynamique)
self.viewer.titleChanged.connect(self.NewTitle)
self.viewer.textChanged.connect(self.NewTitle)
layout.addWidget(self.lineEdit)
self.viewer.hide()
self.DeBUG.addItem('')
@@ -392,7 +398,7 @@ var Travaux = L.geoJSON(TravauxJSON,{
# show the dialog
self.show()
# Run the dialog event loop
result = self.exec_()
result = self.exec()
# See if OK was pressed
if result:
# Do something useful here - delete the line containing pass and
@@ -416,7 +422,7 @@ var Travaux = L.geoJSON(TravauxJSON,{
# show the dialog
self.show()
# Run the dialog event loop
result = self.exec_()
result = self.exec()
# See if OK was pressed
if result:
# Do something useful here - delete the line containing pass and
@@ -516,7 +522,7 @@ var Travaux = L.geoJSON(TravauxJSON,{
def item_already_exists(self, new_item_text):
# Assuming you want to compare items in the first column for uniqueness
existing_items = self.tableWidget_2.findItems(new_item_text, QtCore.Qt.MatchExactly)
existing_items = self.tableWidget_2.findItems(new_item_text, QtCore.Qt.MatchFlag(0))
# Check if there are any existing items with the same text in the first column
return len(existing_items) > 0