예제 #1
0
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))
예제 #2
0
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))
예제 #3
0
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)
예제 #4
0
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)
예제 #5
0
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)
예제 #7
0
 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()
예제 #8
0
 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()
예제 #9
0
파일: browser.py 프로젝트: RumovZ/anki
 def _prompt_for_tags(self, prompt: str) -> str | None:
     (tags, ok) = getTag(self, self.col, prompt)
     if not ok:
         return None
     else:
         return tags
예제 #10
0
파일: browser.py 프로젝트: mark-stone/anki
 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()