SGTK Loader UI Customization

I’d like to add the functionality to change PublishedFile status from the SGTK Loader. I’ve been able to add the basic functionality into the tk-houdini_actions.py hook to change status, but I’m trying to expose awareness of the status in the UI, and refresh the UI when the action is executed. So I’m trying to figure out the best way to implement these functions.

To begin with, I discovered the async_refresh() function for updating models, but I can’t figure out how to access the UI models from the action hook module.

And, once the basic functionality and refreshing are in place, I’d like the UI to be able to display the status in ideally two ways, color and filtering.

I’d like to be able to color code the background of the entries in the UI based on status (omit - red, complete - green, everything else standard grey), but I’m not finding much on color setting.

Another thing that is more involved, but would be useful would be to be able to customize the UI to have filtering by status and toggle display of published on that the same way there is Published Type filtering already.

Thanks!

5 Likes

Hi Matt! Welcome to the forums!

We weren’t able to get an answer to this one today – there are a handful of dev questions in here, so it’ll take a bit of digging – but I hope to get you some info next week. Stay tuned :slight_smile:

3 Likes

Great questions!

One thing I was going to do is to simply give a popup box with some filters and then filters the publishes based on that with a hook.

You suggestions are great though, would definately make the Loader more usefull!

1 Like

Hello! I was able to get some more info here:

  • There currently is no UI customization exposed in the Loader along the lines of color coding, etc. So, as far as that’s concerned, you’d be on your own to fork the app and modify it to you specifications, and/or submit a feature request on our roadmap page.
  • As far as refreshing the UI, there is a reload_action dialog object, though it’s a bit hard to get to:
  • Finally, as far as filtering by status, you could set this up in the Loader configuration either via hook or by how you set up the entity hierarchies. But there’s no way to do that kind of filtering interactively in the UI. If that’s something you’re after, that would be another feature request.

Hope that helps! Let us know if you have any other questions.

2 Likes

Thanks for the info!

  • I definitely think access to color coding of the UI would be really useful, I’ll submit a feature request for that.

  • Thanks for the reload function. The issue I’m having is that I want to run that inside my action which doesn’t seem to have access in the hook to the UI class. Is there a way to access the UI from the hook so I can run that? Otherwise I’d need to modify the dialog.py directly which I’m trying to avoid.

  • How would I set up filtering by status in the Loader configuration by hook? Does that mean adding a hook directly to the dialog.py?

3 Likes

No, unfortunately, there is no way to access it, which is what Tannaz was eluding to in that it’s hard to reach. The problem is that the Application instance doesn’t have a pointer to the widget. You would need to rework this bit so that it did store the widget to self so that from your hook you could do something like: self.parent.dialog._reload_action().

The filter_publishes.py hook allows you to set filters for the publishes, but it does not allow interaction, so the user would not be able to toggle on or off the status’ to filter.

2 Likes

Could you not display a qt box with some filter options while running the filter_publishes hook?
I think that shoudl work?

1 Like

You could, but you wouldn’t have control over when that got triggered unfortunately.

2 Likes

I know this is an old topic, I just wanted to add the solution for color coding in the loader, since I haven’t seen it addressed anywhere:

Once you fork the app, you just need to add this definition to model_entity.py:

def _finalize_item(self, item):

    super(SgEntityModel, self)._finalize_item(item)
    sg_data = shotgun_model.get_sg_data(item) or {}
    if sg_data.get("sg_status_list", "") == "omt":
        item.setData(QtGui.QColor(234, 45, 5), QtCore.Qt.ForegroundRole)
        item.setData(QtGui.QColor(20, 20, 20), QtCore.Qt.BackgroundRole)

And you can then change the status and colors to be whatever you’d like

1 Like