{"action":"created","comment":{"url":"https://api.github.com/repos/opengisch/QFieldSync/pulls/comments/73519190","id":73519190,"diff_hunk":"@@ -24,32 +24,66 @@\n from __future__ import absolute_import\n \n import os\n-from PyQt4 import QtGui, uic\n-from qgis.core import QgsMapLayerRegistry, QgsProject\n+\n+from PyQt4 import QtGui, QtCore, uic\n from PyQt4.QtGui import QDialogButtonBox, QPushButton\n-from .utils.usb import detect_devices, connect_device, push_file, \\\n-    disconnect_device\n+from qgis.gui import QgsMessageBar\n+\n+from .export_offline import offline_convert, get_layer_ids_to_offline_convert\n+from .data_source_utils import *\n+from .config import *\n+from .file_utils import fileparts, get_full_parent_path\n+from .qt_utils import make_folder_selector\n+from .qgis_utils import get_project_title\n+\n+try:\n+    from .utils.usb import detect_devices, connect_device, push_file, \\\n+        disconnect_device\n+except:\n+    from mock import MagicMock\n+    push_file = MagicMock()\n+    connect_device = MagicMock()\n+    disconnect_device = MagicMock()\n+    push_file = MagicMock()\n+    detect_devices = MagicMock(return_value=[(\"Fake Device\", MagicMock())])\n+\n+from .remote_options import RemoteOptionsDialog\n+\n \n FORM_CLASS, _ = uic.loadUiType(os.path.join(\n     os.path.dirname(__file__), 'push_dialog_base.ui'))\n \n \n+\n class PushDialog(QtGui.QDialog, FORM_CLASS):\n-    def __init__(self, parent=None):\n+    def __init__(self, iface, plugin_instance):\n         \"\"\"Constructor.\"\"\"\n-        super(PushDialog, self).__init__(parent)\n+        super(PushDialog, self).__init__(parent=None)\n         self.setupUi(self)\n+        self.iface = iface\n+        self.plugin_instance = plugin_instance\n         self.project = QgsProject.instance()\n-        self.project_lbl.setText(self.project.title())\n-        self.push_btn = QPushButton('Push')\n-        self.push_btn.clicked.connect(self.push_project)\n+        self.project_lbl.setText(get_project_title(self.project))\n+        self.push_btn = QPushButton(self.tr('Push'))\n+        if project_get_remote_layers():\n+            self.push_btn.clicked.connect(self.show_remote_options)\n+        else:\n+            self.push_btn.clicked.connect(self.push_project)\n         self.button_box.addButton(self.push_btn, QDialogButtonBox.ActionRole)\n \n         self.devices = None\n         self.refresh_devices()\n-        # self.suggest_offline_wdg.setEnabled(self.detect_online_layers())\n+        self.setup_tabs()\n+        self.cloud_tab.setEnabled(False)","path":"push_dialog.py","position":64,"original_position":64,"commit_id":"fcbce41e2118ef3d7e54ce576478a0600d0bf272","original_commit_id":"fcbce41e2118ef3d7e54ce576478a0600d0bf272","user":{"login":"mbernasocchi","id":233663,"avatar_url":"https://avatars.githubusercontent.com/u/233663?v=3","gravatar_id":"","url":"https://api.github.com/users/mbernasocchi","html_url":"https://github.com/mbernasocchi","followers_url":"https://api.github.com/users/mbernasocchi/followers","following_url":"https://api.github.com/users/mbernasocchi/following{/other_user}","gists_url":"https://api.github.com/users/mbernasocchi/gists{/gist_id}","starred_url":"https://api.github.com/users/mbernasocchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbernasocchi/subscriptions","organizations_url":"https://api.github.com/users/mbernasocchi/orgs","repos_url":"https://api.github.com/users/mbernasocchi/repos","events_url":"https://api.github.com/users/mbernasocchi/events{/privacy}","received_events_url":"https://api.github.com/users/mbernasocchi/received_events","type":"User","site_admin":false},"body":"self.cloud_tab.setEnabled(True)","created_at":"2016-08-04T13:16:49Z","updated_at":"2016-08-04T13:16:49Z","html_url":"https://github.com/opengisch/QFieldSync/pull/1#discussion_r73519190","pull_request_url":"https://api.github.com/repos/opengisch/QFieldSync/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/opengisch/QFieldSync/pulls/comments/73519190"},"html":{"href":"https://github.com/opengisch/QFieldSync/pull/1#discussion_r73519190"},"pull_request":{"href":"https://api.github.com/repos/opengisch/QFieldSync/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/opengisch/QFieldSync/pulls/1","id":71841120,"html_url":"https://github.com/opengisch/QFieldSync/pull/1","diff_url":"https://github.com/opengisch/QFieldSync/pull/1.diff","patch_url":"https://github.com/opengisch/QFieldSync/pull/1.patch","issue_url":"https://api.github.com/repos/opengisch/QFieldSync/issues/1","number":1,"state":"open","locked":false,"title":"Sync QGIS -> QField (WIP)","user":{"login":"carolinux","id":972075,"avatar_url":"https://avatars.githubusercontent.com/u/972075?v=3","gravatar_id":"","url":"https://api.github.com/users/carolinux","html_url":"https://github.com/carolinux","followers_url":"https://api.github.com/users/carolinux/followers","following_url":"https://api.github.com/users/carolinux/following{/other_user}","gists_url":"https://api.github.com/users/carolinux/gists{/gist_id}","starred_url":"https://api.github.com/users/carolinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carolinux/subscriptions","organizations_url":"https://api.github.com/users/carolinux/orgs","repos_url":"https://api.github.com/users/carolinux/repos","events_url":"https://api.github.com/users/carolinux/events{/privacy}","received_events_url":"https://api.github.com/users/carolinux/received_events","type":"User","site_admin":false},"body":"Opening this to be transparent about the progress of the project","created_at":"2016-05-29T23:29:57Z","updated_at":"2016-08-04T13:16:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e66bac1f45f01ce20a1f0abc56a306782b28e490","assignee":{"login":"mbernasocchi","id":233663,"avatar_url":"https://avatars.githubusercontent.com/u/233663?v=3","gravatar_id":"","url":"https://api.github.com/users/mbernasocchi","html_url":"https://github.com/mbernasocchi","followers_url":"https://api.github.com/users/mbernasocchi/followers","following_url":"https://api.github.com/users/mbernasocchi/following{/other_user}","gists_url":"https://api.github.com/users/mbernasocchi/gists{/gist_id}","starred_url":"https://api.github.com/users/mbernasocchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbernasocchi/subscriptions","organizations_url":"https://api.github.com/users/mbernasocchi/orgs","repos_url":"https://api.github.com/users/mbernasocchi/repos","events_url":"https://api.github.com/users/mbernasocchi/events{/privacy}","received_events_url":"https://api.github.com/users/mbernasocchi/received_events","type":"User","site_admin":false},"assignees":[{"login":"mbernasocchi","id":233663,"avatar_url":"https://avatars.githubusercontent.com/u/233663?v=3","gravatar_id":"","url":"https://api.github.com/users/mbernasocchi","html_url":"https://github.com/mbernasocchi","followers_url":"https://api.github.com/users/mbernasocchi/followers","following_url":"https://api.github.com/users/mbernasocchi/following{/other_user}","gists_url":"https://api.github.com/users/mbernasocchi/gists{/gist_id}","starred_url":"https://api.github.com/users/mbernasocchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbernasocchi/subscriptions","organizations_url":"https://api.github.com/users/mbernasocchi/orgs","repos_url":"https://api.github.com/users/mbernasocchi/repos","events_url":"https://api.github.com/users/mbernasocchi/events{/privacy}","received_events_url":"https://api.github.com/users/mbernasocchi/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/opengisch/QFieldSync/milestones/1","html_url":"https://github.com/opengisch/QFieldSync/milestones/alpha%20release","labels_url":"https://api.github.com/repos/opengisch/QFieldSync/milestones/1/labels","id":1875580,"number":1,"title":"alpha release","description":"","creator":{"login":"mbernasocchi","id":233663,"avatar_url":"https://avatars.githubusercontent.com/u/233663?v=3","gravatar_id":"","url":"https://api.github.com/users/mbernasocchi","html_url":"https://github.com/mbernasocchi","followers_url":"https://api.github.com/users/mbernasocchi/followers","following_url":"https://api.github.com/users/mbernasocchi/following{/other_user}","gists_url":"https://api.github.com/users/mbernasocchi/gists{/gist_id}","starred_url":"https://api.github.com/users/mbernasocchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbernasocchi/subscriptions","organizations_url":"https://api.github.com/users/mbernasocchi/orgs","repos_url":"https://api.github.com/users/mbernasocchi/repos","events_url":"https://api.github.com/users/mbernasocchi/events{/privacy}","received_events_url":"https://api.github.com/users/mbernasocchi/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":1,"state":"open","created_at":"2016-07-11T11:45:59Z","updated_at":"2016-07-13T21:04:47Z","due_on":"2016-07-14T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/opengisch/QFieldSync/pulls/1/commits","review_comments_url":"https://api.github.com/repos/opengisch/QFieldSync/pulls/1/comments","review_comment_url":"https://api.github.com/repos/opengisch/QFieldSync/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opengisch/QFieldSync/issues/1/comments","statuses_url":"https://api.github.com/repos/opengisch/QFieldSync/statuses/fcbce41e2118ef3d7e54ce576478a0600d0bf272","head":{"label":"carolinux:master","ref":"master","sha":"fcbce41e2118ef3d7e54ce576478a0600d0bf272","user":{"login":"carolinux","id":972075,"avatar_url":"https://avatars.githubusercontent.com/u/972075?v=3","gravatar_id":"","url":"https://api.github.com/users/carolinux","html_url":"https://github.com/carolinux","followers_url":"https://api.github.com/users/carolinux/followers","following_url":"https://api.github.com/users/carolinux/following{/other_user}","gists_url":"https://api.github.com/users/carolinux/gists{/gist_id}","starred_url":"https://api.github.com/users/carolinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carolinux/subscriptions","organizations_url":"https://api.github.com/users/carolinux/orgs","repos_url":"https://api.github.com/users/carolinux/repos","events_url":"https://api.github.com/users/carolinux/events{/privacy}","received_events_url":"https://api.github.com/users/carolinux/received_events","type":"User","site_admin":false},"repo":{"id":58917916,"name":"QFieldSync","full_name":"carolinux/QFieldSync","owner":{"login":"carolinux","id":972075,"avatar_url":"https://avatars.githubusercontent.com/u/972075?v=3","gravatar_id":"","url":"https://api.github.com/users/carolinux","html_url":"https://github.com/carolinux","followers_url":"https://api.github.com/users/carolinux/followers","following_url":"https://api.github.com/users/carolinux/following{/other_user}","gists_url":"https://api.github.com/users/carolinux/gists{/gist_id}","starred_url":"https://api.github.com/users/carolinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carolinux/subscriptions","organizations_url":"https://api.github.com/users/carolinux/orgs","repos_url":"https://api.github.com/users/carolinux/repos","events_url":"https://api.github.com/users/carolinux/events{/privacy}","received_events_url":"https://api.github.com/users/carolinux/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carolinux/QFieldSync","description":"Sync your projects to QField on android","fork":true,"url":"https://api.github.com/repos/carolinux/QFieldSync","forks_url":"https://api.github.com/repos/carolinux/QFieldSync/forks","keys_url":"https://api.github.com/repos/carolinux/QFieldSync/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carolinux/QFieldSync/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carolinux/QFieldSync/teams","hooks_url":"https://api.github.com/repos/carolinux/QFieldSync/hooks","issue_events_url":"https://api.github.com/repos/carolinux/QFieldSync/issues/events{/number}","events_url":"https://api.github.com/repos/carolinux/QFieldSync/events","assignees_url":"https://api.github.com/repos/carolinux/QFieldSync/assignees{/user}","branches_url":"https://api.github.com/repos/carolinux/QFieldSync/branches{/branch}","tags_url":"https://api.github.com/repos/carolinux/QFieldSync/tags","blobs_url":"https://api.github.com/repos/carolinux/QFieldSync/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carolinux/QFieldSync/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carolinux/QFieldSync/git/refs{/sha}","trees_url":"https://api.github.com/repos/carolinux/QFieldSync/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carolinux/QFieldSync/statuses/{sha}","languages_url":"https://api.github.com/repos/carolinux/QFieldSync/languages","stargazers_url":"https://api.github.com/repos/carolinux/QFieldSync/stargazers","contributors_url":"https://api.github.com/repos/carolinux/QFieldSync/contributors","subscribers_url":"https://api.github.com/repos/carolinux/QFieldSync/subscribers","subscription_url":"https://api.github.com/repos/carolinux/QFieldSync/subscription","commits_url":"https://api.github.com/repos/carolinux/QFieldSync/commits{/sha}","git_commits_url":"https://api.github.com/repos/carolinux/QFieldSync/git/commits{/sha}","comments_url":"https://api.github.com/repos/carolinux/QFieldSync/comments{/number}","issue_comment_url":"https://api.github.com/repos/carolinux/QFieldSync/issues/comments{/number}","contents_url":"https://api.github.com/repos/carolinux/QFieldSync/contents/{+path}","compare_url":"https://api.github.com/repos/carolinux/QFieldSync/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carolinux/QFieldSync/merges","archive_url":"https://api.github.com/repos/carolinux/QFieldSync/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carolinux/QFieldSync/downloads","issues_url":"https://api.github.com/repos/carolinux/QFieldSync/issues{/number}","pulls_url":"https://api.github.com/repos/carolinux/QFieldSync/pulls{/number}","milestones_url":"https://api.github.com/repos/carolinux/QFieldSync/milestones{/number}","notifications_url":"https://api.github.com/repos/carolinux/QFieldSync/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carolinux/QFieldSync/labels{/name}","releases_url":"https://api.github.com/repos/carolinux/QFieldSync/releases{/id}","deployments_url":"https://api.github.com/repos/carolinux/QFieldSync/deployments","created_at":"2016-05-16T08:54:53Z","updated_at":"2016-05-16T08:54:55Z","pushed_at":"2016-07-14T15:56:10Z","git_url":"git://github.com/carolinux/QFieldSync.git","ssh_url":"git@github.com:carolinux/QFieldSync.git","clone_url":"https://github.com/carolinux/QFieldSync.git","svn_url":"https://github.com/carolinux/QFieldSync","homepage":null,"size":87,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opengisch:master","ref":"master","sha":"7cebd08c96b87bb7115cd7a8d6dddb3432b1c9d6","user":{"login":"opengisch","id":8892251,"avatar_url":"https://avatars.githubusercontent.com/u/8892251?v=3","gravatar_id":"","url":"https://api.github.com/users/opengisch","html_url":"https://github.com/opengisch","followers_url":"https://api.github.com/users/opengisch/followers","following_url":"https://api.github.com/users/opengisch/following{/other_user}","gists_url":"https://api.github.com/users/opengisch/gists{/gist_id}","starred_url":"https://api.github.com/users/opengisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opengisch/subscriptions","organizations_url":"https://api.github.com/users/opengisch/orgs","repos_url":"https://api.github.com/users/opengisch/repos","events_url":"https://api.github.com/users/opengisch/events{/privacy}","received_events_url":"https://api.github.com/users/opengisch/received_events","type":"Organization","site_admin":false},"repo":{"id":35961740,"name":"QFieldSync","full_name":"opengisch/QFieldSync","owner":{"login":"opengisch","id":8892251,"avatar_url":"https://avatars.githubusercontent.com/u/8892251?v=3","gravatar_id":"","url":"https://api.github.com/users/opengisch","html_url":"https://github.com/opengisch","followers_url":"https://api.github.com/users/opengisch/followers","following_url":"https://api.github.com/users/opengisch/following{/other_user}","gists_url":"https://api.github.com/users/opengisch/gists{/gist_id}","starred_url":"https://api.github.com/users/opengisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opengisch/subscriptions","organizations_url":"https://api.github.com/users/opengisch/orgs","repos_url":"https://api.github.com/users/opengisch/repos","events_url":"https://api.github.com/users/opengisch/events{/privacy}","received_events_url":"https://api.github.com/users/opengisch/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opengisch/QFieldSync","description":"Sync your projects to QField on android","fork":false,"url":"https://api.github.com/repos/opengisch/QFieldSync","forks_url":"https://api.github.com/repos/opengisch/QFieldSync/forks","keys_url":"https://api.github.com/repos/opengisch/QFieldSync/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opengisch/QFieldSync/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opengisch/QFieldSync/teams","hooks_url":"https://api.github.com/repos/opengisch/QFieldSync/hooks","issue_events_url":"https://api.github.com/repos/opengisch/QFieldSync/issues/events{/number}","events_url":"https://api.github.com/repos/opengisch/QFieldSync/events","assignees_url":"https://api.github.com/repos/opengisch/QFieldSync/assignees{/user}","branches_url":"https://api.github.com/repos/opengisch/QFieldSync/branches{/branch}","tags_url":"https://api.github.com/repos/opengisch/QFieldSync/tags","blobs_url":"https://api.github.com/repos/opengisch/QFieldSync/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opengisch/QFieldSync/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opengisch/QFieldSync/git/refs{/sha}","trees_url":"https://api.github.com/repos/opengisch/QFieldSync/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opengisch/QFieldSync/statuses/{sha}","languages_url":"https://api.github.com/repos/opengisch/QFieldSync/languages","stargazers_url":"https://api.github.com/repos/opengisch/QFieldSync/stargazers","contributors_url":"https://api.github.com/repos/opengisch/QFieldSync/contributors","subscribers_url":"https://api.github.com/repos/opengisch/QFieldSync/subscribers","subscription_url":"https://api.github.com/repos/opengisch/QFieldSync/subscription","commits_url":"https://api.github.com/repos/opengisch/QFieldSync/commits{/sha}","git_commits_url":"https://api.github.com/repos/opengisch/QFieldSync/git/commits{/sha}","comments_url":"https://api.github.com/repos/opengisch/QFieldSync/comments{/number}","issue_comment_url":"https://api.github.com/repos/opengisch/QFieldSync/issues/comments{/number}","contents_url":"https://api.github.com/repos/opengisch/QFieldSync/contents/{+path}","compare_url":"https://api.github.com/repos/opengisch/QFieldSync/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opengisch/QFieldSync/merges","archive_url":"https://api.github.com/repos/opengisch/QFieldSync/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opengisch/QFieldSync/downloads","issues_url":"https://api.github.com/repos/opengisch/QFieldSync/issues{/number}","pulls_url":"https://api.github.com/repos/opengisch/QFieldSync/pulls{/number}","milestones_url":"https://api.github.com/repos/opengisch/QFieldSync/milestones{/number}","notifications_url":"https://api.github.com/repos/opengisch/QFieldSync/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opengisch/QFieldSync/labels{/name}","releases_url":"https://api.github.com/repos/opengisch/QFieldSync/releases{/id}","deployments_url":"https://api.github.com/repos/opengisch/QFieldSync/deployments","created_at":"2015-05-20T16:59:39Z","updated_at":"2016-06-09T19:17:53Z","pushed_at":"2016-07-14T15:56:10Z","git_url":"git://github.com/opengisch/QFieldSync.git","ssh_url":"git@github.com:opengisch/QFieldSync.git","clone_url":"https://github.com/opengisch/QFieldSync.git","svn_url":"https://github.com/opengisch/QFieldSync","homepage":null,"size":42,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":8,"forks":1,"open_issues":8,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opengisch/QFieldSync/pulls/1"},"html":{"href":"https://github.com/opengisch/QFieldSync/pull/1"},"issue":{"href":"https://api.github.com/repos/opengisch/QFieldSync/issues/1"},"comments":{"href":"https://api.github.com/repos/opengisch/QFieldSync/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/opengisch/QFieldSync/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/opengisch/QFieldSync/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opengisch/QFieldSync/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/opengisch/QFieldSync/statuses/fcbce41e2118ef3d7e54ce576478a0600d0bf272"}}}}
{"actor":{"display_login":"mbernasocchi"}}