Repository navigation
feat: enforce SUPPORTS_* capability flags - #25
Merged
Merged
Conversation
The SUPPORTS_* flags were declarative-only: nothing read them (except SUPPORTS_PAGE_NUMBER_CUTS), so a model declaring SUPPORTS_HALF_CUT=False (e.g. PT-P710BT) would still emit the feature. Add LabelPrinter._resolve_feature() and route print()'s auto_cut, half_cut, mirror, chain and special_tape through it: - Explicitly requesting an unsupported feature now raises ValueError. - An unsupported feature is never enabled by its DEFAULT_* (clamped off). print_multi() clamps its bool half_cut default to the printer's capability so the common path falls back to full cuts instead of raising. The CLI likewise only half-cuts when the model supports it, which also fixes the PT-P710BT case where multi-label jobs previously sent a half-cut the firmware ignores (no cut between labels). Adds tests covering the raise, the default clamp, explicit-false on an unsupported feature, and the print_multi/P710BT clamp.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The SUPPORTS_* flags were declarative-only: nothing read them (except SUPPORTS_PAGE_NUMBER_CUTS), so a model declaring SUPPORTS_HALF_CUT=False (e.g. PT-P710BT) would still emit the feature.
Add LabelPrinter._resolve_feature() and route print()'s auto_cut, half_cut, mirror, chain and special_tape through it:
print_multi() clamps its bool half_cut default to the printer's capability so the common path falls back to full cuts instead of raising. The CLI likewise only half-cuts when the model supports it, which also fixes the PT-P710BT case where multi-label jobs previously sent a half-cut the firmware ignores (no cut between labels).
Adds tests covering the raise, the default clamp, explicit-false on an unsupported feature, and the print_multi/P710BT clamp.