{"action":"created","issue":{"url":"https://api.github.com/repos/getavalon/core/issues/340","repository_url":"https://api.github.com/repos/getavalon/core","labels_url":"https://api.github.com/repos/getavalon/core/issues/340/labels{/name}","comments_url":"https://api.github.com/repos/getavalon/core/issues/340/comments","events_url":"https://api.github.com/repos/getavalon/core/issues/340/events","html_url":"https://github.com/getavalon/core/pull/340","id":361136764,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2MTgzNzMy","number":340,"title":"Update Maya fileDialog's start-dir when task changed","user":{"login":"davidlatwe","id":3357009,"node_id":"MDQ6VXNlcjMzNTcwMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/3357009?v=4","gravatar_id":"","url":"https://api.github.com/users/davidlatwe","html_url":"https://github.com/davidlatwe","followers_url":"https://api.github.com/users/davidlatwe/followers","following_url":"https://api.github.com/users/davidlatwe/following{/other_user}","gists_url":"https://api.github.com/users/davidlatwe/gists{/gist_id}","starred_url":"https://api.github.com/users/davidlatwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidlatwe/subscriptions","organizations_url":"https://api.github.com/users/davidlatwe/orgs","repos_url":"https://api.github.com/users/davidlatwe/repos","events_url":"https://api.github.com/users/davidlatwe/events{/privacy}","received_events_url":"https://api.github.com/users/davidlatwe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-18T05:03:35Z","updated_at":"2018-09-18T07:43:10Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/getavalon/core/pulls/340","html_url":"https://github.com/getavalon/core/pull/340","diff_url":"https://github.com/getavalon/core/pull/340.diff","patch_url":"https://github.com/getavalon/core/pull/340.patch"},"body":"### Before:\r\n![task_before](https://user-images.githubusercontent.com/3357009/45665092-d247f680-bb41-11e8-8054-0fb06c6ecad9.gif)\r\n\r\nFileDialog's start-dir will stay at previous opened folder path after task changed.\r\n\r\n### After:\r\n![task_after](https://user-images.githubusercontent.com/3357009/45665093-d3792380-bb41-11e8-814f-57902e1479cf.gif)\r\n\r\nNow it will point to the scenes folder of that task after task changed.\r\nAnd, this is not recorded in GIF, but it will prompt a confirm dialog to notify artist to use Launcher, due to the workspace of that task is un-initialized (folder not exists).\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/getavalon/core/issues/comments/422289387","html_url":"https://github.com/getavalon/core/pull/340#issuecomment-422289387","issue_url":"https://api.github.com/repos/getavalon/core/issues/340","id":422289387,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjI4OTM4Nw==","user":{"login":"davidlatwe","id":3357009,"node_id":"MDQ6VXNlcjMzNTcwMDk=","avatar_url":"https://avatars2.githubusercontent.com/u/3357009?v=4","gravatar_id":"","url":"https://api.github.com/users/davidlatwe","html_url":"https://github.com/davidlatwe","followers_url":"https://api.github.com/users/davidlatwe/followers","following_url":"https://api.github.com/users/davidlatwe/following{/other_user}","gists_url":"https://api.github.com/users/davidlatwe/gists{/gist_id}","starred_url":"https://api.github.com/users/davidlatwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidlatwe/subscriptions","organizations_url":"https://api.github.com/users/davidlatwe/orgs","repos_url":"https://api.github.com/users/davidlatwe/repos","events_url":"https://api.github.com/users/davidlatwe/events{/privacy}","received_events_url":"https://api.github.com/users/davidlatwe/received_events","type":"User","site_admin":false},"created_at":"2018-09-18T07:43:10Z","updated_at":"2018-09-18T07:43:10Z","author_association":"COLLABORATOR","body":"Oh I see~\r\nI found the implementation of workspace initialization in Colorbleed config, you use `avalon.Application` to initialize it, which making more sense ! Nice :P\r\n\r\nThen I think I will remove the prompt dialog in this PR.\r\n\r\n> Could port that somehow to core?\r\n\r\nI think we can ship that logic to core in next PR, take Maya for example:\r\n\r\n```python\r\n# avalon/pipeline.py\r\n...\r\n\r\ndef on_task_changed(*args):\r\n    \"\"\"Wrapped function of app initialize and maya's on task changed\r\n    (copied from Colorbleed config)\r\n    \"\"\"\r\n\r\n    # Inputs (from the switched session and running app)\r\n    session = avalon.Session.copy()\r\n    app_name = os.environ[\"AVALON_APP_NAME\"]\r\n\r\n    # Find the application definition\r\n    app_definition = pipeline.lib.get_application(app_name)\r\n\r\n    App = type(\"app_%s\" % app_name,\r\n               (avalon.Application,),\r\n               {\"config\": app_definition.copy()})\r\n\r\n    # Initialize within the new session's environment\r\n    app = App()\r\n    env = app.environ(session)\r\n    app.initialize(env)\r\n```\r\n\r\n```python\r\n# avalon/maya/pipeline.py\r\nfrom .. import pipeline\r\n...\r\n\r\ndef _on_task_changed(*args):\r\n    pipeline.on_task_changed()\r\n\r\n    # Do something app specific action..\r\n    _update_menu_task_label()\r\n    workdir = api.Session[\"AVALON_WORKDIR\"]\r\n    if os.path.exists(workdir):\r\n        _set_project()\r\n        ...\r\n```\r\n\r\nThen `avalon.maya.install()` will register this chained callback for us !\r\n\r\n>  (Thinking of it... that might even be in our core repo, but I am not sure)\r\n\r\nI'll go there and sniff around for good stuff :D\r\n\r\n"}}
{"actor":{"display_login":"davidlatwe"}}