colorbleed / qtazu Goto Github PK
View Code? Open in Web Editor NEWPython Qt widgets for CG-Wire
License: MIT License
Python Qt widgets for CG-Wire
License: MIT License
When following the READMe for e.g the login widget, using the show()
method, the widget is shown but does not appear to be interactive (ie typing into the fields doesn't work).
As the widgets are QDialog
s, running e.g login.exec_()
might be more correct?
This is using Houdini 19.5 (with Python 3).
We'll need a Model and View that allows to have Artist easily browse through the available assets and shots for a project.
This would be required to easily select another Asset to comment on and start displaying its Task statuses.
Most users would consider the root URL they enter into a browser as their "Kitsu URL", which is what the Login widget asks for.
In practice, you need to add /api
at the end for things to actually work.
Might be good to add that automatically if login fails without it?
Edit: also testing with http:// and https:// if those are not in the URL would be useful.
A great aspect of commenting on CG-Wire is the capability of being able to tag a specific person to notify them about a change or question. It would be great if we can extend this functionality to qtazu
.
Initially I did a prototype as can be seen in the README:
However the functionality wasn't perfect, as deleting/backspacing names would still remove the text per character whereas it would be much more powerful the text field could identify the tag and consider it a single "block" that needs to be removed. Additionally we'll need to make sure that the comment to CG-Wire actually preserves the tag.
gazu
so that CG-Wire know who was tagged.Getting the comments for a Widget through gazu
can be done. However qtazu
does not expose any widget that allows to choose a Task and display the available comments.
This would be an amazingly helpful Widget as it would allow for Artists to avoid having to go to Kitsu to read up on the notes on their current scene but instead can have it right next to them in the DCC or pipeline.
Here's a very simple example, but this should be much prettier:
import datetime
from Qt import QtWidgets, QtCore, QtGui
import gazu
from qtazu.widgets import taskbreadcrumb
class TaskComments(QtWidgets.QWidget):
def __init__(self, parent=None, task_id=None):
super(TaskComments, self).__init__(parent)
self._task = None
breadcrumb = taskbreadcrumb.TaskBreadcrumb()
comments = QtWidgets.QTextEdit()
comments.setReadOnly(True)
layout = QtWidgets.QVBoxLayout(self)
layout.addWidget(breadcrumb)
layout.addWidget(comments)
self.breadcrumb = breadcrumb
self.comments = comments
self.setWindowTitle("CG-Wire Comments")
self.resize(250, 600)
if task_id:
self.set_task(task_id)
def set_task(self, task_id):
# todo: Remove force to `str`
task_id = str(task_id)
self._task = gazu.task.get_task(task_id)
self.comments.clear()
comments = gazu.task.all_comments_for_task(task_id)
text = ""
for comment in comments:
if not comment["text"]:
# Exclude empty comments for quick readability?
# todo: do we want to do this by default? we could add a toggle to widget
continue
# Include readable date in comment for parsing
date = datetime.datetime.strptime(comment["created_at"], '%Y-%m-%dT%H:%M:%S')
date = date.strftime('%Y-%m-%d %I:%M %p')
comment["date"] = date
# Ensure new lines in comment text are parsed
comment["text"] = comment["text"].replace(r"\\n", "<br>")
html_start = """
<b>{person[first_name]} {person[last_name]}</b> | {date}<br>
<br>""".format(**comment)
html_end = """
<br><br>
----<br>
<br>
"""
self.comments.insertHtml(html_start)
self.comments.insertPlainText(comment["text"])
self.comments.insertHtml(html_end)
Then to use it:
# Get a specific task by names (purely to aid in trying out the example)
project = gazu.project.get_project_by_name("projectname")
sequence = gazu.shot.get_sequence_by_name(project, "sequencename")
shot = gazu.shot.get_shot_by_name(sequence, "shotname")
task = gazu.task.get_task_by_name(shot, gazu.task.get_task_type_by_name("taskname"))
# Use the example widget
widget = TaskComments(task_id=task["id"])
widget.show()
In the end the goal is to have a similar view as Kitsu presents:
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 thumbnail
thumbnail = 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.
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:
def get_thumbnail_url(entity):
"""Get the related thumbnail for an entity"""
entity_id = entity["id"]
entity_type = entity["type"]
if entity_type == "Person":
return "pictures/thumbnails/persons/{0}.png".format(entity_id)
elif entity_type == "Project":
return "pictures/thumbnails/projects/{0}.png".format(entity_id)
elif entity_type == "Shot" or entity_type == "Asset":
# Get Main Preview
preview_file_id = entity.get("preview_file_id")
if not preview_file_id:
return
return "pictures/thumbnails/preview-files/{0}.png".format(preview_file_id)
elif entity_type == "Task":
# todo: get latest image content from Comments on Task?
raise NotImplementedError("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..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.