diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py index cf3d204c..37730f82 100644 --- a/gui/qt/__init__.py +++ b/gui/qt/__init__.py @@ -43,9 +43,9 @@ from electrum.paymentrequest import InvoiceStore from electrum.contacts import Contacts from electrum.synchronizer import Synchronizer from electrum.verifier import SPV -from electrum.util import DebugMem +from electrum.util import DebugMem, UserCancelled from electrum.wallet import Abstract_Wallet -from installwizard import InstallWizard +from installwizard import InstallWizard, GoBack try: @@ -191,6 +191,10 @@ class ElectrumGui: def main(self): try: self.init_network() + except UserCancelled: + return + except GoBack: + return except: traceback.print_exc(file=sys.stdout) return diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py index 8329b8e5..51be7e53 100644 --- a/gui/qt/installwizard.py +++ b/gui/qt/installwizard.py @@ -396,6 +396,7 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard): choices = [_("Auto connect"), _("Select server manually")] title = _("How do you want to connect to a server? ") clayout = ChoicesLayout(message, choices) + self.back_button.setText(_('Cancel')) self.set_main_layout(clayout.layout(), title) r = clayout.selected_index() if r == 0: diff --git a/lib/blockchain.py b/lib/blockchain.py index f98d45e8..c68ccfec 100644 --- a/lib/blockchain.py +++ b/lib/blockchain.py @@ -112,7 +112,8 @@ class Blockchain(util.PrintError): import urllib, socket socket.setdefaulttimeout(30) self.print_error("downloading ", self.headers_url) - urllib.urlretrieve(self.headers_url, filename) + urllib.urlretrieve(self.headers_url, filename + '.tmp') + os.rename(filename + '.tmp', filename) self.print_error("done.") except Exception: self.print_error("download failed. creating file", filename) diff --git a/lib/network.py b/lib/network.py index 8bb2b7c0..25ccfb0d 100644 --- a/lib/network.py +++ b/lib/network.py @@ -813,7 +813,12 @@ class Network(util.DaemonThread): self.process_responses(interface) def run(self): - self.blockchain.init() + import threading + t = threading.Thread(target = self.blockchain.init) + t.daemon = True + t.start() + while t.isAlive() and self.is_running(): + t.join(1) while self.is_running(): self.maintain_sockets() self.wait_on_sockets()