def set_note_tags(self, key, tags): n = self.notes[key] old_tags = n.get('tags') tags = utils.sanitise_tags(tags) if tags != old_tags: n['tags'] = tags n['modifydate'] = time.time() self.notify_observers('change:note-status', utils.KeyValueObject(what='modifydate', key=key))
def add_note_tags(self, key, comma_seperated_tags): note = self.notes[key] note_tags = note.get('tags') new_tags = utils.sanitise_tags(comma_seperated_tags) note_tags.extend(new_tags) note['tags'] = note_tags note['modifydate'] = time.time() self.notify_observers('change:note-status', utils.KeyValueObject(what='modifydate', key=key))
def set_note_tags(self, key, tags): n = self.notes[key] old_tags = n.get('tags') tags = utils.sanitise_tags(tags) if tags != old_tags: n['tags'] = tags n['modifydate'] = time.time() self.notify_observers( 'change:note-status', utils.KeyValueObject(what='modifydate', key=key))
def is_note_different(self, note): """ Determine if note would cause a UI update. """ if self.get_text() != note.get('content'): return True tags = note.get('tags', []) # get list of string tags from ui ui_tags = utils.sanitise_tags(self.tags_entry_var.get()) if ui_tags != tags: return True if bool(self.pinned_checkbutton_var.get()) != bool(utils.note_pinned(note)): return True