Addons manager - check if icon file exists [skip ci]

Currently .isNull is used, to detect icon validity, but such method doesn't take the file path detection into an account. Result being a lot of messages outputted to the Report view and fallback icon not being used.

This PR fixes such icon path related issues.
This commit is contained in:
triplus
2020-02-06 21:20:00 +01:00
committed by wwmayer
parent 5d42d45ae0
commit c21a015404

View File

@@ -276,7 +276,11 @@ class CommandAddonManager:
import AddonManager_rc
from PySide import QtGui
addonicon = QtGui.QIcon(":/icons/" + repo + "_workbench_icon.svg")
path = ":/icons/" + repo + "_workbench_icon.svg"
if QtCore.QFile.exists(path):
addonicon = QtGui.QIcon(path)
else:
addonicon = QtGui.QIcon(":/icons/document-package.svg")
if addonicon.isNull():
addonicon = QtGui.QIcon(":/icons/document-package.svg")
return addonicon