Browse Source

default port

283
thomasv 13 years ago
parent
commit
7fd701ea8f
  1. 9
      client/gui_qt.py
  2. 12
      client/interface.py
  3. 5
      client/wallet.py

9
client/gui_qt.py

@ -787,7 +787,8 @@ class ElectrumWindow(QMainWindow):
show_message("no seed") show_message("no seed")
sys.exit(1) sys.exit(1)
wallet.seed = seed wallet.seed = str(seed)
#print repr(wallet.seed)
wallet.gap_limit = gap wallet.gap_limit = gap
return True return True
@ -840,7 +841,7 @@ class ElectrumWindow(QMainWindow):
import random import random
status = "Please choose a server." status = "Please choose a server."
host = random.choice( interface.servers ) host = random.choice( interface.servers )
port = 50000 port = wallet.default_port
d = QDialog(parent) d = QDialog(parent)
d.setModal(1) d.setModal(1)
@ -869,7 +870,7 @@ class ElectrumWindow(QMainWindow):
servers_list.setMaximumHeight(150) servers_list.setMaximumHeight(150)
for item in wallet.interface.servers: for item in wallet.interface.servers:
servers_list.addTopLevelItem(QTreeWidgetItem( [ item ] )) servers_list.addTopLevelItem(QTreeWidgetItem( [ item ] ))
servers_list.connect(servers_list, SIGNAL('itemClicked(QTreeWidgetItem*, int)'), lambda x:host_line.setText( x.text(0) + ':50000' )) servers_list.connect(servers_list, SIGNAL('itemClicked(QTreeWidgetItem*, int)'), lambda x:host_line.setText( x.text(0) + ':%d'%wallet.default_port ))
vbox.addWidget(servers_list) vbox.addWidget(servers_list)
vbox.addLayout(ok_cancel_buttons(d)) vbox.addLayout(ok_cancel_buttons(d))
@ -884,7 +885,7 @@ class ElectrumWindow(QMainWindow):
port = int(port) port = int(port)
else: else:
host = hh host = hh
port = 50000 port = wallet.default_port
except: except:
show_message("error") show_message("error")
if parent == None: if parent == None:

12
client/interface.py

@ -22,13 +22,13 @@ import random, socket, ast
import thread, traceback, sys, time, json import thread, traceback, sys, time, json
DEFAULT_TIMEOUT=5 DEFAULT_TIMEOUT = 5
DEFAULT_SERVERS = ['ecdsa.org','electrum.novit.ro'] # list of default servers
class Interface: class Interface:
def __init__(self): def __init__(self):
self.default_servers = ['ecdsa.org','electrum.novit.ro'] # list of default servers self.servers = DEFAULT_SERVERS # actual list from IRC
self.host = random.choice( self.default_servers ) # random choice when the wallet is created
self.servers = self.default_servers # actual list from IRC
self.rtime = 0 self.rtime = 0
self.blocks = 0 self.blocks = 0
self.message = '' self.message = ''
@ -330,8 +330,12 @@ class TCPInterface(Interface):
def new_interface(wallet): def new_interface(wallet):
if wallet.host:
host = wallet.host host = wallet.host
else:
host = random.choice( DEFAULT_SERVERS ) # random choice when the wallet is created
port = wallet.port port = wallet.port
if port == 50000: if port == 50000:
interface = NativeInterface(host,port) interface = NativeInterface(host,port)
elif port == 50001: elif port == 50001:

5
client/wallet.py

@ -263,6 +263,7 @@ class Wallet:
self.imported_keys = {} self.imported_keys = {}
self.remote_url = None self.remote_url = None
self.default_port = 50001
def set_server(self, host, port): def set_server(self, host, port):
@ -558,8 +559,8 @@ class Wallet:
data = f.read() data = f.read()
f.close() f.close()
except: except:
#self.interface = NativeInterface() self.host = ''
self.port = 50000 self.port = self.default_port
return return
try: try:
d = ast.literal_eval( data ) d = ast.literal_eval( data )

Loading…
Cancel
Save