config — functions
Settings that outlive the process, and what a load actually did.
Saving is uninteresting: Camera.save_config writes a file.
Loading is not, and the reason is that a configuration file is
routinely not a perfect match for the camera it is being applied to
-- it was written from a different model, or from a camera with a PIF
when this one has none, or it carries sections this build does not
know about.
So Camera.load_config_checked returns a
ConfigLoadReport rather than merely succeeding or throwing. It
separates three things an application actually needs apart:
- which sections the file carried (
ConfigLoadReport.present) - which are now in effect (
ConfigLoadReport.applied) - which were left out, and why (
ConfigLoadReport.omittedandConfigLoadReport.diagnosis)
An import dialog branches on the first two and shows the third to a person. "It loaded" is not the same claim as "all of it loaded", and a load that silently drops the half it could not use is the failure this report exists to make visible.
Sections are a bitmask. describe_sections turns one into
readable text rather than a number, which is the whole difference
between a useful log line and applied: 519.
outcome_name(outcome)
What a load did, as words rather than an ordinal.
section_names(sections)
The sections set in a bitmask, as a list of names.
describe_sections(sections)
A bitmask as readable text.
'nothing' when empty, rather than an empty string that reads
like a formatting bug.