more debugging.
This commit is contained in:
parent
90aecf8055
commit
0edbefac47
@ -159,30 +159,54 @@ class PluginSystemManager:
|
|||||||
def register_plugin_keybindings_with_active_script(self):
|
def register_plugin_keybindings_with_active_script(self):
|
||||||
"""Register all plugin keybindings with the active script."""
|
"""Register all plugin keybindings with the active script."""
|
||||||
|
|
||||||
|
logger.info("=== register_plugin_keybindings_with_active_script() CALLED ===")
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write("=== register_plugin_keybindings_with_active_script() CALLED ===\n")
|
||||||
|
|
||||||
if not PLUGGY_AVAILABLE:
|
if not PLUGGY_AVAILABLE:
|
||||||
|
logger.warning("PLUGGY not available")
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write("ERROR: PLUGGY not available\n")
|
||||||
return
|
return
|
||||||
|
|
||||||
from . import cthulhu_state
|
from . import cthulhu_state
|
||||||
if not cthulhu_state.activeScript:
|
if not cthulhu_state.activeScript:
|
||||||
logger.warning("No active script available to register plugin keybindings")
|
logger.warning("No active script available to register plugin keybindings")
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write("ERROR: No active script available\n")
|
||||||
return
|
return
|
||||||
|
|
||||||
active_script = cthulhu_state.activeScript
|
active_script = cthulhu_state.activeScript
|
||||||
logger.info(f"Registering plugin keybindings with active script: {active_script}")
|
logger.info(f"Registering plugin keybindings with active script: {active_script}")
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write(f"Active script: {active_script}\n")
|
||||||
|
|
||||||
# First, register keybindings from APIHelper's stored bindings
|
# First, register keybindings from APIHelper's stored bindings
|
||||||
# This is where plugin keybindings actually get stored
|
# This is where plugin keybindings actually get stored
|
||||||
from . import cthulhu
|
from . import cthulhu
|
||||||
api_helper = cthulhu.cthulhuApp.getAPIHelper()
|
api_helper = cthulhu.cthulhuApp.getAPIHelper()
|
||||||
if api_helper and hasattr(api_helper, '_gestureBindings'):
|
if api_helper and hasattr(api_helper, '_gestureBindings'):
|
||||||
logger.info("Registering stored gesture bindings from APIHelper")
|
logger.info("=== FOUND APIHelper with _gestureBindings ===")
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write("=== Registering stored gesture bindings from APIHelper ===\n")
|
||||||
|
f.write(f"Total contexts: {len(api_helper._gestureBindings)}\n")
|
||||||
|
|
||||||
for context_name, bindings_list in api_helper._gestureBindings.items():
|
for context_name, bindings_list in api_helper._gestureBindings.items():
|
||||||
logger.info(f"Processing context '{context_name}' with {len(bindings_list)} bindings")
|
logger.info(f"Processing context '{context_name}' with {len(bindings_list)} bindings")
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write(f"Context '{context_name}': {len(bindings_list)} bindings\n")
|
||||||
|
|
||||||
for binding in bindings_list:
|
for binding in bindings_list:
|
||||||
logger.info(f"Adding stored binding: {binding.keysymstring} with modifiers {binding.modifiers}")
|
logger.info(f"Adding stored binding: {binding.keysymstring} with modifiers {binding.modifiers}")
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write(f" Binding: {binding.keysymstring} modifiers={binding.modifiers} desc={binding.handler.description}\n")
|
||||||
|
|
||||||
# Check if binding already exists to avoid duplicates
|
# Check if binding already exists to avoid duplicates
|
||||||
if not active_script.getKeyBindings().hasKeyBinding(binding, "keysNoMask"):
|
if not active_script.getKeyBindings().hasKeyBinding(binding, "keysNoMask"):
|
||||||
active_script.getKeyBindings().add(binding)
|
active_script.getKeyBindings().add(binding)
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write(f" ADDED to active script!\n")
|
||||||
|
|
||||||
# Force recalculation of keycode if it wasn't set when device was None
|
# Force recalculation of keycode if it wasn't set when device was None
|
||||||
if not binding.keycode and binding.keysymstring:
|
if not binding.keycode and binding.keysymstring:
|
||||||
from . import keybindings
|
from . import keybindings
|
||||||
@ -195,6 +219,16 @@ class PluginSystemManager:
|
|||||||
logger.warning(f"Failed to create key grab for {binding.keysymstring} - device may not be available")
|
logger.warning(f"Failed to create key grab for {binding.keysymstring} - device may not be available")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Binding already exists: {binding.keysymstring}")
|
logger.info(f"Binding already exists: {binding.keysymstring}")
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write(f" Already exists, skipped\n")
|
||||||
|
else:
|
||||||
|
logger.warning("=== NO APIHelper or no _gestureBindings found ===")
|
||||||
|
with open('/tmp/plugin_registration.log', 'a') as f:
|
||||||
|
f.write("ERROR: No APIHelper or no _gestureBindings found!\n")
|
||||||
|
if api_helper:
|
||||||
|
f.write(f"APIHelper exists but _gestureBindings: {hasattr(api_helper, '_gestureBindings')}\n")
|
||||||
|
else:
|
||||||
|
f.write("No APIHelper found!\n")
|
||||||
|
|
||||||
# Also check the old method for any plugins that use get_bindings()
|
# Also check the old method for any plugins that use get_bindings()
|
||||||
for pluginInfo in self._plugins.values():
|
for pluginInfo in self._plugins.values():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user