Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ repository=https://github.com/qgist/workbench
experimental=True
deprecated=False
icon=icons/workbench.svg
supportsQt6=True
36 changes: 21 additions & 15 deletions qgist/msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
# IMPORT (External Dependencies)
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

from PyQt5.Qt import QWidget
from PyQt5.QtWidgets import QMessageBox
from qgis.PyQt.QtWidgets import QMessageBox, QWidget


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand All @@ -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
)
4 changes: 2 additions & 2 deletions qgist/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down
6 changes: 3 additions & 3 deletions qgist/workbench/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion qgist/workbench/dtype_fsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# IMPORT (External Dependencies)
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

from PyQt5.QtWidgets import (
from qgis.PyQt.QtWidgets import (
QMainWindow,
)

Expand Down
2 changes: 1 addition & 1 deletion qgist/workbench/dtype_uielement.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# IMPORT (External Dependencies)
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

from PyQt5.QtWidgets import (
from qgis.PyQt.QtWidgets import (
QDockWidget,
QToolBar,
)
Expand Down
2 changes: 1 addition & 1 deletion qgist/workbench/dtype_workbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# IMPORT (External Dependencies)
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

from PyQt5.QtWidgets import (
from qgis.PyQt.QtWidgets import (
QDockWidget,
QMainWindow,
QToolBar,
Expand Down
8 changes: 4 additions & 4 deletions qgist/workbench/ui_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions qgist/workbench/ui_manager_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down