Skip to main content

Module item_ops

Module item_ops 

Source
Expand description

Item commands that work on an item’s files or on per-item keys Eagle writes for them: Duplicate, Replace with File, changing the extension, Pin to Top inside a folder and marking a palette colour as the item’s primary colour.

On disk these follow Eagle: a duplicate is a copy of the whole <ID>.info folder under a new id whose metadata.json differs only in id; a pin is pinned: {<folder id>: <ms>} on the item; a primary colour is marked: true on one palette entry (Eagle writes false when it is unmarked again). Originals are never left half written: new bytes go to a temporary file in the .info folder first and the old original is kept as <file>.bk until the new one is in place.

Enums§

ExtensionError
Why an extension typed into the Change Extension dialog is refused.

Constants§

MARKED_KEY
The palette key marking an item’s primary colour.
MAX_EXTENSION
Longest extension the Change Extension dialog accepts.
PINNED_KEY
The item key holding the folders it is pinned in.

Functions§

all_pinned
Whether every item is pinned in folder (Eagle then offers Unpin instead of Pin; it looks at the first 100 of the selection).
check_extension
Checks an extension as Eagle’s dialog does (letters and digits, at most MAX_EXTENSION) and returns it in lower case, as stored.
pinned_at
When the item was pinned to the top of folder (ms), if it is. As in Eagle, a zero stamp counts as not pinned.
pinned_first
Moves the items pinned in folder to the front, the most recently pinned first; the rest keep their order. Eagle does this inside a folder unless the folder is sorted at random.