-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a hook for adding links to the top toolbar #448
Conversation
Allows extending the links in the top toolbar, in a similar fashion to editor_did_init_shortcuts
Similar to aqt.editor.Editor.addButton
Tuples don't make for a very nice API - perhaps it's worth biting the bullet and breaking compat here by switching to a dataclass instead? |
(please hold off on further changes to this hook for now - this may need a bit more thought, and some more changes should drop in the next few days that will need to be taken into consideration) |
Yeah, I think that would make sense. Doing a quick search through other add-ons' code bases, it seems like only MorphMan and Customize Keyboard Shortcuts currently patch
Sure, will do! Does this also apply to hooks in other places? I was thinking of adding some hooks to Either way, looking forward to the changes! |
Just the top bar - those other places should be fine. |
Ok, beta 1 is now out. The sync link won't fit in a simple three element dataclass, but perhaps the list could be a union of that dataclass or a string that is used verbatim? |
Uses a CenterLink dataclass to describe individual links, and transforms them into HTML using create_link, which may also be used by add-ons.
…te/anki into top_toolbar_links_hook
Thanks! I ended up going with a slightly different approach (similar to Sorry about the extra merge commit and 075a279, BTW. For whatever reason my venv had an older version of |
ToolbarLink was more of a vestigial left-over from an interim implementation. This change simplifies link addition and brings it closer in line with adding buttons in the editor screen
Simplified the link creation a bit by doing away with the need for |
Thanks! Re your comments on the beta testing thread, I think Sync might be best kept as text for now, as the previous icon was not clear to some users. I don't have strong objections to it being moved to the right hand side again - feel free to send me a patch if you'd like to do that. |
Thanks for the merge! I explored a few options regarding the toolbar, and posted about them in the beta testing thread. Though the gist of it is: None of them ended up being particularly convincing to me :/ |
Came from kaegi/MorphMan#97, and notice the extra underline in between too. When I click "Sync", the popup dialog is always shown up and is blocking, so I don't actually look at that icon frequently. I concur with @dae that it might be best kept as text. Thanks for working on this patch too, the new interface makes adding links very handy. |
Allows extending the top toolbar in Anki's main screen with additional links and/or modifying the existing ones.
Sample add-on (updated):