1
0

set label

This commit is contained in:
ThomasV
2013-09-29 12:14:01 +02:00
parent ec141ebb67
commit a9b05ad188
3 changed files with 28 additions and 26 deletions

View File

@@ -396,9 +396,24 @@ class Wallet:
return account_id, account
def set_label(self, key, value):
self.labels[key] = value
self.storage.put('labels', self.labels, True)
def set_label(self, name, text = None):
changed = False
old_text = self.labels.get(name)
if text:
if old_text != text:
self.labels[name] = text
changed = True
else:
if old_text:
self.labels.pop(name)
changed = True
if changed:
self.storage.put('labels', self.labels, True)
run_hook('set_label', name, text, changed)
return changed
def create_account(self, account_type = '1', name = None):