{"action":"created","comment":{"url":"https://api.github.com/repos/pywinauto/pywinauto/pulls/comments/245419246","pull_request_review_id":189526699,"id":245419246,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NTQxOTI0Ng==","diff_hunk":"@@ -926,9 +928,88 @@ def texts(self):\n     #----------------------------------------------------------------\n     def button_count(self):\n         \"\"\"Return a number of buttons on the ToolBar\"\"\"\n-        return len(self.children())\n+        children_list = self.children()\n+        if not children_list and self.element_info.handle is not None:\n+            btn_count = common_controls.ToolbarWrapper(self.element_info.handle).button_count()\n+            return btn_count\n+        else:\n+            return len(children_list)\n \n     # ----------------------------------------------------------------\n+    def _menu_item_exists(self, btn_x_coord, btn_y_coord):\n+        # Check that element is exist\n+        button_elem_info = UIAElementInfo.from_point(btn_x_coord, btn_y_coord)\n+        return button_elem_info.control_type == 'MenuItem'\n+\n+    def _up_down_menu_items(self, btn_x_coord, btn_y_coord, side='right'):\n+        # Check items up, down, left and right from current item\n+        first_pos_y = btn_y_coord\n+        elem_y_pos = btn_y_coord\n+        menu_elem_list = []\n+        direction = 0\n+\n+        while direction <= 1:\n+            button_elem_info = UIAElementInfo.from_point(btn_x_coord, elem_y_pos)\n+\n+            if not direction and button_elem_info.control_type == 'MenuItem':\n+                elem_height = button_elem_info.rectangle.height()\n+                elem_width = button_elem_info.rectangle.width()\n+                right_x = btn_x_coord + elem_width\n+                left_x = btn_x_coord - elem_width\n+                menu_elem_list.append(button_elem_info)\n+\n+                if self._menu_item_exists(right_x, elem_y_pos) and side == 'right':\n+                    # Check right side from the item\n+                    menu_elem_list += self._up_down_menu_items(right_x, elem_y_pos, side='right')\n+                elif self._menu_item_exists(left_x, elem_y_pos):\n+                    # Check left side from the item\n+                    menu_elem_list += self._up_down_menu_items(left_x, elem_y_pos, side='left')\n+\n+                elem_y_pos += elem_height\n+\n+            elif not direction and button_elem_info.control_type != 'MenuItem':\n+                direction = 1\n+                elem_y_pos = first_pos_y\n+\n+            if direction and button_elem_info.control_type == 'MenuItem':","path":"pywinauto/controls/uia_controls.py","position":57,"original_position":57,"commit_id":"c2593c4b85f0189914b6cada2411500c1881f45a","original_commit_id":"c2593c4b85f0189914b6cada2411500c1881f45a","user":{"login":"Nebyt","id":22872852,"node_id":"MDQ6VXNlcjIyODcyODUy","avatar_url":"https://avatars2.githubusercontent.com/u/22872852?v=4","gravatar_id":"","url":"https://api.github.com/users/Nebyt","html_url":"https://github.com/Nebyt","followers_url":"https://api.github.com/users/Nebyt/followers","following_url":"https://api.github.com/users/Nebyt/following{/other_user}","gists_url":"https://api.github.com/users/Nebyt/gists{/gist_id}","starred_url":"https://api.github.com/users/Nebyt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nebyt/subscriptions","organizations_url":"https://api.github.com/users/Nebyt/orgs","repos_url":"https://api.github.com/users/Nebyt/repos","events_url":"https://api.github.com/users/Nebyt/events{/privacy}","received_events_url":"https://api.github.com/users/Nebyt/received_events","type":"User","site_admin":false},"body":"I tried to do it, but I had an endless loop. I made some changes, but repetitions are in place.","created_at":"2019-01-04T20:59:54Z","updated_at":"2019-01-04T20:59:55Z","html_url":"https://github.com/pywinauto/pywinauto/pull/646#discussion_r245419246","pull_request_url":"https://api.github.com/repos/pywinauto/pywinauto/pulls/646","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pywinauto/pywinauto/pulls/comments/245419246"},"html":{"href":"https://github.com/pywinauto/pywinauto/pull/646#discussion_r245419246"},"pull_request":{"href":"https://api.github.com/repos/pywinauto/pywinauto/pulls/646"}},"in_reply_to_id":245225466},"pull_request":{"url":"https://api.github.com/repos/pywinauto/pywinauto/pulls/646","id":242066925,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQyMDY2OTI1","html_url":"https://github.com/pywinauto/pywinauto/pull/646","diff_url":"https://github.com/pywinauto/pywinauto/pull/646.diff","patch_url":"https://github.com/pywinauto/pywinauto/pull/646.patch","issue_url":"https://api.github.com/repos/pywinauto/pywinauto/issues/646","number":646,"state":"open","locked":false,"title":"#413 MFC Toolbar","user":{"login":"Nebyt","id":22872852,"node_id":"MDQ6VXNlcjIyODcyODUy","avatar_url":"https://avatars2.githubusercontent.com/u/22872852?v=4","gravatar_id":"","url":"https://api.github.com/users/Nebyt","html_url":"https://github.com/Nebyt","followers_url":"https://api.github.com/users/Nebyt/followers","following_url":"https://api.github.com/users/Nebyt/following{/other_user}","gists_url":"https://api.github.com/users/Nebyt/gists{/gist_id}","starred_url":"https://api.github.com/users/Nebyt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nebyt/subscriptions","organizations_url":"https://api.github.com/users/Nebyt/orgs","repos_url":"https://api.github.com/users/Nebyt/repos","events_url":"https://api.github.com/users/Nebyt/events{/privacy}","received_events_url":"https://api.github.com/users/Nebyt/received_events","type":"User","site_admin":false},"body":"Issue #413 : try to handle MFC Toolbar","created_at":"2019-01-03T17:55:13Z","updated_at":"2019-01-04T20:59:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"940f464567d051217cd5c55ceadf72ffcce20dd2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pywinauto/pywinauto/pulls/646/commits","review_comments_url":"https://api.github.com/repos/pywinauto/pywinauto/pulls/646/comments","review_comment_url":"https://api.github.com/repos/pywinauto/pywinauto/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pywinauto/pywinauto/issues/646/comments","statuses_url":"https://api.github.com/repos/pywinauto/pywinauto/statuses/c2593c4b85f0189914b6cada2411500c1881f45a","head":{"label":"Nebyt:nebyt_pywinauto","ref":"nebyt_pywinauto","sha":"c2593c4b85f0189914b6cada2411500c1881f45a","user":{"login":"Nebyt","id":22872852,"node_id":"MDQ6VXNlcjIyODcyODUy","avatar_url":"https://avatars2.githubusercontent.com/u/22872852?v=4","gravatar_id":"","url":"https://api.github.com/users/Nebyt","html_url":"https://github.com/Nebyt","followers_url":"https://api.github.com/users/Nebyt/followers","following_url":"https://api.github.com/users/Nebyt/following{/other_user}","gists_url":"https://api.github.com/users/Nebyt/gists{/gist_id}","starred_url":"https://api.github.com/users/Nebyt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nebyt/subscriptions","organizations_url":"https://api.github.com/users/Nebyt/orgs","repos_url":"https://api.github.com/users/Nebyt/repos","events_url":"https://api.github.com/users/Nebyt/events{/privacy}","received_events_url":"https://api.github.com/users/Nebyt/received_events","type":"User","site_admin":false},"repo":{"id":147964880,"node_id":"MDEwOlJlcG9zaXRvcnkxNDc5NjQ4ODA=","name":"pywinauto","full_name":"Nebyt/pywinauto","private":false,"owner":{"login":"Nebyt","id":22872852,"node_id":"MDQ6VXNlcjIyODcyODUy","avatar_url":"https://avatars2.githubusercontent.com/u/22872852?v=4","gravatar_id":"","url":"https://api.github.com/users/Nebyt","html_url":"https://github.com/Nebyt","followers_url":"https://api.github.com/users/Nebyt/followers","following_url":"https://api.github.com/users/Nebyt/following{/other_user}","gists_url":"https://api.github.com/users/Nebyt/gists{/gist_id}","starred_url":"https://api.github.com/users/Nebyt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nebyt/subscriptions","organizations_url":"https://api.github.com/users/Nebyt/orgs","repos_url":"https://api.github.com/users/Nebyt/repos","events_url":"https://api.github.com/users/Nebyt/events{/privacy}","received_events_url":"https://api.github.com/users/Nebyt/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Nebyt/pywinauto","description":"Windows GUI Automation with Python","fork":true,"url":"https://api.github.com/repos/Nebyt/pywinauto","forks_url":"https://api.github.com/repos/Nebyt/pywinauto/forks","keys_url":"https://api.github.com/repos/Nebyt/pywinauto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Nebyt/pywinauto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Nebyt/pywinauto/teams","hooks_url":"https://api.github.com/repos/Nebyt/pywinauto/hooks","issue_events_url":"https://api.github.com/repos/Nebyt/pywinauto/issues/events{/number}","events_url":"https://api.github.com/repos/Nebyt/pywinauto/events","assignees_url":"https://api.github.com/repos/Nebyt/pywinauto/assignees{/user}","branches_url":"https://api.github.com/repos/Nebyt/pywinauto/branches{/branch}","tags_url":"https://api.github.com/repos/Nebyt/pywinauto/tags","blobs_url":"https://api.github.com/repos/Nebyt/pywinauto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Nebyt/pywinauto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Nebyt/pywinauto/git/refs{/sha}","trees_url":"https://api.github.com/repos/Nebyt/pywinauto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Nebyt/pywinauto/statuses/{sha}","languages_url":"https://api.github.com/repos/Nebyt/pywinauto/languages","stargazers_url":"https://api.github.com/repos/Nebyt/pywinauto/stargazers","contributors_url":"https://api.github.com/repos/Nebyt/pywinauto/contributors","subscribers_url":"https://api.github.com/repos/Nebyt/pywinauto/subscribers","subscription_url":"https://api.github.com/repos/Nebyt/pywinauto/subscription","commits_url":"https://api.github.com/repos/Nebyt/pywinauto/commits{/sha}","git_commits_url":"https://api.github.com/repos/Nebyt/pywinauto/git/commits{/sha}","comments_url":"https://api.github.com/repos/Nebyt/pywinauto/comments{/number}","issue_comment_url":"https://api.github.com/repos/Nebyt/pywinauto/issues/comments{/number}","contents_url":"https://api.github.com/repos/Nebyt/pywinauto/contents/{+path}","compare_url":"https://api.github.com/repos/Nebyt/pywinauto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Nebyt/pywinauto/merges","archive_url":"https://api.github.com/repos/Nebyt/pywinauto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Nebyt/pywinauto/downloads","issues_url":"https://api.github.com/repos/Nebyt/pywinauto/issues{/number}","pulls_url":"https://api.github.com/repos/Nebyt/pywinauto/pulls{/number}","milestones_url":"https://api.github.com/repos/Nebyt/pywinauto/milestones{/number}","notifications_url":"https://api.github.com/repos/Nebyt/pywinauto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Nebyt/pywinauto/labels{/name}","releases_url":"https://api.github.com/repos/Nebyt/pywinauto/releases{/id}","deployments_url":"https://api.github.com/repos/Nebyt/pywinauto/deployments","created_at":"2018-09-08T19:47:23Z","updated_at":"2018-09-08T19:47:26Z","pushed_at":"2019-01-03T17:53:25Z","git_url":"git://github.com/Nebyt/pywinauto.git","ssh_url":"git@github.com:Nebyt/pywinauto.git","clone_url":"https://github.com/Nebyt/pywinauto.git","svn_url":"https://github.com/Nebyt/pywinauto","homepage":"http://pywinauto.github.io/","size":22098,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pywinauto:master","ref":"master","sha":"4609ef878429895005afdb72bc675aaadebb26af","user":{"login":"pywinauto","id":12541065,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNTQxMDY1","avatar_url":"https://avatars1.githubusercontent.com/u/12541065?v=4","gravatar_id":"","url":"https://api.github.com/users/pywinauto","html_url":"https://github.com/pywinauto","followers_url":"https://api.github.com/users/pywinauto/followers","following_url":"https://api.github.com/users/pywinauto/following{/other_user}","gists_url":"https://api.github.com/users/pywinauto/gists{/gist_id}","starred_url":"https://api.github.com/users/pywinauto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pywinauto/subscriptions","organizations_url":"https://api.github.com/users/pywinauto/orgs","repos_url":"https://api.github.com/users/pywinauto/repos","events_url":"https://api.github.com/users/pywinauto/events{/privacy}","received_events_url":"https://api.github.com/users/pywinauto/received_events","type":"Organization","site_admin":false},"repo":{"id":36223210,"node_id":"MDEwOlJlcG9zaXRvcnkzNjIyMzIxMA==","name":"pywinauto","full_name":"pywinauto/pywinauto","private":false,"owner":{"login":"pywinauto","id":12541065,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNTQxMDY1","avatar_url":"https://avatars1.githubusercontent.com/u/12541065?v=4","gravatar_id":"","url":"https://api.github.com/users/pywinauto","html_url":"https://github.com/pywinauto","followers_url":"https://api.github.com/users/pywinauto/followers","following_url":"https://api.github.com/users/pywinauto/following{/other_user}","gists_url":"https://api.github.com/users/pywinauto/gists{/gist_id}","starred_url":"https://api.github.com/users/pywinauto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pywinauto/subscriptions","organizations_url":"https://api.github.com/users/pywinauto/orgs","repos_url":"https://api.github.com/users/pywinauto/repos","events_url":"https://api.github.com/users/pywinauto/events{/privacy}","received_events_url":"https://api.github.com/users/pywinauto/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pywinauto/pywinauto","description":"Windows GUI Automation with Python","fork":false,"url":"https://api.github.com/repos/pywinauto/pywinauto","forks_url":"https://api.github.com/repos/pywinauto/pywinauto/forks","keys_url":"https://api.github.com/repos/pywinauto/pywinauto/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pywinauto/pywinauto/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pywinauto/pywinauto/teams","hooks_url":"https://api.github.com/repos/pywinauto/pywinauto/hooks","issue_events_url":"https://api.github.com/repos/pywinauto/pywinauto/issues/events{/number}","events_url":"https://api.github.com/repos/pywinauto/pywinauto/events","assignees_url":"https://api.github.com/repos/pywinauto/pywinauto/assignees{/user}","branches_url":"https://api.github.com/repos/pywinauto/pywinauto/branches{/branch}","tags_url":"https://api.github.com/repos/pywinauto/pywinauto/tags","blobs_url":"https://api.github.com/repos/pywinauto/pywinauto/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pywinauto/pywinauto/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pywinauto/pywinauto/git/refs{/sha}","trees_url":"https://api.github.com/repos/pywinauto/pywinauto/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pywinauto/pywinauto/statuses/{sha}","languages_url":"https://api.github.com/repos/pywinauto/pywinauto/languages","stargazers_url":"https://api.github.com/repos/pywinauto/pywinauto/stargazers","contributors_url":"https://api.github.com/repos/pywinauto/pywinauto/contributors","subscribers_url":"https://api.github.com/repos/pywinauto/pywinauto/subscribers","subscription_url":"https://api.github.com/repos/pywinauto/pywinauto/subscription","commits_url":"https://api.github.com/repos/pywinauto/pywinauto/commits{/sha}","git_commits_url":"https://api.github.com/repos/pywinauto/pywinauto/git/commits{/sha}","comments_url":"https://api.github.com/repos/pywinauto/pywinauto/comments{/number}","issue_comment_url":"https://api.github.com/repos/pywinauto/pywinauto/issues/comments{/number}","contents_url":"https://api.github.com/repos/pywinauto/pywinauto/contents/{+path}","compare_url":"https://api.github.com/repos/pywinauto/pywinauto/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pywinauto/pywinauto/merges","archive_url":"https://api.github.com/repos/pywinauto/pywinauto/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pywinauto/pywinauto/downloads","issues_url":"https://api.github.com/repos/pywinauto/pywinauto/issues{/number}","pulls_url":"https://api.github.com/repos/pywinauto/pywinauto/pulls{/number}","milestones_url":"https://api.github.com/repos/pywinauto/pywinauto/milestones{/number}","notifications_url":"https://api.github.com/repos/pywinauto/pywinauto/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pywinauto/pywinauto/labels{/name}","releases_url":"https://api.github.com/repos/pywinauto/pywinauto/releases{/id}","deployments_url":"https://api.github.com/repos/pywinauto/pywinauto/deployments","created_at":"2015-05-25T09:50:40Z","updated_at":"2019-01-04T07:40:51Z","pushed_at":"2019-01-04T12:07:48Z","git_url":"git://github.com/pywinauto/pywinauto.git","ssh_url":"git@github.com:pywinauto/pywinauto.git","clone_url":"https://github.com/pywinauto/pywinauto.git","svn_url":"https://github.com/pywinauto/pywinauto","homepage":"http://pywinauto.github.io/","size":22241,"stargazers_count":1238,"watchers_count":1238,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":283,"mirror_url":null,"archived":false,"open_issues_count":150,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":283,"open_issues":150,"watchers":1238,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pywinauto/pywinauto/pulls/646"},"html":{"href":"https://github.com/pywinauto/pywinauto/pull/646"},"issue":{"href":"https://api.github.com/repos/pywinauto/pywinauto/issues/646"},"comments":{"href":"https://api.github.com/repos/pywinauto/pywinauto/issues/646/comments"},"review_comments":{"href":"https://api.github.com/repos/pywinauto/pywinauto/pulls/646/comments"},"review_comment":{"href":"https://api.github.com/repos/pywinauto/pywinauto/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pywinauto/pywinauto/pulls/646/commits"},"statuses":{"href":"https://api.github.com/repos/pywinauto/pywinauto/statuses/c2593c4b85f0189914b6cada2411500c1881f45a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Nebyt"}}