[in the title I had to split up the name of the hook because the forum software won’t allow me to post long words in the title]
This hook does not work for me.
I have tried in windows and linux, with 2.1.49/qt5 and the latest dev version with qt 6.3.1.
I have this minimal add-on:
from aqt import mw
from aqt import gui_hooks
from aqt.utils import showText
print("... in general print messages are visible")
def helper(reviewer):
showText("test")
def add_entry(reviewer, menu):
print("...hook was called")
# the next two lines are from add-on "Show Question"
# https://ankiweb.net/shared/info/1566569834
entry = [["Show Question", "", reviewer._showQuestion]]
reviewer._addMenuItems(menu, entry)
menutext = "show info box"
action_nid = menu.addAction(menutext)
qconnect(action_nid.triggered, lambda _, r=reviewer:helper(r))
gui_hooks.reviewer_will_show_context_menu.append(add_entry)
I have made this screencast to show what I’ve done and what I expect. In this screencast I use just one add-on - a stripped down version of Show Question - AnkiWeb (which didn’t work for me). This screencast was made in linux with the latest anki dev version and qt 6.3.1 and python 3.9.10.
with the add-on provided I expect to see the message printed “…hook was called” when I right click in the reviewer. This does not work. I just get the default “copy” in the context menu.