s = s[:p] + '.' + s[p:p+8]
try:
amount = int( Decimal(s) * 100000000 )
- except:
+ except Exception:
amount = None
else:
try:
amount = int( s )
- except:
+ except Exception:
amount = None
entry.set_text(s)
return amount
return
try:
seed = wallet.get_seed(password)
- except:
+ except Exception:
show_message("Incorrect password")
return
dialog = gtk.MessageDialog(
try:
seed.decode('hex')
- except:
+ except Exception:
print_error("Warning: Not hex, trying decode")
seed = mnemonic.mn_decode( seed.split(' ') )
if not seed:
try:
fee = int( 100000000 * Decimal(fee) )
- except:
+ except Exception:
show_message("error")
return
self.wallet.set_fee(fee)
try:
nz = int( nz )
if nz>8: nz = 8
- except:
+ except Exception:
show_message("error")
return
import random
status = "Please choose a server.\nSelect cancel if you are offline."
- server = interface.server
- host, port, protocol = server.split(':')
+ if network.is_connected():
+ server = interface.server
+ host, port, protocol = server.split(':')
servers = network.get_servers()
host_box.pack_start(host_label, False, False, 10)
host_entry = gtk.Entry()
host_entry.set_size_request(200,-1)
- host_entry.set_text(server)
+ if network.is_connected():
+ host_entry.set_text(server)
+ else:
+ host_entry.set_text("Not Connected")
host_entry.show()
host_box.pack_start(host_entry, False, False, 10)
add_help_button(host_box, 'The name, port number and protocol of your Electrum server, separated by a colon. Example: "ecdsa.org:50002:s". Some servers allow you to connect through http (port 80) or https (port 443)')
def current_line():
return unicode(host_entry.get_text()).split(':')
-
+
def set_combobox(protocol):
combobox.set_active('tshg'.index(protocol))
host_entry.set_text( host + ':' + port + ':' + protocol)
combobox.connect("changed", lambda x:set_protocol('tshg'[combobox.get_active()]))
- set_combobox(protocol)
+ if network.is_connected():
+ set_combobox(protocol)
server_list = gtk.ListStore(str)
for host in servers.keys():
proxy = network.config.get('proxy')
auto_connect = network.config.get('auto_cycle')
network.set_parameters(host, port, protocol, proxy, auto_connect)
- except:
+ except Exception:
show_message("error:" + server)
return False
try:
wallet.get_seed(password)
- except:
+ except Exception:
show_message("Incorrect password")
return
if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', r):
try:
to_address = self.wallet.get_alias(r, interactive=False)
- except:
+ except Exception:
continue
if to_address:
s = r + ' <' + to_address + '>'
try:
amount = int( Decimal(amount_entry.get_text()) * 100000000 )
- except:
+ except Exception:
self.show_message( "invalid amount")
return
try:
fee = int( Decimal(fee_entry.get_text()) * 100000000 )
- except:
+ except Exception:
self.show_message( "invalid fee")
return
try:
tx = self.wallet.mktx( [(to_address, amount)], password, fee )
- except BaseException, e:
+ except Exception as e:
self.show_message(str(e))
return
def create_recv_tab(self):
- self.recv_list = gtk.ListStore(str, str, str, str)
+ self.recv_list = gtk.ListStore(str, str, str, str, str)
self.add_tab( self.make_address_list(True), 'Receive')
self.update_receiving_tab()
tvcolumn.add_attribute(cell, 'text', 2)
if is_recv:
- tvcolumn = gtk.TreeViewColumn('Type')
+ tvcolumn = gtk.TreeViewColumn('Balance')
treeview.append_column(tvcolumn)
cell = gtk.CellRendererText()
tvcolumn.pack_start(cell, True)
tvcolumn.add_attribute(cell, 'text', 3)
+ tvcolumn = gtk.TreeViewColumn('Type')
+ treeview.append_column(tvcolumn)
+ cell = gtk.CellRendererText()
+ tvcolumn.pack_start(cell, True)
+ tvcolumn.add_attribute(cell, 'text', 4)
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
button.show()
hbox.pack_start(button,False)
+ if is_recv:
+ button = gtk.Button("Freeze")
+ def freeze_address(w, treeview, liststore, wallet):
+ path, col = treeview.get_cursor()
+ if path:
+ address = liststore.get_value( liststore.get_iter(path), 0)
+ if address in wallet.frozen_addresses:
+ wallet.unfreeze(address)
+ else:
+ wallet.freeze(address)
+ self.update_receiving_tab()
+ button.connect("clicked", freeze_address, treeview, liststore, self.wallet)
+ button.show()
+ hbox.pack_start(button,False)
+
+ button = gtk.Button("Prioritize")
+ def prioritize_address(w, treeview, liststore, wallet):
+ path, col = treeview.get_cursor()
+ if path:
+ address = liststore.get_value( liststore.get_iter(path), 0)
+ if address in wallet.prioritized_addresses:
+ wallet.unprioritize(address)
+ else:
+ wallet.prioritize(address)
+ self.update_receiving_tab()
+ button.connect("clicked", prioritize_address, treeview, liststore, self.wallet)
+ button.show()
+ hbox.pack_start(button,False)
+
if not is_recv:
button = gtk.Button("Pay to")
def payto(w, treeview, liststore):
self.recv_list.clear()
for address in self.wallet.addresses(True):
Type = "R"
+ c = u = 0
if self.wallet.is_change(address): Type = "C"
- if address in self.wallet.imported_keys.keys(): Type = "I"
+ if address in self.wallet.imported_keys.keys():
+ Type = "I"
+ c, u = self.wallet.get_addr_balance(address)
+ if address in self.wallet.frozen_addresses: Type = Type + "F"
+ if address in self.wallet.prioritized_addresses: Type = Type + "P"
label = self.wallet.labels.get(address)
h = self.wallet.history.get(address,[])
n = len(h)
tx = "0" if n==0 else "%d"%n
- self.recv_list.append((address, label, tx, Type ))
+ self.recv_list.append((address, label, tx, format_satoshis(c,False,self.num_zeros), Type ))
def update_sending_tab(self):
# detect addresses that are not mine in history, add them here...
if conf > 0:
try:
time_str = datetime.datetime.fromtimestamp( timestamp).isoformat(' ')[:-3]
- except:
+ except Exception:
time_str = "------"
conf_icon = gtk.STOCK_APPLY
elif conf == -1: