I first asked it from nothing,
and the LLMs didn’t work.
then i dnld the addon and ask LLMs to update it. worked.
but from old addon’s page, someone say not always working, i cant sure.
sigh, claude 3.5 sonnet not yet able to replace human.
failed, indeep.sigh
finally working, for 2.1. x
from aqt import mw
from aqt.utils import showInfo
from aqt.qt import *
def toggleDecksCollapsed(collapsed):
"""Toggles all decks to be either expanded or collapsed"""
# get all the decks and set them collapsed/expanded
decks = mw.col.decks.all_names_and_ids()
for deck in decks:
conf = mw.col.decks.get(deck.id)
conf['collapsed'] = collapsed
mw.col.decks.save(conf)
# Refresh the browser to show the changes
mw.deckBrowser.refresh()
def expandAllDecks():
toggleDecksCollapsed(False)
showInfo("All decks expanded")
def collapseAllDecks():
toggleDecksCollapsed(True)
showInfo("All decks collapsed")
# Create menu items using modern Qt syntax
expandAction = QAction("Expand All Decks", mw)
expandAction.triggered.connect(expandAllDecks)
mw.form.menuTools.addAction(expandAction)
collapseAction = QAction("Collapse All Decks", mw)
collapseAction.triggered.connect(collapseAllDecks)
mw.form.menuTools.addAction(collapseAction)
1 Like
wow, i am using 23.10,
i only now know that in the browser, the Rt click menu already contains the collapse function.
yet in the deck view, there is no such function by default,
so this updated addon helps.
1 Like
the collapse/collapse children that build in the anki seems dont “collapse every level” but only several.
i use LLMs to wrote a 2nd one for the browser.
post if someone interested.
1 Like
Wow, very nice!
Why don’t you upload your add-on to AnkiWeb and release it?
Some ideas:
[1] showInfo requires the user to press the “OK” button, so I think it would be better to remove it in the same way as the original add-on or use tooltip instead:
from aqt.utils import tooltip
def expandAllDecks():
toggleDecksCollapsed(False)
tooltip("All decks expanded")
[2] Maybe putting the actions in one menu would make them easier to manage:
addonMenu = QMenu("Expand and Collapse Decks", mw)
mw.form.menuTools.addMenu(addonMenu)
expandAction = QAction("Expand All Decks", mw)
expandAction.triggered.connect(expandAllDecks)
addonMenu.addAction(expandAction)
collapseAction = QAction("Collapse All Decks", mw)
collapseAction.triggered.connect(collapseAllDecks)
addonMenu.addAction(collapseAction)
[3] This add-on is for the deck options, so it might be good to access it from the deck options (gear icon). This code will add the addon menu to the options:
from aqt import gui_hooks
def addDeckBrowserOption(menu:QMenu, deck_id):
menu.addMenu(myAddonMenu)
gui_hooks.deck_browser_will_show_options_menu.append(addDeckBrowserOption)
Edit: It may be useful to customize this to expand or cooapse all the child decks of the selected deck only, like the browser.
post here, i need only 5mins.
upload? then edit a new page? put on github and make a readme?
no thank you. may be others could share the work load.
thanks
1 Like
may be someone could pick them up,
i myself only need the “collapse all” function so i can click into the one i want.
i got some OCD obsessive compulsive disorder so i will crazy if it’s collapsed somewhere and expanded somewhere.
thanks
1 Like
I customized it and uploaded it to Ankiweb.
add-on: Expand Collapse Deck (Customized by Shigeඞ)
1 Like
if LLMs cant write one from scratch but could help update old ones,
that’s still relieved a whole lot of workload.
AI helps human, cant replace yet.
self censored
you still need to stab a knife or pull a trigger of a gun to kill someone else.
although somebodies enjoy using bare hands
1 Like
LLM is very useful for making simple tasks more efficient, so it may be interesting if there is a manual for developing Anki add-ons with LLM.
isn’t i saw you or ankiking asking for addon ideas?
much addons have been wrote for anki before the LLMs era,
so be it.
ps: however i have used LLMs to wrote some very small addons that nobody think useful.
i wrote one that in the browser, you select a card and can change the “deck window”'s deck into that card’s deck.
i myself use it very very often but no one interested.
you could search my old post, again i posted right here but not spending several more times to polish it - if others wanna use, they can simply grab it.
of course i appreciate you and others work to polish the all the wonderful addons.
1 Like
Oh, you seem to be developing some interesting things. The priority of super memo by subdeck looks very good, I am already doing something similar to that in my decks. I will look into it later to see if I can make them add-ons.