tweak the wording of some of the tag ops

This commit is contained in:
Damien Elmes 2021-04-01 15:01:08 +10:00
parent 42942a521e
commit 9c1dc2b62e
4 changed files with 13 additions and 11 deletions

View file

@ -39,7 +39,7 @@ from aqt.scheduling_ops import (
from aqt.sidebar import SidebarTreeView from aqt.sidebar import SidebarTreeView
from aqt.switch import Switch from aqt.switch import Switch
from aqt.table import Table from aqt.table import Table
from aqt.tag_ops import add_tags, clear_unused_tags, remove_tags_for_notes from aqt.tag_ops import add_tags_to_notes, clear_unused_tags, remove_tags_from_notes
from aqt.utils import ( from aqt.utils import (
HelpPage, HelpPage,
KeyboardModifiersPressed, KeyboardModifiersPressed,
@ -682,7 +682,7 @@ where id in %s"""
"Shows prompt if tags not provided." "Shows prompt if tags not provided."
if not (tags := tags or self._prompt_for_tags(tr.browsing_enter_tags_to_add())): if not (tags := tags or self._prompt_for_tags(tr.browsing_enter_tags_to_add())):
return return
add_tags( add_tags_to_notes(
mw=self.mw, mw=self.mw,
note_ids=self.selected_notes(), note_ids=self.selected_notes(),
space_separated_tags=tags, space_separated_tags=tags,
@ -698,7 +698,7 @@ where id in %s"""
tags := tags or self._prompt_for_tags(tr.browsing_enter_tags_to_delete()) tags := tags or self._prompt_for_tags(tr.browsing_enter_tags_to_delete())
): ):
return return
remove_tags_for_notes( remove_tags_from_notes(
mw=self.mw, mw=self.mw,
note_ids=self.selected_notes(), note_ids=self.selected_notes(),
space_separated_tags=tags, space_separated_tags=tags,

View file

@ -30,7 +30,7 @@ from aqt.scheduling_ops import (
suspend_note, suspend_note,
) )
from aqt.sound import av_player, play_clicked_audio, record_audio from aqt.sound import av_player, play_clicked_audio, record_audio
from aqt.tag_ops import add_tags, remove_tags_for_notes from aqt.tag_ops import add_tags_to_notes, remove_tags_from_notes
from aqt.theme import theme_manager from aqt.theme import theme_manager
from aqt.toolbar import BottomBar from aqt.toolbar import BottomBar
from aqt.utils import askUserDialog, downArrow, qtMenuShortcutWorkaround, tooltip, tr from aqt.utils import askUserDialog, downArrow, qtMenuShortcutWorkaround, tooltip, tr
@ -841,11 +841,13 @@ time = %(time)d;
def toggle_mark_on_current_note(self) -> None: def toggle_mark_on_current_note(self) -> None:
note = self.card.note() note = self.card.note()
if note.has_tag(MARKED_TAG): if note.has_tag(MARKED_TAG):
remove_tags_for_notes( remove_tags_from_notes(
mw=self.mw, note_ids=[note.id], space_separated_tags=MARKED_TAG mw=self.mw, note_ids=[note.id], space_separated_tags=MARKED_TAG
) )
else: else:
add_tags(mw=self.mw, note_ids=[note.id], space_separated_tags=MARKED_TAG) add_tags_to_notes(
mw=self.mw, note_ids=[note.id], space_separated_tags=MARKED_TAG
)
def on_set_due(self) -> None: def on_set_due(self) -> None:
if self.mw.state != "review" or not self.card: if self.mw.state != "review" or not self.card:

View file

@ -18,7 +18,7 @@ from aqt.clayout import CardLayout
from aqt.deck_ops import remove_decks, rename_deck, reparent_decks from aqt.deck_ops import remove_decks, rename_deck, reparent_decks
from aqt.models import Models from aqt.models import Models
from aqt.qt import * from aqt.qt import *
from aqt.tag_ops import remove_tags_for_all_notes, rename_tag, reparent_tags from aqt.tag_ops import remove_tags_from_all_notes, rename_tag, reparent_tags
from aqt.theme import ColoredIcon, theme_manager from aqt.theme import ColoredIcon, theme_manager
from aqt.utils import KeyboardModifiersPressed, askUser, getOnlyText, showWarning, tr from aqt.utils import KeyboardModifiersPressed, askUser, getOnlyText, showWarning, tr
@ -1175,7 +1175,7 @@ class SidebarTreeView(QTreeView):
tags = self.mw.col.tags.join(self._selected_tags()) tags = self.mw.col.tags.join(self._selected_tags())
item.name = "..." item.name = "..."
remove_tags_for_all_notes( remove_tags_from_all_notes(
mw=self.mw, parent=self.browser, space_separated_tags=tags mw=self.mw, parent=self.browser, space_separated_tags=tags
) )

View file

@ -12,7 +12,7 @@ from aqt.main import PerformOpOptionalSuccessCallback
from aqt.utils import showInfo, tooltip, tr from aqt.utils import showInfo, tooltip, tr
def add_tags( def add_tags_to_notes(
*, *,
mw: AnkiQt, mw: AnkiQt,
note_ids: Sequence[NoteId], note_ids: Sequence[NoteId],
@ -24,7 +24,7 @@ def add_tags(
) )
def remove_tags_for_notes( def remove_tags_from_notes(
*, *,
mw: AnkiQt, mw: AnkiQt,
note_ids: Sequence[NoteId], note_ids: Sequence[NoteId],
@ -66,7 +66,7 @@ def rename_tag(
) )
def remove_tags_for_all_notes( def remove_tags_from_all_notes(
*, mw: AnkiQt, parent: QWidget, space_separated_tags: str *, mw: AnkiQt, parent: QWidget, space_separated_tags: str
) -> None: ) -> None:
mw.perform_op( mw.perform_op(