Git Product home page Git Product logo

qtazu's People

Contributors

bigroy avatar frankrousseau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

qtazu's Issues

Server should implicity add /api if needed

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.

Add Task Comments widget

Issue

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:

qtazu_task_comments

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:

kitsu_task_comments

Dialogs not interactive in Houdini

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 QDialogs, running e.g login.exec_() might be more correct?

This is using Houdini 19.5 (with Python 3).

Add a Shot/Asset browser example

Issue

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.

Add utility method to retrieve Thumbnail url for an entity

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:

# 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.

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:

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..

Allow to easily tag Persons for comments

Issue

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:

qtazu_tag_prototype_02

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.

Approach

  1. Design a Python Qt implementation that supports adding tags to a text field and managing them easily.
  2. Make sure the tag is correctly send to CG-Wire through gazu so that CG-Wire know who was tagged.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.