diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py index 04937ca50..7243efcfa 100644 --- a/electrum/gui/kivy/main_window.py +++ b/electrum/gui/kivy/main_window.py @@ -109,6 +109,13 @@ class ElectrumWindow(App): def toggle_oneserver(self, x): self.oneserver = not self.oneserver + proxy_str = StringProperty('') + def update_proxy_str(self, proxy: dict): + mode = proxy.get('mode') + host = proxy.get('host') + port = proxy.get('port') + self.proxy_str = (host + ':' + port) if mode else _('None') + def choose_server_dialog(self, popup): from .uix.dialogs.choice_dialog import ChoiceDialog protocol = 's' @@ -288,6 +295,7 @@ class ElectrumWindow(App): self.auto_connect = net_params.auto_connect self.oneserver = net_params.oneserver self.proxy_config = net_params.proxy if net_params.proxy else {} + self.update_proxy_str(self.proxy_config) self.plugins = kwargs.get('plugins', []) self.gui_object = kwargs.get('gui_object', None) @@ -667,6 +675,7 @@ class ElectrumWindow(App): self.tabs = self.root.ids['tabs'] def update_interfaces(self, dt): + net_params = self.network.get_parameters() self.num_nodes = len(self.network.get_interfaces()) self.num_chains = len(self.network.get_blockchains()) chain = self.network.blockchain() @@ -675,6 +684,10 @@ class ElectrumWindow(App): interface = self.network.interface if interface: self.server_host = interface.host + else: + self.server_host = str(net_params.host) + ' (connecting...)' + self.proxy_config = net_params.proxy or {} + self.update_proxy_str(self.proxy_config) def on_network_event(self, event, *args): Logger.info('network event: '+ event) diff --git a/electrum/gui/kivy/uix/ui_screens/network.kv b/electrum/gui/kivy/uix/ui_screens/network.kv index 31363ce22..38476ac7b 100644 --- a/electrum/gui/kivy/uix/ui_screens/network.kv +++ b/electrum/gui/kivy/uix/ui_screens/network.kv @@ -24,10 +24,7 @@ Popup: CardSeparator SettingsItem: - proxy: app.proxy_config.get('mode') - host: app.proxy_config.get('host') - port: app.proxy_config.get('port') - title: _("Proxy") + ': ' + ((self.host +':' + self.port) if self.proxy else _('None')) + title: _("Proxy") + ': ' + app.proxy_str description: _('Proxy configuration') action: lambda x: app.popup_dialog('proxy') diff --git a/electrum/gui/kivy/uix/ui_screens/proxy.kv b/electrum/gui/kivy/uix/ui_screens/proxy.kv index 538caa052..9cde32c6a 100644 --- a/electrum/gui/kivy/uix/ui_screens/proxy.kv +++ b/electrum/gui/kivy/uix/ui_screens/proxy.kv @@ -73,5 +73,4 @@ Popup: if proxy['mode']=='none': proxy = None net_params = net_params._replace(proxy=proxy) app.network.run_from_another_thread(app.network.set_parameters(net_params)) - app.proxy_config = proxy if proxy else {} nd.dismiss() diff --git a/electrum/gui/kivy/uix/ui_screens/server.kv b/electrum/gui/kivy/uix/ui_screens/server.kv index 1864e0fb1..67ce06750 100644 --- a/electrum/gui/kivy/uix/ui_screens/server.kv +++ b/electrum/gui/kivy/uix/ui_screens/server.kv @@ -23,7 +23,7 @@ Popup: height: '36dp' size_hint_x: 3 size_hint_y: None - text: app.server_host + text: app.network.get_parameters().host Label: height: '36dp' size_hint_x: 1 @@ -36,7 +36,7 @@ Popup: height: '36dp' size_hint_x: 3 size_hint_y: None - text: app.server_port + text: app.network.get_parameters().port Widget Button: id: chooser