Beispiel #1
0
 def network_dialog(self):
     if not self.network:
         return
     net_params = self.network.get_parameters()
     host, port, protocol = net_params.host, net_params.port, net_params.protocol
     proxy_config, auto_connect = net_params.proxy, net_params.auto_connect
     srv = 'auto-connect' if auto_connect else self.network.default_server
     out = self.run_dialog('Network', [
         {
             'label': 'server',
             'type': 'str',
             'value': srv
         },
         {
             'label': 'proxy',
             'type': 'str',
             'value': self.config.get('proxy', '')
         },
     ],
                           buttons=1)
     if out:
         if out.get('server'):
             server = out.get('server')
             auto_connect = server == 'auto-connect'
             if not auto_connect:
                 try:
                     host, port, protocol = deserialize_server(server)
                 except Exception:
                     self.show_message("Error:" + server +
                                       "\nIn doubt, type \"auto-connect\"")
                     return False
         if out.get('server') or out.get('proxy'):
             proxy = electrum_mona.network.deserialize_proxy(
                 out.get('proxy')) if out.get('proxy') else proxy_config
             net_params = NetworkParameters(host, port, protocol, proxy,
                                            auto_connect)
             self.network.run_from_another_thread(
                 self.network.set_parameters(net_params))
Beispiel #2
0
 def set_server(self, s):
     host, port, protocol = deserialize_server(s)
     self.parent.server_host.setText(host)
     self.parent.server_port.setText(port)
     self.parent.set_server()