3 # Electrum - lightweight Bitcoin client
4 # Copyright (C) 2013 ecdsa@github
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 from PyQt4.QtGui import *
20 from PyQt4.QtCore import *
21 import PyQt4.QtCore as QtCore
22 from electrum.i18n import _
23 from electrum import mnemonic
24 from qrcodewidget import QRCodeWidget
25 from util import close_button
27 class SeedDialog(QDialog):
28 def __init__(self, parent, seed, imported_keys):
29 QDialog.__init__(self, parent)
31 self.setWindowTitle('Electrum' + ' - ' + _('Seed'))
32 vbox = show_seed_box(seed)
34 vbox.addWidget(QLabel("<b>"+_("WARNING")+":</b> " + _("Your wallet contains imported keys. These keys cannot be recovered from seed.") + "</b><p>"))
35 vbox.addLayout(close_button(self))
39 def icon_filename(sid):
41 return ":icons/cold_seed.png"
43 return ":icons/hot_seed.png"
45 return ":icons/seed.png"
50 def show_seed_box(seed, sid=None):
52 save_msg = _("Please save these %d words on paper (order is important).")%len(seed.split()) + " "
53 qr_msg = _("Your seed is also displayed as QR code, in case you want to transfer it to a mobile phone.") + "<p>"
54 warning_msg = "<b>"+_("WARNING")+":</b> " + _("Never disclose your seed. Never type it on a website.") + "</b><p>"
57 msg = _("Your wallet generation seed is")
58 msg2 = save_msg + " " \
59 + _("This seed will allow you to recover your wallet in case of computer failure.") + "<br/>" \
63 msg = _("Your cold storage seed is")
64 msg2 = save_msg + " " \
65 + _("This seed will be permanently deleted from your wallet file. Make sure you have saved it before you press 'next'") + " " \
68 msg = _("Your hot seed is")
69 msg2 = save_msg + " " \
70 + _("If you ever need to recover your wallet from seed, you will need both this seed and your cold seed.") + " " \
72 label1 = QLabel(msg+ ":")
73 seed_text = QTextEdit(seed)
74 seed_text.setReadOnly(True)
75 seed_text.setMaximumHeight(130)
78 label2.setWordWrap(True)
82 logo.setPixmap(QPixmap(icon_filename(sid)).scaledToWidth(56))
83 logo.setMaximumWidth(60)
86 grid.addWidget(logo, 0, 0)
87 grid.addWidget(label1, 0, 1)
88 grid.addWidget(seed_text, 1, 0, 1, 2)
89 #qrw = QRCodeWidget(seed)
90 #grid.addWidget(qrw, 0, 2, 2, 1)
93 vbox.addWidget(label2)
99 def enter_seed_box(is_restore, sid=None):
103 msg = _("Please enter your wallet seed, or master public key") + "\n"
105 msg = _("Your seed is important!") \
106 + "\n" + _("To make sure that you have properly saved your seed, please retype it here.")
109 logo.setPixmap(QPixmap(icon_filename(sid)).scaledToWidth(56))
110 logo.setMaximumWidth(60)
113 label.setWordWrap(True)
116 seed_e.setMaximumHeight(100)
118 vbox.addWidget(label)
121 grid.addWidget(logo, 0, 0)
122 grid.addWidget(seed_e, 0, 1)