mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merge pull request #2326 from pypeclub/bugfix/fixed_set_providers_icons
Fix - provider icons are pulled from a folder
This commit is contained in:
commit
9b477be556
2 changed files with 19 additions and 3 deletions
|
|
@ -56,6 +56,13 @@ representation.files.sites:
|
|||
`db.getCollection('MY_PROJECT').update({type:"representation"},
|
||||
{$set:{"files.$[].sites.MY_CONFIGURED_REMOTE_SITE" : {}}}, true, true)`
|
||||
|
||||
I want to create new custom provider:
|
||||
-----------------------------------
|
||||
- take `providers\abstract_provider.py` as a base class
|
||||
- create provider class in `providers` with a name according to a provider (eg. 'gdrive.py' for gdrive provider etc.)
|
||||
- upload provider icon in png format, 24x24, into `providers\resources`, its name must follow name of provider (eg. 'gdrive.png' for gdrive provider)
|
||||
- register new provider into `providers.lib.py`, test how many files could be manipulated at same time, check provider's API for limits
|
||||
|
||||
Needed configuration:
|
||||
--------------------
|
||||
`pype/settings/defaults/project_settings/global.json`.`sync_server`:
|
||||
|
|
|
|||
|
|
@ -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 = os.path.join(resource_path, file_name)
|
||||
icons[provider] = QtGui.QIcon(pix_url)
|
||||
|
||||
return icons
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue