Skip to content
Permalink
Browse files
Use pushWarning instead of pushMessage
  • Loading branch information
YoannQDQ authored and nyalldawson committed Mar 17, 2023
1 parent 53c7b80 commit 8db1026
Showing 1 changed file with 4 additions and 11 deletions.
@@ -302,22 +302,19 @@ def reformatCode(self):
new_text = isort.code(new_text, **options)

except ImportError:
self.parent.infoBar.pushMessage(
self.parent.infoBar.pushWarning(
QCoreApplication.translate("PythonConsole", "Python Console"),
QCoreApplication.translate("PythonConsole", "Module {0} is missing").format("isort"),
duration=2,
)

# autopep8
if formatter == "autopep8":
try:
import autopep8
except ImportError:
self.parent.infoBar.pushMessage(
self.parent.infoBar.pushWarning(
QCoreApplication.translate("PythonConsole", "Python Console"),
QCoreApplication.translate("PythonConsole", "Module {0} is missing").format("autopep8"),
duration=2,
level=Qgis.Warning,
)
return
level = self.settings.value("pythonConsole/autopep8Level", 1, type=int)
@@ -329,19 +326,15 @@ def reformatCode(self):
try:
import black
except ImportError:
self.parent.infoBar.pushMessage(
self.parent.infoBar.pushWarning(
QCoreApplication.translate("PythonConsole", "Python Console"),
QCoreApplication.translate("PythonConsole", "Module {0} is missing").format("black"),
duration=2,
level=Qgis.Warning,
)
return
if not self.syntaxCheck():
self.parent.infoBar.pushMessage(
self.parent.infoBar.pushWarning(
QCoreApplication.translate("PythonConsole", "Code formatting failed"),
QCoreApplication.translate("PythonConsole", "The code contains syntax errors"),
level=Qgis.Warning,
duration=2,
)
return

0 comments on commit 8db1026

Please sign in to comment.