Fix - provider icons are pulled from a folder

This commit is contained in:
Petr Kalis 2021-11-26 16:27:53 +01:00
parent 4eaea20c90
commit f18f207f03

View file

@ -477,6 +477,7 @@ def create_qthread(func, *args, **kwargs):
def get_repre_icons():
"""Returns a dict {'provider_name': QIcon}"""
try:
from openpype_modules import sync_server
except Exception:
@ -488,9 +489,17 @@ def get_repre_icons():
"providers", "resources"
)
icons = {}
# TODO get from sync module
for provider in ['studio', 'local_drive', 'gdrive']:
pix_url = "{}/{}.png".format(resource_path, provider)
if not os.path.exists(resource_path):
print("No icons for Site Sync found")
return {}
for file_name in os.listdir(resource_path):
if file_name and not file_name.endswith("png"):
continue
provider, _ = os.path.splitext(file_name)
pix_url = "{}{}{}".format(resource_path, os.path.sep, file_name)
icons[provider] = QtGui.QIcon(pix_url)
return icons