smithery/benzwick

test-bindings

Interactively test mouse button bindings in Slicer

Installation

$ npx skills add smithery/benzwick --skill test-bindings

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/benzwick.

npx skills add smithery/benzwick

Browse all from smithery/benzwick

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Allowed toolsRead

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 4,968 B
  • docs SUMMARY.md 71 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Test Bindings Skill

Interactively test mouse button bindings in Slicer.

When to Use

Use this skill when:

  • User wants to verify their bindings work
  • User is debugging why a binding isn't triggering
  • User wants to see what actions are available

Steps

  1. Check MouseMaster Status

Provide code to check if MouseMaster is active:

```python import slicer

try: mm = slicer.modules.mousemaster widget = slicer.modules.MouseMasterWidget print("MouseMaster module loaded")

# Check if logic is initialized if hasattr(widget, 'logic') and widget.logic: if widget.logic.is_active(): print("Event handler: ACTIVE") else: print("Event handler: INACTIVE") print("Click 'Enable' in the module panel to activate") else: print("Logic not initialized - open the module first") except: print("MouseMaster not loaded - check Extensions Manager") ```

  1. List Current Bindings

Show the current preset configuration:

```python # Get current preset logic = slicer.modules.MouseMasterWidget.logic preset = logic.getcurrentpreset() mouse = logic.getcurrentmouse()

if preset and mouse: print(f"Mouse: {mouse.name}") print(f"Preset: {preset.name}") print("\nDefault Mappings:") for buttonid, mapping in preset.mappings.items(): button = mouse.getbutton(buttonid) name = button.name if button else buttonid print(f" {name}: {mapping.action}")

print("\nContext Mappings:") for context, mappings in preset.contextmappings.items(): print(f" {context}:") for buttonid, mapping in mappings.items(): print(f" {button_id}: {mapping.action}") else: print("No preset or mouse selected") ```

  1. Test Individual Action

Manually trigger an action to verify it works:

```python from MouseMasterLib.action_registry import ActionRegistry, ActionContext

registry = ActionRegistry.get_instance()

# List available actions print("Available actions:") for action in registry.getallactions(): print(f" {action.id}: {action.description}")

# Test specific action context = ActionContext(modulename="Welcome") result = registry.execute("editundo", context) print(f"Action executed: {result}") ```

  1. Monitor Button Presses

Set up real-time monitoring:

```python def onbuttonpress(buttonid, context): print(f"Button: {buttonid}, Context: {context}")

handler = slicer.modules.MouseMasterWidget.logic.eventhandler handler.setonbuttonpress(onbuttonpress) print("Monitoring active. Press buttons to see output.") print("Run: handler.setonbuttonpress(None) to stop") ```

  1. Debug Specific Binding

If a binding isn't working:

```python # Check if button is in profile mouse = logic.getcurrentmouse() button = mouse.getbutton("back") if button: print(f"Button found: {button.name}, Qt code: {button.qtbutton}") print(f"Remappable: {button.remappable}") else: print("Button not found in profile")

# Check if mapping exists preset = logic.getcurrentpreset() mapping = preset.get_mapping("back") if mapping: print(f"Mapping: {mapping.action}") else: print("No mapping defined")

# Check if action exists registry = ActionRegistry.getinstance() action = registry.getaction(mapping.action if mapping else "unknown") if action: print(f"Action found: {action.description}") else: print("Action not registered") ```

Common Issues

Button Press Not Detected

  1. Check handler is installed:

``python print(logic.eventhandler.is_installed) ``

  1. Check handler is enabled:

``python print(logic.eventhandler.is_enabled) ``

  1. Check Qt button code is in profile

Action Not Executing

  1. Verify action is registered:

``python print(registry.getaction("actionid")) ``

  1. Check action availability:

``python context = ActionContext(modulename="SegmentEditor") action = registry.getaction("segmentnext") print(action.handler.isavailable(context)) ``

Context Not Detected

  1. Check current module:

``python print(slicer.app.moduleManager().currentModule()) ``

  1. Verify context name in preset matches exactly

Troubleshooting Checklist

  • MouseMaster module is loaded
  • Logic is initialized
  • Event handler is installed
  • Event handler is enabled
  • Mouse profile is selected
  • Preset is selected
  • Button is in mouse profile
  • Mapping exists for button
  • Action is registered
  • Action is available in current context