Skip to content

Commit

Permalink
Enable Qt6 on the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustry committed Nov 27, 2024
1 parent 4ce95a8 commit 46bfd88
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions pg_metadata/dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self, parent=None):
# Settings menu
self.config.setAutoRaise(True)
self.config.setToolTip(tr("Settings"))
self.config.setPopupMode(QToolButton.InstantPopup)
self.config.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
self.config.setIcon(QgsApplication.getThemeIcon("/mActionOptions.svg"))

self.auto_open_dock_action = QAction(
Expand All @@ -111,7 +111,7 @@ def __init__(self, parent=None):
# Setting PDF/HTML menu
self.save_button.setAutoRaise(True)
self.save_button.setToolTip(tr("Save metadata"))
self.save_button.setPopupMode(QToolButton.InstantPopup)
self.save_button.setPopupMode(QToolButton.ToolButtonPopupMode.InstantPopup)
self.save_button.setIcon(QIcon(QgsApplication.iconPath('mActionFileSave.svg')))

self.save_as_pdf = QAction(
Expand Down Expand Up @@ -174,8 +174,8 @@ def export_dock_content(self, output_format: OutputFormats):

if output_format == OutputFormats.PDF:
printer = QPrinter()
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setPageMargins(20, 20, 20, 20, QPrinter.Millimeter)
printer.setOutputFormat(QPrinter.OutputFormat.PdfFormat)
printer.setPageMargins(20, 20, 20, 20, QPrinter.Unit.Millimeter)
printer.setOutputFileName(output_file_path)
self.viewer.print(printer)
iface.messageBar().pushSuccess(
Expand Down Expand Up @@ -334,7 +334,7 @@ def add_flatten_dataset_table(self):
dialog.setComboBoxItems(connections)
dialog.setWindowTitle(tr("Database"))
dialog.setLabelText(tr("Choose the database to add the catalog"))
if not dialog.exec_():
if not dialog.exec():
return
connection_name = dialog.textValue()
else:
Expand Down
1 change: 1 addition & 0 deletions pg_metadata/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tracker=https://github.com/3liz/qgis-pgmetadata-plugin/issues
repository=https://github.com/3liz/qgis-pgmetadata-plugin
homepage=https://docs.3liz.org/qgis-pgmetadata-plugin/
hasProcessingProvider=yes
supportsQt6=true
tags=metadata,postgresql,qgis,metadonnees,dcat,xml,csv
category=Analysis
icon=resources/icons/icon.png
Expand Down
8 changes: 4 additions & 4 deletions pg_metadata/pg_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,21 @@ def check_invalid_connection_names() -> int:

invalid_text = ', '.join(invalid)
msg = QMessageBox()
msg.setIcon(QMessageBox.Warning)
msg.setIcon(QMessageBox.Icon.Warning)
msg.setWindowTitle(tr('PgMetadata: Database connection(s) not available'))
msg.setText(tr(
f'{n_invalid} connection(s) listed in PgMetadata’s settings are invalid or '
f'no longer available: {invalid_text}'))
msg.setInformativeText(tr(
'Do you want to remove these connection(s) from the PgMetadata settings? '
'(You can also do this later with the “Set Connections” tool.)'))
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
msg.setStandardButtons(QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No)
clicked = msg.exec()

if clicked == QMessageBox.Yes:
if clicked == QMessageBox.StandardButton.Yes:
iface.messageBar().pushSuccess('PgMetadata', tr(f'{n_invalid} invalid connection(s) removed.'))
store_connections(valid)
if clicked == QMessageBox.No:
if clicked == QMessageBox.StandardButton.No:
iface.messageBar().pushInfo('PgMetadata', tr(f'Keeping {n_invalid} invalid connections.'))

return len(valid)
Expand Down
2 changes: 1 addition & 1 deletion pg_metadata/plausible.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _send_stat_event(self) -> bool:
if extra_debug:
request.setRawHeader(b"X-Debug-Request", b"true")
request.setRawHeader(b"X-Forwarded-For", b"127.0.0.1")
request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json")
request.setHeader(QNetworkRequest.KnownHeaders.ContentTypeHeader, "application/json")

# noinspection PyArgumentList
QgsNetworkAccessManager.instance().post(request, QByteArray(str.encode(json.dumps(data))))
Expand Down

0 comments on commit 46bfd88

Please sign in to comment.