0

Action Menu Items & Refresh

Hi,

let's imagine I use custom Action Menu Item as described here:

https://shotgunsoftware.zendesk.com/entries/110709-creating-custom-menu-items-for-integration-with-other-pipeline-tools

to e.g. send versions to render proxies.

Once they are send off I add a tag 'proxy_queued' to the versions from within my script.

Now I would like that the user sees that the tag was added on their screen.

Is there way that Shotgun could refresh the UI ~ 3 seconds after a custom script was run to show any changes the script might have caused to the records?

Thanks,
patrick

15件のコメント

  • 0
    Avatar
    KP

    Patrick,

    We don't have any kind of hook to trigger a page refresh. But you could put a line at the end of your script to open the calling webpage. It would open a new tab/window but at least it would then present the use with the latest data that exists for their page. Since the ActionMenuItem knows the page id, piping the url of the page back into a browser would signal a process completed.

    It would be cool to have this be an option for the menu item though. A "wait_for_response" option that when set to "true" would put the page into a listening state looking for a callback from the ActionMenuItem to be completed. We'd have to implement a couple of things to make that a possibility but we'll look into it. In the meantime, hopefully opening a new browser page will alert the user to the changes for now.

    cheers
    kp 

  • 0
    Avatar
    Patrick Wolf

    Hi Kevin,

    thanks for your answer.

    This might be even easier to implement for now and then long term your idea would be even better:

    data = {
      "title":"Build PDF Report",
      "url": "http://some_url",
      "list_order": 1,
      "entity_type": "Version",
      "selection_required": False, 
      "refresh_after": 5,

    }

    #Create the menu item
    menu_item = sg.create("ActionMenuItem", data)

    The refresh_after would tell shotgun to refresh the current page 5 seconds after the link was clicked.

    It's not perfect but would work :)

    Ciao,

    Patrick

  • 0
    Avatar
    KP

    True... I thought about that but there's no way to know that your process would have completed by then so you might end up seeing half-baked results which would be just as confusing potentially. Though you're right, it's probably a lot easier a solution, but I think we'd want to do something that's a bit more reliable. Thanks for your thoughts!

  • 0
    Avatar
    Patrick Wolf

    > but there's no way to know that your process would have completed by then

    since the developer is the one writing the process and also the one who sets the refresh_after value when they add the action menu item it might be sufficient for the time being.

    It seems that Shotgun refreshes the page anyway at certain intervals so this would just be a trigger to refresh it early. that's it :)

    The more advanced solution could still be developed but for simple scripts some developers might prefer to use refresh_after anyhow.

    What do do you think?

    Thanks,
    patrick

  • 0
    Avatar
    Patrick Wolf

    Hi,

    it would be a very helpful feature for us so I'm wondering what you think about my suggestion?

    Thanks,
    Patrick

  • 0
    Avatar
    KP

    I think that sounds like a good suggestion as well as having the option to pop open a modal window instead of launching a new browser window and then refreshing the page when you close that window. We have feature tickets for both of these now and have tagged this post with them to follow up when there's an update. Thanks for posting this.

  • 0
    Avatar
    Patrick Wolf

    You are very welcome and thanks for implementing it :)

  • 0
    Avatar
    Shani Turner

    I am try to call a script from an action menu item I created but it just hangs. Is there a problem with the url I am using? The script works from the command line and just prints "testing".

    url:

    file:///SEAT_B/_developer/shani/scripts/Misc_Scripts/refresh_data.py

  • 0
    Avatar
    Robin Watson

    Is this still on the cards to be implemented?

    I had a requirement for this functionality in various tools I am writing and  have had to come up with my own solution ( http://www.youtube.com/watch?v=qmu9DGl9fqQ ) which I can post the code for if anyones still interested after 18 months...

    It would be nice to do this through the provided api .. any news ?

  • 0
    Avatar
    Tom Stratton

    Hi Don - this is listed as answered but as far as I can tell, neither of the suggestions that you have "ticketed" have been implemented yet. Have I missed that information somewhere?

    I'd love to hear if anyone has found a good solution for this - particularly in the context of handling ActionMenu calls via CGI (http) requests. The insertion of a modal window to gather additional input from the user would be great (though I can see that coding it myself as straight http coming from a Python script is not an insurmountable obstacle.

     

    Tom

  • 0
    Avatar
    Tom Stratton

    Robin - very interested in the code that goes with the youtube video you posted - are you still watching this thread? Contact me tom at tomstratton dot net

  • 0
    Avatar
    Tom Stratton

    Follow Up: I never heard from Robin but I did manage to work out everyting but the "pretty" - I posted my code and some comments at github

    https://github.com/ProjectGuerilla/Shotgun-Code-Snippets

    I hope it helps save someone a few hours of head-scratching.

  • 0
    Avatar
    Tim Crowson

    Hey everyone, just wondering if there's been any development on this front. Tom, I looked through your snippets on Git but couldn't find what was I looking for. What code are you using to refresh the page? I'll keep hunting, but we'd love to automatically refresh a page after we run our commands.

  • 0
    Avatar
    Tom Stratton

    The refresh is embedded into the web form code

    print '''<a href="#" onclick="window.opener.location.href='%s'; window.opener='x';window.close();">Visit Playlist Now</a>''' % path_to_playlist


    is the code snippet that does the refresh.

  • 0
    Avatar
    Tim Crowson

    Thanks Tom!

ログインしてコメントを残してください。