diff --git a/metadata.txt b/metadata.txt index 1585521..c6777b6 100644 --- a/metadata.txt +++ b/metadata.txt @@ -34,3 +34,4 @@ repository=https://github.com/qgist/workbench experimental=True deprecated=False icon=icons/workbench.svg +supportsQt6=True \ No newline at end of file diff --git a/qgist/msg.py b/qgist/msg.py index ac4ed79..3c47cc5 100644 --- a/qgist/msg.py +++ b/qgist/msg.py @@ -28,8 +28,7 @@ # IMPORT (External Dependencies) # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -from PyQt5.Qt import QWidget -from PyQt5.QtWidgets import QMessageBox +from qgis.PyQt.QtWidgets import QMessageBox, QWidget # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -44,29 +43,36 @@ # ROUTINES # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -def msg_critical(exception, widget = None): - _msg('critical', translate('global', 'Critical error'), exception, widget) +def msg_critical(exception, widget=None): -def msg_warning(exception, widget = None): + _msg("critical", translate("global", "Critical error"), exception, widget) - _msg('warning', translate('global', 'Warning'), exception, widget) -def _msg(msg_type, msg_title, exception, widget = None): +def msg_warning(exception, widget=None): + + _msg("warning", translate("global", "Warning"), exception, widget) + + +def _msg(msg_type, msg_title, exception, widget=None): if not isinstance(exception, Exception): - raise QgistTypeError(translate('global', '"exception" must be of type Exception. (msg)')) + raise QgistTypeError( + translate("global", '"exception" must be of type Exception. (msg)') + ) if not isinstance(widget, QWidget) and widget is not None: - raise QgistTypeError(translate('global', '"widget" must be of type QWidget or None. (msg)')) + raise QgistTypeError( + translate("global", '"widget" must be of type QWidget or None. (msg)') + ) if len(exception.args) == 0: - msg = translate('global', 'Internal error. No description can be provided. Please file a bug. (msg)') + msg = translate( + "global", + "Internal error. No description can be provided. Please file a bug. (msg)", + ) else: msg = str(exception.args[0]) getattr(QMessageBox, msg_type)( - widget, - msg_title, - msg, - QMessageBox.Ok - ) + widget, msg_title, msg, QMessageBox.StandardButton.Ok + ) diff --git a/qgist/util.py b/qgist/util.py index ba471e7..3440ff3 100644 --- a/qgist/util.py +++ b/qgist/util.py @@ -35,12 +35,12 @@ # IMPORT (External Dependencies) # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -from PyQt5.QtCore import ( +from qgis.PyQt.QtCore import ( QCoreApplication, QSettings, QTranslator, ) -from PyQt5.QtWidgets import QApplication +from qgis.PyQt.QtWidgets import QApplication # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/qgist/workbench/core.py b/qgist/workbench/core.py index e6167ce..b3bba04 100644 --- a/qgist/workbench/core.py +++ b/qgist/workbench/core.py @@ -36,10 +36,10 @@ # IMPORT (External Dependencies) # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -from PyQt5.QtGui import ( +from qgis.PyQt.QtGui import ( QIcon, ) -from PyQt5.QtWidgets import ( +from qgis.PyQt.QtWidgets import ( QAction, QComboBox, QHBoxLayout, @@ -263,7 +263,7 @@ def _open_manager(self): self._ui_dict['combobox_workbench'].setEnabled(True) try: - manager.exec_() + manager.exec() finally: self._ui_dict['combobox_workbench'].setEnabled(True) diff --git a/qgist/workbench/dtype_fsm.py b/qgist/workbench/dtype_fsm.py index 2019d48..5893f59 100644 --- a/qgist/workbench/dtype_fsm.py +++ b/qgist/workbench/dtype_fsm.py @@ -28,7 +28,7 @@ # IMPORT (External Dependencies) # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -from PyQt5.QtWidgets import ( +from qgis.PyQt.QtWidgets import ( QMainWindow, ) diff --git a/qgist/workbench/dtype_uielement.py b/qgist/workbench/dtype_uielement.py index d1351a6..cc05ea0 100644 --- a/qgist/workbench/dtype_uielement.py +++ b/qgist/workbench/dtype_uielement.py @@ -28,7 +28,7 @@ # IMPORT (External Dependencies) # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -from PyQt5.QtWidgets import ( +from qgis.PyQt.QtWidgets import ( QDockWidget, QToolBar, ) diff --git a/qgist/workbench/dtype_workbench.py b/qgist/workbench/dtype_workbench.py index d2432a9..a647964 100644 --- a/qgist/workbench/dtype_workbench.py +++ b/qgist/workbench/dtype_workbench.py @@ -35,7 +35,7 @@ # IMPORT (External Dependencies) # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -from PyQt5.QtWidgets import ( +from qgis.PyQt.QtWidgets import ( QDockWidget, QMainWindow, QToolBar, diff --git a/qgist/workbench/ui_manager.py b/qgist/workbench/ui_manager.py index 7d5597c..59c124e 100644 --- a/qgist/workbench/ui_manager.py +++ b/qgist/workbench/ui_manager.py @@ -35,10 +35,10 @@ # IMPORT (External Dependencies) # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -from PyQt5.QtCore import ( +from qgis.PyQt.QtCore import ( Qt, ) -from PyQt5.QtWidgets import ( +from qgis.PyQt.QtWidgets import ( QCheckBox, QComboBox, QFileDialog, @@ -117,7 +117,7 @@ def _connect_ui(self): self._ui_dict['checkbox_unnamedwarning'].setEnabled(False) else: self._ui_dict['checkbox_unnamedwarning'].setCheckState( - Qt.Checked if self._fsm.config.get('show_unnamed_warning', False) else Qt.Unchecked + Qt.CheckState.Checked if self._fsm.config.get('show_unnamed_warning', False) else Qt.CheckState.Unchecked ) def change_unnamedwarning(): self._fsm.config['show_unnamed_warning'] = bool(self._ui_dict['checkbox_unnamedwarning'].isChecked()) @@ -286,7 +286,7 @@ def make_widgetitems(source, target): INTERNAL = uielement.name_internal, ) ) - item_checkbox.setCheckState(Qt.Checked if uielement.visibility else Qt.Unchecked) + item_checkbox.setCheckState(Qt.CheckState.Checked if uielement.visibility else Qt.CheckState.Unchecked) item_checkbox.setEnabled(uielement.existence) item_checkbox.stateChanged.connect(make_wrapper(item_checkbox, uielement.setVisible)) target.setItemWidget(QListWidgetItem(target), item_checkbox) diff --git a/qgist/workbench/ui_manager_base.py b/qgist/workbench/ui_manager_base.py index a98bd2f..a4244ca 100644 --- a/qgist/workbench/ui_manager_base.py +++ b/qgist/workbench/ui_manager_base.py @@ -35,14 +35,14 @@ # IMPORT (External Dependencies) # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -from PyQt5.QtCore import ( +from qgis.PyQt.QtCore import ( QSize, Qt, ) -from PyQt5.QtGui import ( +from qgis.PyQt.QtGui import ( QIcon, ) -from PyQt5.QtWidgets import ( +from qgis.PyQt.QtWidgets import ( QCheckBox, QDialog, QHBoxLayout, @@ -123,7 +123,7 @@ def _init_dialogtoolbar(ui_dict, toolbar_layout, plugin_root_fld): ))) toolbutton.setIconSize(QSize(24, 24)) # TODO get icon size from QGis!!! toolbutton.setAutoRaise(True) - toolbutton.setFocusPolicy(Qt.NoFocus) + toolbutton.setFocusPolicy(Qt.FocusPolicy.NoFocus) ui_dict['toolbutton_{NAME:s}'.format(NAME = name)] = toolbutton