mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-11 04:52:13 +00:00
printer_queues() (#618) lists the queues without asking any driver, so every printer's two_sided is unknown there. A Print dialog listing from it still needs to know whether the printer the user picks takes two-sided settings, without asking every other driver as printers() does: Windows takes about 48 s to give up on a printer it can't reach, such as a WSD printer on another network (storytold/pdfcraft#2192). two_sided(printer) finds that queue and reads its driver's capabilities with the same check printers() makes, so the answers match. It is None when there is no such queue, when the capabilities can't be read, and off Windows, as printers() reports there. The paused-printer test now checks that two_sided(name) gives printers()'s answer for the test queue from exactly one driver query, and a new test checks that a name no queue has is unknown. The query counting moves into a small helper, which keeps windows_jobs_reach_the_spooler under the cognitive-complexity limit. Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>