1
0

DRYed the backup wallet

This commit is contained in:
Maran
2013-06-01 11:06:51 +02:00
parent 0ab69e2606
commit bf12bac1f2
3 changed files with 17 additions and 27 deletions

View File

@@ -1,6 +1,18 @@
from i18n import _
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import os.path
def backup_wallet():
try:
folderName = QFileDialog.getExistingDirectory(QWidget(), _('Select folder to save a copy of your wallet to'), os.path.expanduser('~/'))
if folderName:
# TODO: Can we get the current wallet file instead of bruteforcing the default one?
sourceFile = self.wallet.config.path
shutil.copy2(sourceFile, str(folderName))
QMessageBox.information(None,"Wallet backup created", _("A copy of your wallet file was created in")+" '%s'" % str(folderName))
except (IOError, os.error), reason:
QMessageBox.critical(None,"Unable to create backup", _("Electrum was unable to copy your wallet file to the specified location.")+"\n" + str(reason))
def ok_cancel_buttons(dialog, ok_label=_("OK") ):
hbox = QHBoxLayout()