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
+5 -2
View File
@@ -28,7 +28,10 @@ from .postgis_creator import Postgis_Creator
from .postgis_rename import Postgis_Rename
from .about_form import AboutDialog
from PyQt5.QtCore import *
try:
from PyQt5.QtCore import *
except:
from PyQt6.QtCore import *
IPAddr=socket.gethostbyname(socket.gethostname())
@@ -119,7 +122,7 @@ class PgPostgis:
About dialog
"""
dialog = AboutDialog(iface)
dialog.exec_()
dialog.exec()
def open_help():
""" Open the online help. """
QDesktopServices.openUrl(QUrl('https://plateformesig.cenra-outils.org/'))
+1
View File
@@ -11,6 +11,7 @@
[general]
name=CenRa_POSTGIS
qgisMinimumVersion=3.0
supportsQt6=True
description=Permet de crée un dossier dans la base PostGis
version=2.9
author=Conservatoire d'Espaces Naturels de Rhône-Alpes
+9 -4
View File
@@ -9,9 +9,14 @@ import qgis
from qgis.PyQt.QtCore import QSettings
from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog,QMessageBox
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
@@ -59,7 +64,7 @@ class Postgis_Creator(QDialog, EDITOR_CLASS):
# show the dialog
self.show()
# Run the dialog event loop
result = self.exec_()
result = self.exec()
# See if OK was pressed
if result == 1:
+9 -4
View File
@@ -9,9 +9,14 @@ import qgis
from qgis.PyQt.QtCore import QSettings
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
@@ -89,7 +94,7 @@ class Postgis_Editor(QDialog, EDITOR_CLASS):
# show the dialog
self.show()
# Run the dialog event loop
result = self.exec_()
result = self.exec()
# See if OK was pressed
if result == 1:
#******************************debut script*********************************
+14 -9
View File
@@ -9,9 +9,14 @@ import qgis
from qgis.PyQt.QtCore import QSettings
from qgis.PyQt.QtWidgets import QAction, QMenu, QDialog, QMessageBox,QDialogButtonBox
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
@@ -69,7 +74,7 @@ class Postgis_Rename(QDialog, EDITOR_CLASS):
def raise_(self):
self.activateWindow()
self.groupBox_3.hide()
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
self.buttonBox.button(QDialogButtonBox.StandardButton(0x00000400)).setEnabled(False)
GET_ALL_SCHEMA = """SELECT DISTINCT table_schema FROM information_schema.tables WHERE table_schema LIKE '_form_%' OR table_schema LIKE '_01_%' OR table_schema LIKE '_07_%' OR table_schema LIKE '_26_%' OR table_schema LIKE '_42_%' OR table_schema LIKE '_69_%' ORDER BY table_schema;"""
cur.execute(GET_ALL_SCHEMA)
AllSchema = cur.fetchall()
@@ -118,10 +123,10 @@ class Postgis_Rename(QDialog, EDITOR_CLASS):
if allIsGood == 2:
self.groupBox_3.show()
self.loadValue()
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True)
self.buttonBox.button(QDialogButtonBox.StandardButton(0x00000400)).setEnabled(True)
else:
self.groupBox_3.hide()
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
self.buttonBox.button(QDialogButtonBox.StandardButton(0x00000400)).setEnabled(False)
else:
self.old_name.setText('')
self.compte.setChecked(0)
@@ -220,9 +225,9 @@ class Postgis_Rename(QDialog, EDITOR_CLASS):
def msgBox(self):
self.QMBquestion = QMessageBox()
self.QMBquestion.setWindowTitle(u"Attention !")
self.QMBquestion.setIcon(QMessageBox.Warning)
self.QMBquestion.setIcon(QMessageBox.Icon.Warning)
self.QMBquestion.setText("Attention, le renommage de dossier PostGIS peut engendrer des pertes de liaisons avec des projets QGIS !")
self.QMBquestion.setStandardButtons(QMessageBox.Yes|QMessageBox.No)
self.QMBquestion.setStandardButtons(QMessageBox.StandardButton(0x00004000)|QMessageBox.StandardButton(0x00010000))
if self.new_name.text() != '':
error_caracteres = 0
for caracteres in ch :
@@ -234,5 +239,5 @@ class Postgis_Rename(QDialog, EDITOR_CLASS):
QMessageBox.warning(None, "Oups :", u"Le nom de dossier ne doit pas comporter de caractères spéciaux, ni d'espaces !\n\n\t" + self.new_name.text().lower() )
else:
QMessageBox.warning(None, "Oups :", "Votre projet doit avoire un nom !")
if self.QMBquestion == QMessageBox.Yes:
if self.QMBquestion == QMessageBox.StandardButton(0x00004000):
self.updateName()
+3 -18
View File
@@ -29,9 +29,6 @@
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
@@ -41,7 +38,7 @@
<x>0</x>
<y>0</y>
<width>453</width>
<height>547</height>
<height>570</height>
</rect>
</property>
<widget class="QGroupBox" name="groupBox">
@@ -56,7 +53,7 @@
<property name="title">
<string>DevLog</string>
</property>
<widget class="QWebView" name="viewer" native="true">
<widget class="QTextBrowser" name="viewer">
<property name="geometry">
<rect>
<x>10</x>
@@ -65,11 +62,6 @@
<height>511</height>
</rect>
</property>
<property name="url" stdset="0">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</widget>
</widget>
@@ -78,19 +70,12 @@
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::NoButton</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header location="global">QtWebKitWidgets/QWebView</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>