Skip to content

Fix crash in config widget by adding missing validate() method#11

Merged
osteotek merged 1 commit intocrosspoint-reader:masterfrom
FelixAuer:master
Feb 21, 2026
Merged

Fix crash in config widget by adding missing validate() method#11
osteotek merged 1 commit intocrosspoint-reader:masterfrom
FelixAuer:master

Conversation

@FelixAuer
Copy link
Contributor

This fixes an error when saving the devuce configuration dialog.

Calibre expects configuration widgets to implement a validate() method.
Since CrossPointConfigWidget did not define it, closing the dialog raised an AttributeError:

AttributeError: 'CrossPointConfigWidget' object has no attribute 'validate'

This prevents changes made in the widget from being saved.

This PR adds a minimal validate() implementation that returns True, preventing the error and allowing the user to save the device config.

@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

No actionable comments were generated in the recent review. 🎉

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3f3d7b and 28a7d9d.

📒 Files selected for processing (1)
  • crosspoint_reader/config.py
🔇 Additional comments (1)
crosspoint_reader/config.py (1)

79-81: LGTM! This fixes the reported AttributeError.

The minimal validate() implementation correctly addresses the crash. Since save() already falls back to defaults for empty host/path values and the spin boxes constrain numeric ranges, returning True unconditionally is acceptable here.

For future consideration, you could add actual validation (e.g., checking host is non-empty, path starts with /) and show user feedback, but this is not required for the current fix.


📝 Walkthrough

Walkthrough

A validate() method is added to the CrossPointConfigWidget class in crosspoint_reader/config.py. The method is a no-op that returns True and is not invoked elsewhere in the provided code.

Changes

Cohort / File(s) Summary
Config Validation
crosspoint_reader/config.py
Added validate() method to CrossPointConfigWidget class that returns True without implementing validation logic.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a missing validate() method to fix a crash in the config widget.
Description check ✅ Passed The description clearly explains the problem, the error message encountered, and how the PR fixes it by adding the validate() method.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@FelixAuer
Copy link
Contributor Author

Here's a zip with the fixed widget until the bug is fixed in the main repo and release:

crosspoint-calibre-plugin.zip

@osteotek osteotek merged commit 68a7cb4 into crosspoint-reader:master Feb 21, 2026
1 check passed
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.

2 participants