def edit_tag_dialog(note): """Prompt for tags and add the results to note.""" prompt = _("Edit tag list:") (tag_string, dialog_status) = getTag(mw, mw.col, prompt, default=note.stringTags()) if dialog_status != 0: # means "Cancel" note.setTagsFromStr(tag_string) note.flush() reset_and_redraw(same_card_shown=True) tooltip('Tags set to: "{}"'.format(tag_string))
def edit_tag_dialog(note): """Prompt for tags and add the results to note.""" prompt = _("Edit tag list:") (tag_string, dialog_status) = getTag(mw, mw.col, prompt, default=note.stringTags()) if dialog_status: note.setTagsFromStr(tag_string) note.flush() reset_and_redraw(same_card_shown=True) tooltip('Tags set to: "{}"'.format(tag_string))
def promptAndAddTags(note): # prompt for new tags prompt = _("Enter tags to add:") (tagString, r) = getTag(mw, mw.col, prompt) # don't do anything if we didn't get anything if not r: return # otherwise, add the given tags: addTags(note, tagString) tooltip('Added tag(s) "%s"' % tagString)
def edit_tag_dialog(note): """Prompt for tags and add the results to note.""" prompt = _("Edit tag list:") (tag_string, dialog_status) = getTag(mw, mw.col, prompt, default=note.stringTags()) if dialog_status != 0: # means "Cancel" note.setTagsFromStr(tag_string) note.flush() redraw_card() tooltip('Tags set to: "{}"'.format(tag_string))
def promptAndAddTags(): # prompt for new tags mw.checkpoint(_("Add Tags")) note = mw.reviewer.card.note() prompt = _("Enter tags to add:") (tagString, r) = getTag(mw, mw.col, prompt) # don't do anything if we didn't get anything if (not r or not tagString): return # otherwise, add the given tags: addTags(note, tagString) tooltip('Added tag(s) "%s"' % tagString)
def addTags(self, tags=None, label=None, prompt=None, func=None): if prompt is None: prompt = _("Enter tags to add:") if tags is None: (tags, r) = getTag(self, self.col, prompt) else: r = True if not r: return if func is None: func = self.col.tags.bulkAdd if label is None: label = _("Add Tags") if label: self.mw.checkpoint(label) func(self.selectedNotes(), tags) self.model.reset() self.mw.requireReset()
def _prompt_for_tags(self, prompt: str) -> str | None: (tags, ok) = getTag(self, self.col, prompt) if not ok: return None else: return tags
def _prompt_for_tags(self, prompt: str) -> Optional[str]: (tags, ok) = getTag(self, self.col, prompt) if not ok: return None else: return tags
def custom_tag(): note = mw.reviewer.card.note() (tagString, r) = getTag(mw, mw.col, 'Choose a tag:') note.addTag(tagString) tooltip('Added tag "%s"' % tagString) note.flush()