tnetwork dialog: include protocol in server address field (#6624) - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 292016d28375c8412c790ee77efd34f7c38b1c33 DIR parent 83143f421a24559541ff9c7490ee7d5d541627bf HTML Author: bitromortac <bitromortac@protonmail.com> Date: Wed, 14 Oct 2020 18:28:31 +0200 network dialog: include protocol in server address field (#6624) * network-dialog: include protocol in server field In this way it is now possible again to use plain server connections without reverting it automatically to tls connections. * qt network dialog: hide trailing protocol ":s" in TextEdit This hides some complexity from casual users, while still allowing advanced users to set the protocol. Co-authored-by: SomberNight <somber.night@protonmail.com> Diffstat: M electrum/gui/qt/network_dialog.py | 2 +- M electrum/interface.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) --- DIR diff --git a/electrum/gui/qt/network_dialog.py b/electrum/gui/qt/network_dialog.py t@@ -327,7 +327,7 @@ class NetworkChoiceLayout(object): server = net_params.server auto_connect = net_params.auto_connect if not self.server_e.hasFocus(): - self.server_e.setText(server.net_addr_str()) + self.server_e.setText(server.to_friendly_name()) self.autoconnect_cb.setChecked(auto_connect) height_str = "%d "%(self.network.get_local_height()) + _('blocks') DIR diff --git a/electrum/interface.py b/electrum/interface.py t@@ -294,6 +294,12 @@ class ServerAddr: protocol = PREFERRED_NETWORK_PROTOCOL return ServerAddr(host=host, port=port, protocol=protocol) + def to_friendly_name(self) -> str: + # note: this method is closely linked to from_str_with_inference + if self.protocol == 's': # hide trailing ":s" + return self.net_addr_str() + return str(self) + def __str__(self): return '{}:{}'.format(self.net_addr_str(), self.protocol)