mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-29 16:31:29 +00:00
better protocol handling in gui
This commit is contained in:
parent
f1c9aa6603
commit
fb6a1a0720
1 changed files with 17 additions and 11 deletions
|
@ -1425,9 +1425,6 @@ class ElectrumWindow(QMainWindow):
|
||||||
server_protocol.addItems(protocol_names)
|
server_protocol.addItems(protocol_names)
|
||||||
|
|
||||||
host, port, protocol = server.split(':')
|
host, port, protocol = server.split(':')
|
||||||
server_host.setText(host)
|
|
||||||
server_port.setText(port)
|
|
||||||
server_protocol.setCurrentIndex(protocol_letters.index(protocol))
|
|
||||||
|
|
||||||
grid.addWidget(QLabel(_('Server') + ':'), 0, 0)
|
grid.addWidget(QLabel(_('Server') + ':'), 0, 0)
|
||||||
grid.addWidget(server_protocol, 0, 1)
|
grid.addWidget(server_protocol, 0, 1)
|
||||||
|
@ -1458,14 +1455,21 @@ class ElectrumWindow(QMainWindow):
|
||||||
for host in plist.keys():
|
for host in plist.keys():
|
||||||
servers_list_widget.addTopLevelItem(QTreeWidgetItem( [ host ] ))
|
servers_list_widget.addTopLevelItem(QTreeWidgetItem( [ host ] ))
|
||||||
|
|
||||||
def change_server(x):
|
def change_server(host, protocol=None):
|
||||||
host = unicode(x.text(0))
|
|
||||||
pp = plist[host]
|
pp = plist[host]
|
||||||
if 't' in pp.keys():
|
if protocol:
|
||||||
protocol = 't'
|
port = pp.get(protocol)
|
||||||
else:
|
if not port: protocol = None
|
||||||
protocol = pp.keys()[0]
|
|
||||||
port = pp[protocol]
|
if not protocol:
|
||||||
|
if 't' in pp.keys():
|
||||||
|
protocol = 't'
|
||||||
|
else:
|
||||||
|
protocol = pp.keys()[0]
|
||||||
|
port = pp.get(protocol)
|
||||||
|
|
||||||
|
|
||||||
server_host.setText( host )
|
server_host.setText( host )
|
||||||
server_port.setText( port )
|
server_port.setText( port )
|
||||||
server_protocol.setCurrentIndex(protocol_letters.index(protocol))
|
server_protocol.setCurrentIndex(protocol_letters.index(protocol))
|
||||||
|
@ -1478,8 +1482,10 @@ class ElectrumWindow(QMainWindow):
|
||||||
else:
|
else:
|
||||||
server_protocol.model().setData(j, QtCore.QVariant(0,False), QtCore.Qt.UserRole-1)
|
server_protocol.model().setData(j, QtCore.QVariant(0,False), QtCore.Qt.UserRole-1)
|
||||||
|
|
||||||
|
change_server(host,protocol)
|
||||||
|
|
||||||
servers_list_widget.connect(servers_list_widget, SIGNAL('itemClicked(QTreeWidgetItem*, int)'), change_server)
|
|
||||||
|
servers_list_widget.connect(servers_list_widget, SIGNAL('itemClicked(QTreeWidgetItem*, int)'), lambda x: change_server(unicode(x.text(0))))
|
||||||
grid.addWidget(servers_list_widget, 1, 1, 1, 3)
|
grid.addWidget(servers_list_widget, 1, 1, 1, 3)
|
||||||
|
|
||||||
if not wallet.config.is_modifiable('server'):
|
if not wallet.config.is_modifiable('server'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue