fix: isolate filament profiles per printer in multi-printer bridge #75
Reference in New Issue
Block a user
No description provided.
Delete Branch "walterioo/KX-Bridge-Release:fix/per-printer-filament-profiles"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
In a multi-printer setup (one bridge, several
[printer_N]), the per-slotfilament→profile mapping and
visible_vendorswere stored in a single global[filament_profiles]section. Configuring one printer overwrote the other, andafter a restart both printers loaded whichever mapping was saved last.
This makes each printer keep its own
[filament_profiles_<id>]section bythreading the existing
self._printer_idthrough the fourconfig_loaderhelpers. A read-fallback to the legacy global
[filament_profiles]section keepssingle-printer setups and existing configs working with no migration step.
It also fixes a related UI symptom: the header printer-dropdown and the
printers-management "switch" link navigated within the same port (
/printerN),so viewing another printer pulled its profile names cross-instance from the local
origin — the AMS colors were correct but the profile names were the local
printer's. The links now point at each printer's own
bridge_url, so everyprinter is viewed same-origin on its own port.
Notes:
printer_id=Nonekeeps the original global section → fully backward compatible.Optional[...](noX | Y) per the contributor guide.Related Issue
Closes #74
Type
Tested with
Checklist
tests/test_filament_profiles_per_printer.py)Merged — thank you @walterioo!
Clean approach: the
_filament_section()helper keeps the logic in one place, and the read-fallback to the legacy global[filament_profiles]section means existing single-printer configs need zero migration. Thebridge_url-based navigation fix for the printer dropdown is a nice catch on top.Tests cover all the relevant cases (isolation, fallback order, vendor-seed on first per-printer write). Will go out with the next nightly build.