mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
set_label
This commit is contained in:
parent
328315f94b
commit
cd6832df2e
3 changed files with 13 additions and 11 deletions
|
@ -1948,8 +1948,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
data = f.read()
|
data = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
for key, value in json.loads(data).items():
|
for key, value in json.loads(data).items():
|
||||||
self.wallet.labels[key] = value
|
self.wallet.set_label(key, value)
|
||||||
self.wallet.save()
|
|
||||||
QMessageBox.information(None, _("Labels imported"), _("Your labels were imported from")+" '%s'" % str(labelsFile))
|
QMessageBox.information(None, _("Labels imported"), _("Your labels were imported from")+" '%s'" % str(labelsFile))
|
||||||
except (IOError, os.error), reason:
|
except (IOError, os.error), reason:
|
||||||
QMessageBox.critical(None, _("Unable to import labels"), _("Electrum was unable to import your labels.")+"\n" + str(reason))
|
QMessageBox.critical(None, _("Unable to import labels"), _("Electrum was unable to import your labels.")+"\n" + str(reason))
|
||||||
|
|
|
@ -194,7 +194,6 @@ class Commands:
|
||||||
def importprivkey(self, sec):
|
def importprivkey(self, sec):
|
||||||
try:
|
try:
|
||||||
addr = self.wallet.import_key(sec,self.password)
|
addr = self.wallet.import_key(sec,self.password)
|
||||||
self.wallet.save()
|
|
||||||
out = "Keypair imported: ", addr
|
out = "Keypair imported: ", addr
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
out = "Error: Keypair import failed: " + str(e)
|
out = "Error: Keypair import failed: " + str(e)
|
||||||
|
@ -286,9 +285,9 @@ class Commands:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def setlabel(self, tx, label):
|
def setlabel(self, key, label):
|
||||||
self.wallet.labels[tx] = label
|
self.wallet.set_labels(key, label)
|
||||||
self.wallet.save()
|
|
||||||
|
|
||||||
|
|
||||||
def contacts(self):
|
def contacts(self):
|
||||||
|
|
|
@ -390,13 +390,17 @@ class Wallet:
|
||||||
return account_id, account
|
return account_id, account
|
||||||
|
|
||||||
|
|
||||||
|
def set_label(self, key, value):
|
||||||
|
self.labels[account_id] = name
|
||||||
|
self.storage.put('labels', self.labels, True)
|
||||||
|
|
||||||
|
|
||||||
def create_account(self, account_type = '1', name = None):
|
def create_account(self, account_type = '1', name = None):
|
||||||
account_id, account = self.next_account(account_type)
|
account_id, account = self.next_account(account_type)
|
||||||
self.accounts[account_id] = account
|
self.accounts[account_id] = account
|
||||||
self.save_accounts()
|
self.save_accounts()
|
||||||
if name:
|
if name:
|
||||||
self.labels[account_id] = name
|
self.set_label(account_id, name)
|
||||||
self.storage.put('labels', self.labels, True)
|
|
||||||
|
|
||||||
|
|
||||||
def create_old_account(self):
|
def create_old_account(self):
|
||||||
|
@ -758,8 +762,8 @@ class Wallet:
|
||||||
self.addressbook.append(address)
|
self.addressbook.append(address)
|
||||||
self.storage.put('contacts', self.addressbook, True)
|
self.storage.put('contacts', self.addressbook, True)
|
||||||
if label:
|
if label:
|
||||||
self.labels[address] = label
|
self.set_label(address, label)
|
||||||
self.storage.put('labels', self.labels, True)
|
|
||||||
|
|
||||||
def delete_contact(self, addr):
|
def delete_contact(self, addr):
|
||||||
if addr in self.addressbook:
|
if addr in self.addressbook:
|
||||||
|
|
Loading…
Add table
Reference in a new issue