{"action":"created","comment":{"url":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/comments/83918605","pull_request_review_id":4730266,"id":83918605,"diff_hunk":"@@ -0,0 +1,145 @@\n+# Copyright (c) 2016 Shotgun Software Inc.\n+#\n+# CONFIDENTIAL AND PROPRIETARY\n+#\n+# This work is provided \"AS IS\" and subject to the Shotgun Pipeline Toolkit\n+# Source Code License included in this distribution package. See LICENSE.\n+# By accessing, using, copying or modifying this work you indicate your\n+# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights\n+# not expressly granted therein are reserved by Shotgun Software Inc.\n+\n+def dock_panel(engine, panel_id, widget_id, title):\n+    \"\"\"\n+    Docks a Shotgun app panel widget in a new panel tab of Maya Channel Box dock area.\n+\n+    :param engine: :class:`MayaEngine` instance running in Maya.\n+    :param panel_id: Unique string identifier for the Shotgun app panel.\n+    :param widget_id: Unique string identifier for the Shotgun app panel widget instance.\n+    :param title: Title to give to the new dock tab.\n+    \"\"\"\n+\n+    # The imports are done here rather than at the module level to avoid spurious imports\n+    # when this module is reloaded in the context of a workspace control UI script.\n+    import maya.mel as mel\n+    import maya.utils\n+    import pymel.core as pm\n+\n+    # Create the Maya panel name.\n+    maya_panel_id = \"panel_%s\" % panel_id\n+\n+    # When the Maya panel already exists, it can be delete safely since its embedded\n+    # Shotgun app panel widget has already been reparented under Maya main window.\n+    if pm.control(maya_panel_id, query=True, exists=True):\n+        engine.log_debug(\"Deleting existing Maya panel %s.\" % maya_panel_id)\n+        pm.deleteUI(maya_panel_id)\n+\n+    # Use the proper Maya panel docking method according to the Maya version.\n+    if mel.eval(\"getApplicationVersionAsFloat()\") < 2017:\n+\n+        # Create a new Maya window.\n+        maya_window = pm.window()\n+        engine.log_debug(\"Created Maya window %s.\" % maya_window)\n+\n+        # Add a layout to the Maya window.\n+        maya_layout = pm.formLayout(parent=maya_window)\n+        engine.log_debug(\"Created Maya layout %s.\" % maya_layout)\n+\n+        # Reparent the Shotgun app panel widget under the Maya window layout.\n+        engine.log_debug(\"Reparenting Shotgun app panel widget %s under Maya layout %s.\" % (widget_id, maya_layout))\n+        pm.control(widget_id, edit=True, parent=maya_layout)\n+\n+        # Keep the Shotgun app panel widget sides aligned with the Maya window layout sides.\n+        pm.formLayout(maya_layout,\n+                      edit=True,\n+                      attachForm=[(widget_id, 'top', 1),\n+                                  (widget_id, 'left', 1),\n+                                  (widget_id, 'bottom', 1),\n+                                  (widget_id, 'right', 1)]\n+        )\n+\n+        # Dock the Maya window into a new tab of Maya Channel Box dock area.\n+        engine.log_debug(\"Creating Maya panel %s.\" % maya_panel_id)\n+        pm.dockControl(maya_panel_id, area=\"right\", content=maya_window, label=title)\n+\n+        # Once Maya will have completed its UI update and be idle,\n+        # raise (with \"r=True\") the new dock tab to the top.\n+        maya.utils.executeDeferred(\"cmds.dockControl('%s', edit=True, r=True)\" % maya_panel_id)\n+\n+    else:  # Maya 2017 and later\n+\n+        # Delete any default workspace control state that might have been automatically\n+        # created by Maya when a previously existing Maya panel was closed and deleted.\n+        if pm.workspaceControlState(maya_panel_id, exists=True):","path":"python/tk_maya/panel_generation.py","position":72,"original_position":72,"commit_id":"7998c5e04595310d826291562bcc2a27f284231a","original_commit_id":"7998c5e04595310d826291562bcc2a27f284231a","user":{"login":"fpainchaud","id":20173280,"avatar_url":"https://avatars.githubusercontent.com/u/20173280?v=3","gravatar_id":"","url":"https://api.github.com/users/fpainchaud","html_url":"https://github.com/fpainchaud","followers_url":"https://api.github.com/users/fpainchaud/followers","following_url":"https://api.github.com/users/fpainchaud/following{/other_user}","gists_url":"https://api.github.com/users/fpainchaud/gists{/gist_id}","starred_url":"https://api.github.com/users/fpainchaud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fpainchaud/subscriptions","organizations_url":"https://api.github.com/users/fpainchaud/orgs","repos_url":"https://api.github.com/users/fpainchaud/repos","events_url":"https://api.github.com/users/fpainchaud/events{/privacy}","received_events_url":"https://api.github.com/users/fpainchaud/received_events","type":"User","site_admin":false},"body":"For now, when switching workspaces, the Shotgun app panel dock tab is closed.\r\n\r\nPreserving the Shotgun app panel across will be covered in ticket\r\n_#37575: [tk-maya] Capture and recall panel state in Maya 2017_\r\n","created_at":"2016-10-18T18:22:27Z","updated_at":"2016-10-18T18:22:27Z","html_url":"https://github.com/shotgunsoftware/tk-maya/pull/23#discussion_r83918605","pull_request_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/comments/83918605"},"html":{"href":"https://github.com/shotgunsoftware/tk-maya/pull/23#discussion_r83918605"},"pull_request":{"href":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/23","id":89648046,"html_url":"https://github.com/shotgunsoftware/tk-maya/pull/23","diff_url":"https://github.com/shotgunsoftware/tk-maya/pull/23.diff","patch_url":"https://github.com/shotgunsoftware/tk-maya/pull/23.patch","issue_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues/23","number":23,"state":"open","locked":false,"title":"#37683: Show up the Shotgun Panel at the right place in Maya 2017.","user":{"login":"fpainchaud","id":20173280,"avatar_url":"https://avatars.githubusercontent.com/u/20173280?v=3","gravatar_id":"","url":"https://api.github.com/users/fpainchaud","html_url":"https://github.com/fpainchaud","followers_url":"https://api.github.com/users/fpainchaud/followers","following_url":"https://api.github.com/users/fpainchaud/following{/other_user}","gists_url":"https://api.github.com/users/fpainchaud/gists{/gist_id}","starred_url":"https://api.github.com/users/fpainchaud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fpainchaud/subscriptions","organizations_url":"https://api.github.com/users/fpainchaud/orgs","repos_url":"https://api.github.com/users/fpainchaud/repos","events_url":"https://api.github.com/users/fpainchaud/events{/privacy}","received_events_url":"https://api.github.com/users/fpainchaud/received_events","type":"User","site_admin":false},"body":"Dock a Shotgun app panel widget in a new panel tab of Maya Channel Box dock area using the proper Maya panel docking method according to the Maya version.\r\n\r\nPrepare the tk-maya engine to use the new logging system introduced in core v0.18.\r\n","created_at":"2016-10-17T15:37:21Z","updated_at":"2016-10-18T18:22:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd51e2c8943be832cc3d5c1ff008104226ae9f1f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/23/commits","review_comments_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/23/comments","review_comment_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues/23/comments","statuses_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/statuses/7998c5e04595310d826291562bcc2a27f284231a","head":{"label":"shotgunsoftware:37683_maya_2017_panel","ref":"37683_maya_2017_panel","sha":"7998c5e04595310d826291562bcc2a27f284231a","user":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":4399199,"name":"tk-maya","full_name":"shotgunsoftware/tk-maya","owner":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shotgunsoftware/tk-maya","description":"A Shotgun Pipeline Toolkit Engine for Maya","fork":false,"url":"https://api.github.com/repos/shotgunsoftware/tk-maya","forks_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/forks","keys_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/teams","hooks_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/hooks","issue_events_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues/events{/number}","events_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/events","assignees_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/assignees{/user}","branches_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/branches{/branch}","tags_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/tags","blobs_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/refs{/sha}","trees_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/statuses/{sha}","languages_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/languages","stargazers_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/stargazers","contributors_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/contributors","subscribers_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/subscribers","subscription_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/subscription","commits_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/commits{/sha}","git_commits_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/commits{/sha}","comments_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/comments{/number}","issue_comment_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues/comments{/number}","contents_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/contents/{+path}","compare_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/merges","archive_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/downloads","issues_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues{/number}","pulls_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls{/number}","milestones_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/milestones{/number}","notifications_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/labels{/name}","releases_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/releases{/id}","deployments_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/deployments","created_at":"2012-05-21T21:52:36Z","updated_at":"2016-08-30T14:48:21Z","pushed_at":"2016-10-17T15:37:22Z","git_url":"git://github.com/shotgunsoftware/tk-maya.git","ssh_url":"git@github.com:shotgunsoftware/tk-maya.git","clone_url":"https://github.com/shotgunsoftware/tk-maya.git","svn_url":"https://github.com/shotgunsoftware/tk-maya","homepage":"","size":26672,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":1,"forks":12,"open_issues":1,"watchers":13,"default_branch":"master"}},"base":{"label":"shotgunsoftware:master","ref":"master","sha":"5784b3e341a846128eb51bf59d525d915248b1b2","user":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"repo":{"id":4399199,"name":"tk-maya","full_name":"shotgunsoftware/tk-maya","owner":{"login":"shotgunsoftware","id":317894,"avatar_url":"https://avatars.githubusercontent.com/u/317894?v=3","gravatar_id":"","url":"https://api.github.com/users/shotgunsoftware","html_url":"https://github.com/shotgunsoftware","followers_url":"https://api.github.com/users/shotgunsoftware/followers","following_url":"https://api.github.com/users/shotgunsoftware/following{/other_user}","gists_url":"https://api.github.com/users/shotgunsoftware/gists{/gist_id}","starred_url":"https://api.github.com/users/shotgunsoftware/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shotgunsoftware/subscriptions","organizations_url":"https://api.github.com/users/shotgunsoftware/orgs","repos_url":"https://api.github.com/users/shotgunsoftware/repos","events_url":"https://api.github.com/users/shotgunsoftware/events{/privacy}","received_events_url":"https://api.github.com/users/shotgunsoftware/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shotgunsoftware/tk-maya","description":"A Shotgun Pipeline Toolkit Engine for Maya","fork":false,"url":"https://api.github.com/repos/shotgunsoftware/tk-maya","forks_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/forks","keys_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/teams","hooks_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/hooks","issue_events_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues/events{/number}","events_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/events","assignees_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/assignees{/user}","branches_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/branches{/branch}","tags_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/tags","blobs_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/refs{/sha}","trees_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/statuses/{sha}","languages_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/languages","stargazers_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/stargazers","contributors_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/contributors","subscribers_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/subscribers","subscription_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/subscription","commits_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/commits{/sha}","git_commits_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/git/commits{/sha}","comments_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/comments{/number}","issue_comment_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues/comments{/number}","contents_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/contents/{+path}","compare_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/merges","archive_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/downloads","issues_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues{/number}","pulls_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls{/number}","milestones_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/milestones{/number}","notifications_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/labels{/name}","releases_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/releases{/id}","deployments_url":"https://api.github.com/repos/shotgunsoftware/tk-maya/deployments","created_at":"2012-05-21T21:52:36Z","updated_at":"2016-08-30T14:48:21Z","pushed_at":"2016-10-17T15:37:22Z","git_url":"git://github.com/shotgunsoftware/tk-maya.git","ssh_url":"git@github.com:shotgunsoftware/tk-maya.git","clone_url":"https://github.com/shotgunsoftware/tk-maya.git","svn_url":"https://github.com/shotgunsoftware/tk-maya","homepage":"","size":26672,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":1,"forks":12,"open_issues":1,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/23"},"html":{"href":"https://github.com/shotgunsoftware/tk-maya/pull/23"},"issue":{"href":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues/23"},"comments":{"href":"https://api.github.com/repos/shotgunsoftware/tk-maya/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shotgunsoftware/tk-maya/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/shotgunsoftware/tk-maya/statuses/7998c5e04595310d826291562bcc2a27f284231a"}}}}
{"actor":{"display_login":"fpainchaud"}}