tMerge pull request #365 from mkramlich/master - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit 132108434e000c29d742756577e161ddb53c7627 (DIR) parent c84cc5bb8b4fa38e7eaead5860a676f0275a9e6f (HTM) Author: ThomasV <thomasv1@gmx.de> Date: Tue, 5 Nov 2013 11:11:08 -0800 Merge pull request #365 from mkramlich/master FIX: make the curses text UI not crash when started in --offline mode Diffstat: M gui/text.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) --- (DIR) diff --git a/gui/text.py b/gui/text.py t@@ -22,7 +22,7 @@ class ElectrumGui: exit() self.wallet = Wallet(storage) - self.wallet.start_threads(network) + self.wallet.start_threads(self.network) locale.setlocale(locale.LC_ALL, '') self.encoding = locale.getpreferredencoding() t@@ -50,11 +50,13 @@ class ElectrumGui: self.str_amount = "" self.str_fee = "" self.history = None - - self.network.register_callback('updated', self.update) - self.network.register_callback('connected', self.refresh) - self.network.register_callback('disconnected', self.refresh) - self.network.register_callback('disconnecting', self.refresh) + + if self.network: + self.network.register_callback('updated', self.update) + self.network.register_callback('connected', self.refresh) + self.network.register_callback('disconnected', self.refresh) + self.network.register_callback('disconnecting', self.refresh) + self.tab_names = [_("History"), _("Send"), _("Receive"), _("Contacts"), _("Wall")] self.num_tabs = len(self.tab_names) t@@ -120,7 +122,7 @@ class ElectrumGui: def print_balance(self): - if self.network.interface and self.network.interface.is_connected: + if self.network and self.network.interface and self.network.interface.is_connected: if not self.wallet.up_to_date: msg = _( "Synchronizing..." ) else: t@@ -162,7 +164,8 @@ class ElectrumGui: self.stdscr.addstr( 12, 25, _("[Clear]"), curses.A_REVERSE if self.pos%6==5 else curses.color_pair(2)) def print_banner(self): - self.print_list( self.network.banner.split('\n')) + if self.network: + self.print_list( self.network.banner.split('\n')) def print_list(self, list, firstline = None): self.maxpos = len(list) t@@ -339,6 +342,7 @@ class ElectrumGui: def network_dialog(self): + if not self.network: return auto_connect = self.network.config.get('auto_cycle') host, port, protocol = self.network.default_server.split(':') srv = 'auto-connect' if auto_connect else self.network.default_server