Changing sg_status_list via custom app

Hello,

I am currently writing a custom app to to move some files locally on our network. I am using a table to to display all of the Version entities that are available to the layout team. the cellWidget that is there was created using the shotgun_fields.ShotgunFieldManager. which I used the field_manager.create_widget() function I have the widget type flagged as EDITABLE and everything appears as it should. I was wondering is there a way for the changes that are made to this widget to be populated on the shotgun site.

say changing the status from “Ready for Review” to “Final”

image

if that’s unclear when I change this combo box I want the shotgrid website to update this versions status to reflect the change.

Looking at the docs, this is a TODO:
“* ShotGrid model to auto update SG on changes still to come”
https://developer.shotgridsoftware.com/tk-framework-qtwidgets/shotgun_fields.html

Which means that you would have to update the entities yourself.
The widget is essentially a QComboBox. You have to listen to some event from it, e.g. currentIndexChanged:

class YourApp():
  def build_ui(self):
    self.status_widget = ...
    widget.currentIndexChanged.connect(self.change_handler)

  def change_handler(self, selected_index):
    # lookup item from index
    selected_status = self.status_widget.itemData(selected_index)
    # app contains shotgun context, toolkit, etc.
    # you have to figure the version id based on the row
    self.shotgun.update("Version", version_id_from_event, {"status": selected_status})

Hope this puts you on track.

1 Like