no_wallet_message="Wallet file not found.\nPlease provide a seed and a password. The seed will be to generate Bitcoin addresses. It should be long and random, and nobody should be able to guess it. Memorize it, or write it down and keep it in a vault. The password will be used to encrypt your local wallet file. You will need to enter your password everytime you use your wallet. If you lose your password, you can still recover your wallet with the seed."
# run a dialog indicating the seed, ask the user to remember it
dialog=gtk.MessageDialog(
parent=None,
flags=gtk.DIALOG_MODAL,
buttons=gtk.BUTTONS_OK_CANCEL,
message_format="Wallet not found. Please enter a seed to create or recover your wallet. Minimum length: 20 characters")
p_box=gtk.HBox()
p_label=gtk.Label('Seed:')
p_label.show()
p_box.pack_start(p_label)
p_entry=gtk.Entry()
p_entry.show()
p_box.pack_start(p_entry)
p_box.show()
dialog.vbox.pack_start(p_box,False,True,0)
buttons=gtk.BUTTONS_OK,
message_format="Your secret seed is:\n"+wallet.seed+"\n\nPlease keep it in a safe place; if you lose it, you will not be able to restore your wallet.")
thread.start_new_thread(recover_thread,(wallet,dialog,None))# no password
r=dialog.run()
seed=p_entry.get_text()
dialog.destroy()
ifr==gtk.RESPONSE_CANCEL:exit(1)
iflen(seed)<20:
printlen(seed)
seed=None
ifnotwallet.is_found:
show_message("No transactions found for this seed")
# disable password during recovery
# change_password_dialog(None, wallet)
wallet.seed=seed
run_settings_dialog(None,wallet,True)
defsettings_dialog(wallet,is_create,is_recovery):
ifis_create:
dialog=gtk.MessageDialog(
parent=None,
flags=gtk.DIALOG_MODAL,
buttons=gtk.BUTTONS_CANCEL,
message_format="Please wait...")
dialog.show()
defrecover_thread(wallet,dialog,password):
wallet.recover(password)
wallet.save()
gobject.idle_add(dialog.destroy)
thread.start_new_thread(recover_thread,(wallet,dialog,None))# no password
r=dialog.run()
dialog.destroy()
ifr==gtk.RESPONSE_CANCEL:exit(1)
defsettings_dialog(wallet,is_recover):
dialog=gtk.MessageDialog(
parent=None,
flags=gtk.DIALOG_MODAL,
buttons=gtk.BUTTONS_OK_CANCEL,
message_format="Please indicate the server, and the gap limit if you are recovering a lost wallet."ifis_recoverelse'Settings')
buttons=gtk.BUTTONS_OK_CANCEL,
message_format="Please indicate the server and port number"ifnotis_recoveryelse'Please enter the seed, the server and gap')
else:
dialog=gtk.Dialog("settings",parent=None,
flags=gtk.DIALOG_MODAL|gtk.DIALOG_NO_SEPARATOR,
buttons=("cancel",0,"ok",1))
vbox=dialog.vbox
dialog.set_default_response(gtk.RESPONSE_OK)
gap=gtk.HBox()
gap_label=gtk.Label('Max. gap:')
gap_label.set_size_request(100,10)
gap_label.show()
gap.pack_start(gap_label,False,False,10)
gap_entry=gtk.Entry()
gap_entry.set_text("%d"%wallet.gap_limit)
gap_entry.connect('changed',numbify,True)
gap_entry.show()
gap.pack_start(gap_entry,False,False,10)
add_help_button(gap,'The maximum gap that is allowed between unused addresses in your wallet. During wallet recovery, this parameter is used to decide when to stop the recovery process. If you increase this value, you will need to remember it in order to be able to recover your wallet from seed.')
gap.show()
ifis_recovery:
# ask seed, server and gap in the same dialog
seed_box=gtk.HBox()
seed_label=gtk.Label('Seed:')
seed_label.show()
seed_box.pack_start(seed_label)
seed_entry=gtk.Entry()
seed_entry.show()
seed_box.pack_start(seed_entry)
seed_box.show()
vbox.pack_start(seed_box,False,False,5)
ifis_recoveryor(notis_create):
gap=gtk.HBox()
gap_label=gtk.Label('Max. gap:')
gap_label.set_size_request(100,10)
gap_label.show()
gap.pack_start(gap_label,False,False,10)
gap_entry=gtk.Entry()
gap_entry.set_text("%d"%wallet.gap_limit)
gap_entry.connect('changed',numbify,True)
gap_entry.show()
gap.pack_start(gap_entry,False,False,10)
add_help_button(gap,'The maximum gap that is allowed between unused addresses in your wallet. During wallet recovery, this parameter is used to decide when to stop the recovery process. If you increase this value, you will need to remember it in order to be able to recover your wallet from seed.')