Merge branch 'master' of git://github.com/spesmilo/electrum
This commit is contained in:
commit
5a3756b879
|
@ -158,27 +158,21 @@ class Plugin(BasePlugin):
|
||||||
|
|
||||||
check_for_api_key(self.auth_token())
|
check_for_api_key(self.auth_token())
|
||||||
|
|
||||||
|
self.window.labelsChanged.connect(self.done_processing)
|
||||||
|
|
||||||
if d.exec_():
|
if d.exec_():
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def done_processing(self):
|
||||||
|
QMessageBox.information(None, _("Labels synchronised"), _("Your labels have been synchronised."))
|
||||||
|
|
||||||
def full_push(self):
|
def full_push(self):
|
||||||
if self.do_full_push():
|
threading.Thread(target=self.do_full_push).start()
|
||||||
QMessageBox.information(None, _("Labels uploaded"), _("Your labels have been uploaded."))
|
|
||||||
|
|
||||||
def full_pull(self):
|
def full_pull(self):
|
||||||
try:
|
threading.Thread(target=self.do_full_pull, args=([True])).start()
|
||||||
self.do_full_pull(True)
|
|
||||||
except BaseException as e:
|
|
||||||
QMessageBox.information(None, _("Error"), str(e))
|
|
||||||
return
|
|
||||||
QMessageBox.information(None, _("Labels synchronized"), _("Your labels have been synchronized."))
|
|
||||||
self.window.update_history_tab()
|
|
||||||
self.window.update_completions()
|
|
||||||
self.window.update_receive_tab()
|
|
||||||
self.window.update_contacts_tab()
|
|
||||||
|
|
||||||
def do_full_push(self):
|
def do_full_push(self):
|
||||||
try:
|
try:
|
||||||
|
@ -202,21 +196,24 @@ class Plugin(BasePlugin):
|
||||||
|
|
||||||
response = connection.getresponse()
|
response = connection.getresponse()
|
||||||
if response.reason == httplib.responses[httplib.NOT_FOUND]:
|
if response.reason == httplib.responses[httplib.NOT_FOUND]:
|
||||||
|
print_error('404 error' % e)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
response = json.loads(response.read())
|
response = json.loads(response.read())
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
|
print_error('Error loading labelsync response: %s' % e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if "error" in response:
|
if "error" in response:
|
||||||
QMessageBox.warning(None, _("Error"),_("Could not sync labels: %s" % response["error"]))
|
print_error('Error loading labelsync response.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
|
||||||
except socket.gaierror as e:
|
except socket.gaierror as e:
|
||||||
print_error('Error connecting to service: %s ' % e)
|
print_error('Error connecting to service: %s ' % e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
self.window.labelsChanged.emit()
|
||||||
|
|
||||||
def do_full_pull(self, force = False):
|
def do_full_pull(self, force = False):
|
||||||
connection = httplib.HTTPConnection(self.target_host)
|
connection = httplib.HTTPConnection(self.target_host)
|
||||||
connection.request("GET", ("/api/wallets/%s/labels.json?auth_token=%s" % (self.wallet_id, self.auth_token())),"", {'Content-Type': 'application/json'})
|
connection.request("GET", ("/api/wallets/%s/labels.json?auth_token=%s" % (self.wallet_id, self.auth_token())),"", {'Content-Type': 'application/json'})
|
||||||
|
|
Loading…
Reference in New Issue