URI: 
       tinit_headers in daemon thread, and fix #1996 - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 8249f5ab67a8fa70cfa2909fec972259fcd2cfc8
   DIR parent bfe7e9dc6edba1a308d1199846e8f2d4cd355192
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Mon, 24 Oct 2016 14:57:02 +0200
       
       init_headers in daemon thread, and fix #1996
       
       Diffstat:
         M gui/qt/__init__.py                  |       8 ++++++--
         M gui/qt/installwizard.py             |       1 +
         M lib/blockchain.py                   |       3 ++-
         M lib/network.py                      |       7 ++++++-
       
       4 files changed, 15 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/gui/qt/__init__.py b/gui/qt/__init__.py
       t@@ -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:
       t@@ -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
   DIR diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py
       t@@ -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:
   DIR diff --git a/lib/blockchain.py b/lib/blockchain.py
       t@@ -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)
   DIR diff --git a/lib/network.py b/lib/network.py
       t@@ -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()