set_label
This commit is contained in:
parent
328315f94b
commit
cd6832df2e
|
@ -1948,8 +1948,7 @@ class ElectrumWindow(QMainWindow):
|
|||
data = f.read()
|
||||
f.close()
|
||||
for key, value in json.loads(data).items():
|
||||
self.wallet.labels[key] = value
|
||||
self.wallet.save()
|
||||
self.wallet.set_label(key, value)
|
||||
QMessageBox.information(None, _("Labels imported"), _("Your labels were imported from")+" '%s'" % str(labelsFile))
|
||||
except (IOError, os.error), 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):
|
||||
try:
|
||||
addr = self.wallet.import_key(sec,self.password)
|
||||
self.wallet.save()
|
||||
out = "Keypair imported: ", addr
|
||||
except BaseException as e:
|
||||
out = "Error: Keypair import failed: " + str(e)
|
||||
|
@ -286,9 +285,9 @@ class Commands:
|
|||
|
||||
|
||||
|
||||
def setlabel(self, tx, label):
|
||||
self.wallet.labels[tx] = label
|
||||
self.wallet.save()
|
||||
def setlabel(self, key, label):
|
||||
self.wallet.set_labels(key, label)
|
||||
|
||||
|
||||
|
||||
def contacts(self):
|
||||
|
|
|
@ -390,13 +390,17 @@ class Wallet:
|
|||
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):
|
||||
account_id, account = self.next_account(account_type)
|
||||
self.accounts[account_id] = account
|
||||
self.save_accounts()
|
||||
if name:
|
||||
self.labels[account_id] = name
|
||||
self.storage.put('labels', self.labels, True)
|
||||
if name:
|
||||
self.set_label(account_id, name)
|
||||
|
||||
|
||||
def create_old_account(self):
|
||||
|
@ -758,8 +762,8 @@ class Wallet:
|
|||
self.addressbook.append(address)
|
||||
self.storage.put('contacts', self.addressbook, True)
|
||||
if label:
|
||||
self.labels[address] = label
|
||||
self.storage.put('labels', self.labels, True)
|
||||
self.set_label(address, label)
|
||||
|
||||
|
||||
def delete_contact(self, addr):
|
||||
if addr in self.addressbook:
|
||||
|
|
Loading…
Reference in New Issue