Skip to content

Commit d758e05

Browse files
to squash
1 parent 9929afd commit d758e05

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

qgist/msg.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
# IMPORT (External Dependencies)
2929
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3030

31-
from qgis.PyQt.Qt import QWidget
32-
from qgis.PyQt.QtWidgets import QMessageBox
31+
from qgis.PyQt.QtWidgets import QMessageBox, QWidget
3332

3433

3534
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -44,29 +43,36 @@
4443
# ROUTINES
4544
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4645

47-
def msg_critical(exception, widget = None):
4846

49-
_msg('critical', translate('global', 'Critical error'), exception, widget)
47+
def msg_critical(exception, widget=None):
5048

51-
def msg_warning(exception, widget = None):
49+
_msg("critical", translate("global", "Critical error"), exception, widget)
5250

53-
_msg('warning', translate('global', 'Warning'), exception, widget)
5451

55-
def _msg(msg_type, msg_title, exception, widget = None):
52+
def msg_warning(exception, widget=None):
53+
54+
_msg("warning", translate("global", "Warning"), exception, widget)
55+
56+
57+
def _msg(msg_type, msg_title, exception, widget=None):
5658

5759
if not isinstance(exception, Exception):
58-
raise QgistTypeError(translate('global', '"exception" must be of type Exception. (msg)'))
60+
raise QgistTypeError(
61+
translate("global", '"exception" must be of type Exception. (msg)')
62+
)
5963
if not isinstance(widget, QWidget) and widget is not None:
60-
raise QgistTypeError(translate('global', '"widget" must be of type QWidget or None. (msg)'))
64+
raise QgistTypeError(
65+
translate("global", '"widget" must be of type QWidget or None. (msg)')
66+
)
6167

6268
if len(exception.args) == 0:
63-
msg = translate('global', 'Internal error. No description can be provided. Please file a bug. (msg)')
69+
msg = translate(
70+
"global",
71+
"Internal error. No description can be provided. Please file a bug. (msg)",
72+
)
6473
else:
6574
msg = str(exception.args[0])
6675

6776
getattr(QMessageBox, msg_type)(
68-
widget,
69-
msg_title,
70-
msg,
71-
QMessageBox.StandardButton.Ok
72-
)
77+
widget, msg_title, msg, QMessageBox.StandardButton.Ok
78+
)

0 commit comments

Comments
 (0)