commit 292016d28375c8412c790ee77efd34f7c38b1c33
parent 83143f421a24559541ff9c7490ee7d5d541627bf
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:
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/electrum/gui/qt/network_dialog.py b/electrum/gui/qt/network_dialog.py
@@ -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')
diff --git a/electrum/interface.py b/electrum/interface.py
@@ -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)