Skip to content

fix: preserve library context in plugin settings - #35

Merged
bps merged 1 commit into
mainfrom
fix/plugin-settings-columns
Sep 30, 2026
Merged

bps merged 1 commit into
mainfrom
fix/plugin-settings-columns

Conversation

@bps

@bps bps commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Description

Calibre's Preferences → Plugins → Customize entry point calls do_user_config() with only the parent GUI. Unlike the toolbar entry point, it does not pass the running plugin action. This left every column dropdown at “(Not mapped)” and could erase all eight saved mappings when the dialog was accepted.

  • Fall back to Calibre's loaded interface action when no action is supplied explicitly.
  • Pass the loaded action through the config_widget() hook as well.
  • Add regression tests using the real plugin and configuration logic with mocked Calibre/Qt boundaries. Cover column discovery, saved mappings, explicit-action precedence, and cancellation.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Verification

  • Before the fix: three regression cases failed (Preferences column discovery, config_widget() column discovery, and Preferences mapping preservation); the toolbar and cancellation cases passed.
  • After the fix: all six regression cases pass.
  • Full suite: 501 passed, 23 live-API integration tests skipped. No real-library or API writes were performed.
  • Ruff lint and formatting checks pass.
  • Pyright reports six existing errors in unchanged files; the same errors were verified against unmodified HEAD before this commit.
  • No interactive Calibre UI reproduction was performed.

Checklist

  • Tests pass (full local suite; live-API integration tests skipped)
  • Code is formatted
  • Documentation reviewed; no update needed

Related issues

Fixes #34

Reporter workaround: #1 (comment)

Use Calibre's loaded interface action when Preferences opens the plugin
configuration without an explicit action. Apply the same context to the
config_widget hook.

Add regression tests for column discovery, mapping preservation,
explicit-action precedence, and cancellation.

Fixes #34
@bps
bps marked this pull request as ready for review September 30, 2026 14:05
@bps
bps merged commit c420a19 into main Sep 30, 2026
4 checks passed
@bps bps mentioned this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config prompt from plugin settings doesn't pass current instance

1 participant