# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys, time, datetime, re, threading
-from i18n import _, set_language
+from electrum.i18n import _, set_language
from electrum.util import print_error, print_msg
import os.path, json, ast, traceback
import shutil
from electrum import SimpleConfig, Wallet, WalletStorage
-import bmp, pyqrnative
+from electrum import bmp, pyqrnative
import exchange_rate
from amountedit import AmountEdit
self.showNormal()
- def __init__(self, config, network):
+ def __init__(self, config, network, go_lite):
QMainWindow.__init__(self)
self.config = config
self.network = network
+ self.go_lite = go_lite
self.init_plugins()
self._close_electrum = False
QShortcut(QKeySequence("Ctrl+PgDown"), self, lambda: tabs.setCurrentIndex( (tabs.currentIndex() + 1 )%tabs.count() ))
self.connect(self, QtCore.SIGNAL('update_status'), self.update_status)
- self.connect(self, QtCore.SIGNAL('banner_signal'), lambda: self.console.showMessage(self.wallet.interface.banner) )
+ self.connect(self, QtCore.SIGNAL('banner_signal'), lambda: self.console.showMessage(self.network.banner) )
self.connect(self, QtCore.SIGNAL('transaction_signal'), lambda: self.notify_transactions() )
self.history_list.setFocus(True)
self.setWindowTitle( title )
self.update_wallet()
# set initial message
- self.console.showMessage(self.wallet.interface.banner)
+ self.console.showMessage(self.network.banner)
# Once GUI has been initialized check if we want to announce something since the callback has been called before the GUI was initialized
self.notify_transactions()
self.show_message("file not found "+ filename)
return
- interface = self.wallet.interface
- blockchain = self.wallet.verifier.blockchain
self.wallet.stop_threads()
# create new wallet
wallet = Wallet(storage)
- wallet.start_threads(interface, blockchain)
+ wallet.start_threads(network)
self.load_wallet(wallet)
storage = WalletStorage({'wallet_path': filename})
assert not storage.file_exists
- wizard = installwizard.InstallWizard(self.config, self.wallet.interface, self.wallet.verifier.blockchain, storage)
+ wizard = installwizard.InstallWizard(self.config, self.network, storage)
wallet = wizard.run()
if wallet:
self.load_wallet(wallet)
ex_labels.triggered.connect(self.do_export_labels)
help_menu = menubar.addMenu(_("&Help"))
- doc_open = help_menu.addAction(_("&Documentation"))
- doc_open.triggered.connect(lambda: webbrowser.open("http://electrum.org/documentation.html"))
+ show_about = help_menu.addAction(_("&About"))
+ show_about.triggered.connect(self.show_about)
web_open = help_menu.addAction(_("&Official website"))
web_open.triggered.connect(lambda: webbrowser.open("http://electrum.org"))
+ help_menu.addSeparator()
+ doc_open = help_menu.addAction(_("&Documentation"))
+ doc_open.triggered.connect(lambda: webbrowser.open("http://electrum.org/documentation.html"))
+ report_bug = help_menu.addAction(_("&Report Bug"))
+ report_bug.triggered.connect(self.show_report_bug)
+
self.setMenuBar(menubar)
+ def show_about(self):
+ QMessageBox.about(self, "Electrum",
+ _("Version")+" %s" % (self.wallet.electrum_version) + "\n\n" + _("Electrum's focus is speed, with low resource usage and simplifying Bitcoin. You do not need to perform regular backups, because your wallet can be recovered from a secret phrase that you can memorize or write on paper. Startup times are instant because it operates in conjunction with high-performance servers that handle the most complicated parts of the Bitcoin system."))
+
+ def show_report_bug(self):
+ QMessageBox.information(self, "Electrum - " + _("Reporting Bugs"),
+ _("Please report any bugs as issues on github:")+" <a href=\"https://github.com/spesmilo/electrum/issues\">https://github.com/spesmilo/electrum/issues</a>")
def notify_transactions(self):
print_error("Notifying GUI")
- if len(self.wallet.interface.pending_transactions_for_notifications) > 0:
+ if len(self.network.interface.pending_transactions_for_notifications) > 0:
# Combine the transactions if there are more then three
- tx_amount = len(self.wallet.interface.pending_transactions_for_notifications)
+ tx_amount = len(self.network.interface.pending_transactions_for_notifications)
if(tx_amount >= 3):
total_amount = 0
- for tx in self.wallet.interface.pending_transactions_for_notifications:
+ for tx in self.network.interface.pending_transactions_for_notifications:
is_relevant, is_mine, v, fee = self.wallet.get_tx_value(tx)
if(v > 0):
total_amount += v
self.notify("%s new transactions received. Total amount received in the new transactions %s %s" \
% (tx_amount, self.format_amount(total_amount), self.base_unit()))
- self.wallet.interface.pending_transactions_for_notifications = []
+ self.network.interface.pending_transactions_for_notifications = []
else:
- for tx in self.wallet.interface.pending_transactions_for_notifications:
+ for tx in self.network.interface.pending_transactions_for_notifications:
if tx:
- self.wallet.interface.pending_transactions_for_notifications.remove(tx)
+ self.network.interface.pending_transactions_for_notifications.remove(tx)
is_relevant, is_mine, v, fee = self.wallet.get_tx_value(tx)
if(v > 0):
self.notify("New transaction received. %s %s" % (self.format_amount(v), self.base_unit()))
return "BTC" if self.decimal_point == 8 else "mBTC"
def update_status(self):
- if self.wallet.interface and self.wallet.interface.is_connected:
+ if self.network.interface and self.network.interface.is_connected:
if not self.wallet.up_to_date:
text = _("Synchronizing...")
icon = QIcon(":icons/status_waiting.png")
def update_wallet(self):
self.update_status()
- if self.wallet.up_to_date or not self.wallet.interface.is_connected:
+ if self.wallet.up_to_date or not self.network.interface.is_connected:
self.update_history_tab()
self.update_receive_tab()
self.update_contacts_tab()
console.updateNamespace({'wallet' : self.wallet, 'network' : self.network, 'gui':self})
console.updateNamespace({'util' : util, 'bitcoin':bitcoin})
- c = commands.Commands(self.wallet, self.wallet.interface, lambda: self.console.set_json(True))
+ c = commands.Commands(self.wallet, self.network.interface, lambda: self.console.set_json(True))
methods = {}
def mkfunc(f, method):
return lambda *args: apply( f, (method, args, self.password_dialog ))
d.run()
self.update_lock_icon()
-
- def go_lite(self):
- import lite_window
- self.config.set_key('gui', 'lite', True)
- self.hide()
- if self.lite:
- self.lite.mini.show()
- else:
- self.lite = lite_window.ElectrumGui(self.config, None, None, self)
- self.lite.main(None)
-
def new_contact_dialog(self):
text, ok = QInputDialog.getText(self, _('New Contact'), _('Address') + ':')
lang_label=QLabel(_('Language') + ':')
grid_ui.addWidget(lang_label, 1, 0)
lang_combo = QComboBox()
- from i18n import languages
+ from electrum.i18n import languages
lang_combo.addItems(languages.values())
try:
index = languages.keys().index(self.config.get("language",''))
grid_wallet.addWidget(HelpButton(_('Using change addresses makes it more difficult for other people to track your transactions.')+' '), 1, 3)
if not self.config.is_modifiable('use_change'): usechange_cb.setEnabled(False)
- gap_label = QLabel(_('Gap limit'))
- grid_wallet.addWidget(gap_label, 2, 0)
- gap_e = AmountEdit(None,True)
- gap_e.setText("%d"% self.wallet.gap_limit)
- grid_wallet.addWidget(gap_e, 2, 2)
- msg = _('The gap limit is the maximal number of contiguous unused addresses in your sequence of receiving addresses.') + '\n' \
- + _('You may increase it if you need more receiving addresses.') + '\n\n' \
- + _('Your current gap limit is') + ': %d'%self.wallet.gap_limit + '\n' \
- + _('Given the current status of your address sequence, the minimum gap limit you can use is:')+' ' + '%d'%self.wallet.min_acceptable_gap() + '\n\n' \
- + _('Warning') + ': ' \
- + _('The gap limit parameter must be provided in order to recover your wallet from seed.') + ' ' \
- + _('Do not modify it if you do not understand what you are doing, or if you expect to recover your wallet without knowing it!') + '\n\n'
- grid_wallet.addWidget(HelpButton(msg), 2, 3)
- if not self.config.is_modifiable('gap_limit'):
- for w in [gap_e, gap_label]: w.setEnabled(False)
-
units = ['BTC', 'mBTC']
unit_label = QLabel(_('Base unit'))
grid_wallet.addWidget(unit_label, 3, 0)