Open ijgnd opened 3 years ago
I don't really like to add workarounds for other addons into mine, as it increases the complexity, and I typically won't know when the workaround will break.
@Arthur-Milchior
I think the dialog_manager could use a get_active_dialog(name_of_dialog)
kind of method, that could also have a hook for deciding which dialog to return. Maybe that's a way forward.
I've not looked at this for a long time, so I've no idea what you're talking about exactly. Can you please let me know whether you are suggesting me a change to my add-on, in which case I'd appreicate greatly if you can create an issue on it (or @ijgnd maybe ) or if it's a different way for anki to deal with opening window
I'm not really fan of the way windows are managed in anki but I don't really intend to do the change myself
It occures in 2.1.43 (binary from ankiweb) on linux (but I also had it with older anki versions, too).
When I just have "Closet" and Arthur's Opening the same window multiple time in my profile and I try to add a note in the add window I get the following error when clicking the "add" button:
Your functions here uses the built in dict
dialogs._dialogs
whereas Arthur's add-on leaves this dict unused so that the first list index is always None (which triggers the error message) - instead Arthur uses a list of all open dialog in hisdialogs._openDialogs
. I guess a proper fix would be on Arthur's side but I have assumed so far that adjusting his add-on would be more complicated than creating a short function to detect Arthur's add-on.Or maybe Anki should be modified?
Though the gui_hook "add_cards_will_add_note" was renamed and added about a year ago ago it's hardly used. I found it only in:
I guess you and Arthur could easily adjust your add-ons so just breaking compatibility alone should not rule out this change.
This hooks assumes that the note is coming from addCards window according to the description in genhooks_gui.py. So whenever Anki runs this hook there's an instance of addcards that could be passed to this hook. Maybe having this instance is useful for future add-ons (e.g. other add-ons could also create dialogs) so that a general solution that does not depend on the current implentation of the dialog manager would be useful?