Arthur-Milchior / anki-tags-are-mandatory-to-add-a-card

Ensure that each card added has at least one tag
GNU General Public License v3.0
0 stars 0 forks source link

Suggestion #1

Open cjdduarte opened 4 years ago

cjdduarte commented 4 years ago

I copied this code from reddit. I prefer a question to be asked.

from aqt.addcards import AddCards
from anki.hooks import wrap
from aqt.utils import askUser

def addCards_wrapper(self, _old):
    #if not (self.editor.tags.text() or askUser('Add cards without tags?', defaultno=True)):
    if not (self.editor.tags.text() or askUser('Adicionar cartões sem tags?', defaultno=True)):
        return
    else:
        return _old(self)

AddCards.addCards = wrap(AddCards.addCards, addCards_wrapper, 'around')
Arthur-Milchior commented 4 years ago

I get your point about the question. Wouldn't you accept to make a pull request to add this feature ' I guess if I put it, I'll make it a config, to decide whether it's asked or directly rejected.

Aaarkay1 commented 4 years ago

Amazing!!! Thanks Arthur. A few months ago, I had asked on reddit if any addon w this feature exist, but didn't get any answer. Now I have it. Thanks again, you're god. However, I am still not installing it as it's applicable for each and every deck. So please can you please provide a quick update with feature to restrict compulsory tag for a particular deck (or maybe a group of decks?)? I hope you'll listen.

Arthur-Milchior commented 4 years ago

I won't. Sorry, but I've no time for adding more and more options. If you're willing to pay, I can send you the contract of a freelancer I know who could do it