Ejemplo n.º 1
0
 def backup_wallet(self):
     try:
       folderName = QFileDialog.getExistingDirectory(QWidget(), _('Select folder to save a copy of your wallet to'), os.path.expanduser('~/'))
       if folderName:
         sourceFile = util.user_dir() + '/electrum.dat'
         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))
Ejemplo n.º 2
0
def write_schedule_file(schedule_dict):
    schedule_path = os.path.join(user_dir(), 'schedule')
    s = json.dumps(schedule_dict, indent=4, sort_keys=True)
    try:
        with open(schedule_path, "w", encoding='utf-8') as f:
            f.write(s)
        os.chmod(schedule_path, stat.S_IREAD | stat.S_IWRITE)
    except FileNotFoundError:
        if os.path.exists(schedule_path):
            raise
Ejemplo n.º 3
0
def read_schedule_file():
    schedule_path = os.path.join(user_dir(), 'schedule')
    if not os.path.exists(schedule_path):
        return {}    
    try:
        with open(schedule_path, "r", encoding='utf-8') as f:
            data = f.read()
        result = json.loads(data)
    except:
        return {}
    if not type(result) is dict:
        return {}
    return result
Ejemplo n.º 4
0
 def backup_wallet(self):
     try:
         folderName = QFileDialog.getExistingDirectory(
             QWidget(), _('Select folder to save a copy of your wallet to'),
             os.path.expanduser('~/'))
         if folderName:
             sourceFile = util.user_dir() + '/electrum.dat'
             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))
Ejemplo n.º 5
0
def token_path():
    dir = user_dir() + '/coinbase_buyback'
    if not os.access(dir, os.F_OK):
        os.mkdir(dir)
    return dir + '/token'
Ejemplo n.º 6
0
def token_path():
    dir = user_dir() + '/coinbase_buyback'
    if not os.access(dir, os.F_OK):
        os.mkdir(dir)
    return dir + '/token'