|
@ -24,9 +24,8 @@ pygtk.require('2.0') |
|
|
import gtk, gobject |
|
|
import gtk, gobject |
|
|
from decimal import Decimal |
|
|
from decimal import Decimal |
|
|
from electrum.util import print_error |
|
|
from electrum.util import print_error |
|
|
from electrum import is_valid |
|
|
from electrum.bitcoin import is_valid |
|
|
from electrum import mnemonic |
|
|
from electrum import mnemonic, pyqrnative, WalletStorage, Wallet |
|
|
import pyqrnative |
|
|
|
|
|
|
|
|
|
|
|
gtk.gdk.threads_init() |
|
|
gtk.gdk.threads_init() |
|
|
APP_NAME = "Electrum" |
|
|
APP_NAME = "Electrum" |
|
@ -515,6 +514,7 @@ class ElectrumWindow: |
|
|
self.config = config |
|
|
self.config = config |
|
|
self.wallet = wallet |
|
|
self.wallet = wallet |
|
|
self.funds_error = False # True if not enough funds |
|
|
self.funds_error = False # True if not enough funds |
|
|
|
|
|
self.num_zeros = int(self.config.get('num_zeros',0)) |
|
|
|
|
|
|
|
|
self.window = MyWindow(gtk.WINDOW_TOPLEVEL) |
|
|
self.window = MyWindow(gtk.WINDOW_TOPLEVEL) |
|
|
title = 'Electrum ' + self.wallet.electrum_version + ' - ' + self.config.path |
|
|
title = 'Electrum ' + self.wallet.electrum_version + ' - ' + self.config.path |
|
@ -601,7 +601,7 @@ class ElectrumWindow: |
|
|
self.context_id = self.status_bar.get_context_id("statusbar") |
|
|
self.context_id = self.status_bar.get_context_id("statusbar") |
|
|
self.update_status_bar() |
|
|
self.update_status_bar() |
|
|
|
|
|
|
|
|
self.wallet.interface.register_callback('updated', self.update_callback) |
|
|
self.wallet.network.register_callback('updated', self.update_callback) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_status_bar_thread(): |
|
|
def update_status_bar_thread(): |
|
@ -1111,16 +1111,16 @@ class ElectrumWindow: |
|
|
if self.funds_error: |
|
|
if self.funds_error: |
|
|
text = "Not enough funds" |
|
|
text = "Not enough funds" |
|
|
elif interface and interface.is_connected: |
|
|
elif interface and interface.is_connected: |
|
|
self.network_button.set_tooltip_text("Connected to %s:%d.\n%d blocks"%(interface.host, interface.port, self.wallet.verifier.height)) |
|
|
self.network_button.set_tooltip_text("Connected to %s:%d.\n%d blocks"%(interface.host, interface.port, self.wallet.network.blockchain.height)) |
|
|
if not self.wallet.up_to_date: |
|
|
if not self.wallet.up_to_date: |
|
|
self.status_image.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU) |
|
|
self.status_image.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU) |
|
|
text = "Synchronizing..." |
|
|
text = "Synchronizing..." |
|
|
else: |
|
|
else: |
|
|
self.status_image.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU) |
|
|
self.status_image.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU) |
|
|
self.network_button.set_tooltip_text("Connected to %s:%d.\n%d blocks"%(interface.host, interface.port, self.wallet.verifier.height)) |
|
|
self.network_button.set_tooltip_text("Connected to %s:%d.\n%d blocks"%(interface.host, interface.port, self.wallet.network.blockchain.height)) |
|
|
c, u = self.wallet.get_balance() |
|
|
c, u = self.wallet.get_balance() |
|
|
text = "Balance: %s "%( format_satoshis(c,False,self.wallet.num_zeros) ) |
|
|
text = "Balance: %s "%( format_satoshis(c,False,self.num_zeros) ) |
|
|
if u: text += "[%s unconfirmed]"%( format_satoshis(u,True,self.wallet.num_zeros).strip() ) |
|
|
if u: text += "[%s unconfirmed]"%( format_satoshis(u,True,self.num_zeros).strip() ) |
|
|
else: |
|
|
else: |
|
|
self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU) |
|
|
self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU) |
|
|
self.network_button.set_tooltip_text("Not connected.") |
|
|
self.network_button.set_tooltip_text("Not connected.") |
|
@ -1183,8 +1183,8 @@ class ElectrumWindow: |
|
|
details = self.get_tx_details(tx_hash) |
|
|
details = self.get_tx_details(tx_hash) |
|
|
|
|
|
|
|
|
self.history_list.prepend( [tx_hash, conf_icon, time_str, label, is_default_label, |
|
|
self.history_list.prepend( [tx_hash, conf_icon, time_str, label, is_default_label, |
|
|
format_satoshis(value,True,self.wallet.num_zeros, whitespaces=True), |
|
|
format_satoshis(value,True,self.num_zeros, whitespaces=True), |
|
|
format_satoshis(balance,False,self.wallet.num_zeros, whitespaces=True), tooltip, details] ) |
|
|
format_satoshis(balance,False,self.num_zeros, whitespaces=True), tooltip, details] ) |
|
|
if cursor: self.history_treeview.set_cursor( cursor ) |
|
|
if cursor: self.history_treeview.set_cursor( cursor ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1276,9 +1276,17 @@ class ElectrumWindow: |
|
|
|
|
|
|
|
|
class ElectrumGui(): |
|
|
class ElectrumGui(): |
|
|
|
|
|
|
|
|
def __init__(self, wallet, config): |
|
|
def __init__(self, config, network): |
|
|
self.wallet = wallet |
|
|
self.network = network |
|
|
self.config = config |
|
|
self.config = config |
|
|
|
|
|
storage = WalletStorage(config) |
|
|
|
|
|
if not storage.file_exists: |
|
|
|
|
|
print "Wallet not found. try 'electrum create'" |
|
|
|
|
|
exit() |
|
|
|
|
|
|
|
|
|
|
|
self.wallet = Wallet(storage) |
|
|
|
|
|
self.wallet.start_threads(network) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(self, url=None): |
|
|
def main(self, url=None): |
|
|
ew = ElectrumWindow(self.wallet, self.config) |
|
|
ew = ElectrumWindow(self.wallet, self.config) |
|
|