Another try to get keybindings working.
This commit is contained in:
parent
2090767794
commit
e2364a154a
@ -663,6 +663,9 @@ def loadUserSettings(script=None, inputEvent=None, skipReloadMessage=False):
|
||||
|
||||
_scriptManager.activate()
|
||||
_eventManager.activate()
|
||||
|
||||
# Refresh keybindings to include plugin bindings (after script manager is active)
|
||||
cthulhuApp.getPluginSystemManager().refresh_active_script_keybindings()
|
||||
|
||||
cthulhuApp.getSignalManager().emitSignal('load-setting-begin')
|
||||
# cthulhuApp.getPluginSystemManager().register_plugin_keybindings_with_active_script()
|
||||
|
@ -156,6 +156,22 @@ class PluginSystemManager:
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
def refresh_active_script_keybindings(self):
|
||||
"""Force active script to refresh its keybindings to include plugin bindings."""
|
||||
from . import cthulhu_state
|
||||
if cthulhu_state.activeScript:
|
||||
active_script = cthulhu_state.activeScript
|
||||
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||
f.write(f"=== refresh_active_script_keybindings() CALLED ===\n")
|
||||
f.write(f"Active script: {active_script.name}\n")
|
||||
|
||||
# Force the script to recreate its keybindings to include plugin bindings
|
||||
old_keybindings = active_script.keyBindings
|
||||
active_script.keyBindings = active_script.getKeyBindings()
|
||||
|
||||
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||
f.write(f"Keybindings refreshed: old={len(old_keybindings.keyBindings) if old_keybindings else 0}, new={len(active_script.keyBindings.keyBindings)}\n")
|
||||
|
||||
def register_plugin_keybindings_with_active_script(self):
|
||||
"""Register all plugin keybindings with the active script."""
|
||||
|
||||
|
@ -363,6 +363,8 @@ class Script(script.Script):
|
||||
return keyBindings
|
||||
|
||||
def getExtensionBindings(self):
|
||||
with open('/tmp/extension_bindings_debug.log', 'a') as f:
|
||||
f.write(f"=== getExtensionBindings() called ===\n")
|
||||
keyBindings = keybindings.KeyBindings()
|
||||
|
||||
bindings = self.notificationPresenter.get_bindings()
|
||||
|
Loading…
x
Reference in New Issue
Block a user