You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ThumbnailBase label widget is relatively low level in that you have to pass it the required URL it needs to retrieve the thumbnail from using its load method.
Meaning getting a Thumbnail for a User is something like this:
# Load user thumbnailthumbnail=ThumbnailBase()
thumbnail.setFixedWidth(75)
thumbnail.setFixedHeight(75)
thumbnail.load("pictures/thumbnails/persons/{0}.png".format(user["id"]))
The URL changes dependent on the type of entity you are working with making this slightly more involved, plus you'll need to know the URLs for the entities.
Approach
What if we would hide away these URLs and make it easily accessible through a get_thumbnail_url function.
Here's a quick prototype that has some parts unfinished:
defget_thumbnail_url(entity):
"""Get the related thumbnail for an entity"""entity_id=entity["id"]
entity_type=entity["type"]
ifentity_type=="Person":
return"pictures/thumbnails/persons/{0}.png".format(entity_id)
elifentity_type=="Project":
return"pictures/thumbnails/projects/{0}.png".format(entity_id)
elifentity_type=="Shot"orentity_type=="Asset":
# Get Main Previewpreview_file_id=entity.get("preview_file_id")
ifnotpreview_file_id:
returnreturn"pictures/thumbnails/preview-files/{0}.png".format(preview_file_id)
elifentity_type=="Task":
# todo: get latest image content from Comments on Task?raiseNotImplementedError("Not implemented.")
This way, if any of the URLs change on CG-Wire's API side we would only need to update this one function as opposed to all codebases using qtazu requiring to update the URLs in their code..
The text was updated successfully, but these errors were encountered:
@frankrousseau awesome. Maybe gazu could also provide the utilitity function to fetch a thumbnail URL for an entity as described above? Or isn't it generic enough?
And it'd be perfect if it was possible to get the URL as opposed to just a download function, so that it's doable to download it in different ways, e.g. threaded.
Issue
The ThumbnailBase label widget is relatively low level in that you have to pass it the required URL it needs to retrieve the thumbnail from using its load method.
Meaning getting a Thumbnail for a User is something like this:
The URL changes dependent on the type of entity you are working with making this slightly more involved, plus you'll need to know the URLs for the entities.
Approach
What if we would hide away these URLs and make it easily accessible through a
get_thumbnail_url
function.Here's a quick prototype that has some parts unfinished:
This way, if any of the URLs change on CG-Wire's API side we would only need to update this one function as opposed to all codebases using
qtazu
requiring to update the URLs in their code..The text was updated successfully, but these errors were encountered: