Repository navigation
Fix hiding of configured multi-protocol printers when adding printers - #485
Merged
Merged
Conversation
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.
Summary
This PR addresses two related multi-protocol printer issues in
NewPrinterGUI:Suppress already-configured multi-protocol printers from discovery:
Previously (from PR Suppress already configured printers in New Printer window #465),
_filter_configured_devices()only filtered devices by exact URI match. If a multi-protocol printer was already configured via IPP, its other discovered endpoints (e.g., LPD, AppSocket) still appeared in the New Printer search results.Discovered devices are now grouped into
PhysicalDeviceinstances (matching by DNS-SD service instance name or serial number). If any queue for that physical printer is already configured in CUPS, all of its discovered connections are suppressed to avoid duplicate queue creation.Prevent driverless PPD reuse when switching connections:
When setting up a new printer with multiple connection options, switching between connections (e.g., from an IPP/driverless connection to LPD) could leave the previously cached driverless PPD associated with the printer, leading to an incorrect driver selection for non-driverless connections.
Connection-specific driverless PPD caches are now validated against the current device URI and cleared when switching connections.
Changes
Physical device-aware filtering:
_filter_configured_devices()to map configured queues and discovered devices toPhysicalDeviceobjects.Driverless PPD cache invalidation:
_cached_driverless_ppdand_cached_driverless_ppd_namewhen switching to a different device or non-matching URI.Testing
test_newprinter.py:test_filter_configured_devices_multiprotocol_hidden: Verifies IPP + LPD endpoints are both hidden if one is configured.test_filter_configured_devices_unrelated_printer_visible: Ensures unrelated printers remain visible.test_filter_configured_devices_identical_models_different_hosts_separate: Ensures separate physical units are not grouped incorrectly.test_filter_configured_devices_same_ip_different_queues_stay_separate: Ensures distinct non-DNS-SD socket queues stay separate.test_device_from_object_explicit_kwargs: Verifies proper device attributes construction.test_switching_connection_does_not_reuse_stale_driverless_ppd: Verifies switching from IPPS to LPD does not reuse the driverless PPD.pytest -q test_newprinter.py— all tests pass.