Repository navigation
Conversation
Inkcut installs qreactor but never starts it, so the twisted thread pool never runs and deferToThread'd work never executes. This helper runs the callable in a daemon thread and fires the returned Deferred on the main thread via enaml's deferred_call (a thread-safe QEvent post). Without an enaml Application (cli/tests) it runs inline.
… fires With a FIFO whose reader died, loseConnection() never triggers connectionLost: the write fd stayed open forever (holding the FIFO's writer side hostage) and 'connected' was never reset, so the next connect() was skipped as already-connected. Close the captured fd after a grace period (guarded against descriptor reuse) and reset the flag on disconnect.
_default_request_approval is evaluated by __getstate__ (clone/state save) and _observe_document can fire during state restore before the job plugin exists; both now resolve the plugin lazily and fall back to parser defaults instead of raising AttributeError.
…aults - Pre-feed: optionally feed the media out to the job's full length and back before cutting, paced host-side in small steps (some firmwares ignore protocol velocity commands); pause/cancel aware and relative to the current origin so feed-past jobs never rewind over prior cuts - Flush barrier: a transport may buffer writes on a worker thread; wait for its flush() (duck-typed) before declaring a job complete or disconnecting, so queued data is never dropped mid-job. Cancelled jobs skip the flush and drop their queue - Honor the driver-declared connection and protocol order when building a device so transports[0]/protocols[0] (the defaults) match what the driver declares instead of plugin registration order - An explicit cut velocity takes precedence over the general speed setting; a job cancelled during the final drain is no longer marked complete
This was referenced Aug 19, 2026
Twelve tests over the pre-feed step builder and the device origin handling: host-paced step construction and its delays, the velocity commands emitted around a pre-feed, feeding from the device origin rather than absolute zero, and the cancelled/dead-connection paths. No hardware is required; the tests drive the protocol through a fake transport. The Qt application is created from a session fixture rather than at import, so collecting this module does not stop test_app from constructing the application inkcut.app.main() needs.
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
Core device-layer fixes found while getting a VEVOR KH-870 (CH554 CDC, USB
0483:5750) cutting reliably on macOS — background and full protocol notes in https://github.com/mcmartnor/vevor-cutter-macos and issue #409.defer_to_threadhelper (core/utils.py): run blocking work on a daemon thread and fire the Deferred on the GUI thread via enaml'sdeferred_call. Inkcut installs qreactor but never starts it, soreactor.runningis False in the app and twisted's owndeferToThreadwork never executes; this helper is reactor-free. Used by the follow-up USB-transport and PDF-import PRs.connectionLostnever fires, so a stale connection can't leak the fd and block reconnects.Job._observe_documentandJobInfo._default_request_approvalno longer crash when the workbench/plugin doesn't exist yet (state restore, standalone use).submit()waits for an optional transportflush()(buffered transports) before declaring a job complete, and skips it for cancelled jobs.transports[0]/protocols[0](the defaults) are what the driver declares instead of registration order.cut_velocitytakes precedence over the general speed setting, and0means "firmware default — send nothing".Testing
Exercised daily on real hardware (VEVOR KH-870 over the native USB transport from the follow-up PR), verified end-to-end on vinyl. Tests for the pre-feed step builder and the origin handling are included in
tests/test_prefeed.py(12 tests, no hardware needed). Upstream defaults are preserved (feed_to_endstays off).🤖 Generated with Claude Code