Summary
RayMol#258 wired up cmd.set_key dispatch, which made PyMOL's 125 built-in default bindings live for the first time. That surfaced an asymmetry in the F-key scene workflow: you can store a scene to an F-key but not recall it.
CTRL-F1 … CTRL-F12 → scene F1, store … scene F12, store are real entries in modules/pymol/shortcut_dict.py (lines 112–137), so storing works.
- Bare
F1 … F12 are not in the defaults. In upstream PyMOL, recall works anyway because _special falls through: it tries _invoke_key first, and if no binding exists it looks the key up against the scene list and the view dict.
RayMol's bridge calls pymol.internal._invoke_key(token) directly (PyMOLBridge_InvokeKey in PyMOLBridge.mm), deliberately bypassing _special — because PyMOL_Special also grabs arrows for the core's hidden Ortho prompt, which RayMol doesn't use. The side effect is that the scene/view fallback is skipped too.
Impact
A user presses ⌃F1 to store a scene, then presses F1 to get it back and nothing happens. Storing silently succeeds; recall silently does nothing. Scenes are still reachable via the Scene panel and the scene F1 command, so this is a parity gap rather than data loss.
Not a regression — before #258 neither half worked.
Proposed fix
Add an invoke(token) helper to modules/pymol/raymol_keys.py that mirrors _special's fallthrough without touching upstream files:
internal._invoke_key(token, 1) — if it fires, return true.
- Otherwise, for special-key names only, try the scene list then the view dict, using the same
Shortcut-based prefix interpretation _special uses.
- Return whether anything fired.
Then point PyMOLBridge_InvokeKey at that helper instead of _invoke_key. The consume-iff-fired contract the monitor depends on is preserved: a successful scene recall counts as fired.
Keep it out of the arrow path — left/right are bound to movie frames by default, so they never reach a fallback anyway, and we do not want to reintroduce Ortho's arrow-grabbing behavior.
Verification
- Pure-Python test in
testing/tests/test_raymol_keys.py: with a fake cmd exposing a scene list, assert invoke('F1') recalls the scene and returns true; assert an unknown token returns false.
- Manual:
⌃F1 to store, orbit away, F1 to recall.
Summary
RayMol#258 wired up
cmd.set_keydispatch, which made PyMOL's 125 built-in default bindings live for the first time. That surfaced an asymmetry in the F-key scene workflow: you can store a scene to an F-key but not recall it.CTRL-F1…CTRL-F12→scene F1, store…scene F12, storeare real entries inmodules/pymol/shortcut_dict.py(lines 112–137), so storing works.F1…F12are not in the defaults. In upstream PyMOL, recall works anyway because_specialfalls through: it tries_invoke_keyfirst, and if no binding exists it looks the key up against the scene list and the view dict.RayMol's bridge calls
pymol.internal._invoke_key(token)directly (PyMOLBridge_InvokeKeyin PyMOLBridge.mm), deliberately bypassing_special— becausePyMOL_Specialalso grabs arrows for the core's hidden Ortho prompt, which RayMol doesn't use. The side effect is that the scene/view fallback is skipped too.Impact
A user presses
⌃F1to store a scene, then pressesF1to get it back and nothing happens. Storing silently succeeds; recall silently does nothing. Scenes are still reachable via the Scene panel and thescene F1command, so this is a parity gap rather than data loss.Not a regression — before #258 neither half worked.
Proposed fix
Add an
invoke(token)helper tomodules/pymol/raymol_keys.pythat mirrors_special's fallthrough without touching upstream files:internal._invoke_key(token, 1)— if it fires, return true.Shortcut-based prefix interpretation_specialuses.Then point
PyMOLBridge_InvokeKeyat that helper instead of_invoke_key. The consume-iff-fired contract the monitor depends on is preserved: a successful scene recall counts as fired.Keep it out of the arrow path —
left/rightare bound to movie frames by default, so they never reach a fallback anyway, and we do not want to reintroduce Ortho's arrow-grabbing behavior.Verification
testing/tests/test_raymol_keys.py: with a fake cmd exposing a scene list, assertinvoke('F1')recalls the scene and returns true; assert an unknown token returns false.⌃F1to store, orbit away,F1to recall.