Hide Suspended Cards when browsing deck

I have recently began to use a fantastic deck for Japanese vocab and kanji (JLPT N1 - N5 inclusive, over 35000 cards total!).

As I have already been learning for a number of years, I took time to go through and ‘suspend’ all cards with vocab I already know.

I would like to know if there is a way to view only remaining cards (not suspended) so that I can see how many cards I have left to study.

Thanks in advance for your assistance!

You can exclude the suspended cards from search: -is:suspended.

Ref: Searching - Anki Manual

2 Likes

yes but will there a hard button that make them out of my world?

could an addon possible? i’ll ask claude 3.5 later.

thx

cursor c3.5 sonnet:

i haven’t tested it.
anyone could comment on it?

i specifically ask it to be transparent so it’s not touching the search field.

from aqt import gui_hooks, mw
from aqt.qt import *
from aqt.browser import Browser

def setup_toggle_button(browser: Browser):
    # Create toggle button
    toggle_btn = QCheckBox("Show Suspended", browser.form.menubar)
    toggle_btn.setChecked(True)  # Default to showing suspended
    
    # Add to toolbar
    browser.form.toolbarLayout.insertWidget(2, toggle_btn)
    
    # Store original model data function
    original_search = browser.model.search
    
    def filtered_search(text, reset):
        cards = original_search(text, reset)
        if not toggle_btn.isChecked():
            return [card for card in cards if not card.queue == -1]  # Filter out suspended cards
        return cards
    
    # Override the model's search function
    browser.model.search = filtered_search

# Hook into browser setup
gui_hooks.browser_will_show.append(setup_toggle_button)

it’s comment on the mechanism:

Ah, you make a good point! You’re right - we shouldn’t modify the search field as it could interfere with the user’s workflow. Let’s create a cleaner solution that directly filters the card list without touching the search field:

from aqt import gui_hooks, mw
from aqt.qt import *
from aqt.browser import Browser

def setup_toggle_button(browser: Browser):
    # Create toggle button
    toggle_btn = QCheckBox("Show Suspended", browser.form.menubar)
    toggle_btn.setChecked(True)  # Default to showing suspended
    
    # Add to toolbar
    browser.form.toolbarLayout.insertWidget(2, toggle_btn)
    
    # Store original model data function
    original_search = browser.model.search
    
    def filtered_search(text, reset):
        cards = original_search(text, reset)
        if not toggle_btn.isChecked():
            return [card for card in cards if not card.queue == -1]  # Filter out suspended cards
        return cards
    
    # Override the model's search function
    browser.model.search = filtered_search

# Hook into browser setup
gui_hooks.browser_will_show.append(setup_toggle_button)

This new version:

  1. Doesn’t touch the search field at all
  2. Works by filtering the results after the search is performed
  3. Maintains all other search functionality
  4. Is completely transparent to the user

The filtering is done at the model level, which is much cleaner architecturally. Users can continue to use the search field normally, and the suspended cards toggle works independently of any search terms.

Would you like me to add any additional features or make any adjustments to this cleaner version?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.