Make the People screen a place work can be done
Five faults, all on one screen, and the Slint and Rust halves of each have to land together. **Regroup froze the window.** It ran inside the Slint callback, on the UI thread. It is much faster now, but fast is not bounded — the work grows with the library, and the one thing that must not grow with the library is how long the window stops answering. It runs on a worker thread with an mpsc channel and a 250ms poll, like every other long pass in this module, and the button says what it is doing instead of the window going quiet. Cancellation is dropping the receiver. Reclustering also prunes the empty groups the previous pass left, so pressing the button twice no longer fills the rail with "Unnamed (0 faces)". **The faces were a single row running off the screen.** The comment on the layout claimed to be a wrapping row; Slint has no flow layout and a HorizontalLayout does not wrap, so a person with forty faces was a person whose faces could not be reviewed past the fifth. It is now laid out the way the library grid lays out thumbnails, with the same arithmetic: choose how many columns of roughly the requested size fit, then divide the width between them so the cells fill the row exactly and nothing overhangs. **The header did not fit a phone.** A 240px name field beside five buttons is wider than an Android screen — and worse than not fitting, a layout cannot be narrower than its children's minimums, so the row reported that oversized minimum upwards and inflated the whole screen. The faces grid is its sibling, so it would have been measured against a width that was never on the display. The header is now two rows, the actions sit in a Flickable that scrolls rather than overflowing, and the rail narrows to 132px on the compact class. **Strangers crowded out the people who matter.** Most clusters in a real library are passers-by and other people's guests. "Not interested" sets a group aside; the rail hides it and says how many are hidden, with one button to bring them back. Reversible, and never a deletion — see the catalog commit for why. **A face was a dead end.** Identifying someone and then having no way to see their photographs is a filing cabinet with no drawer handles. "Show photos" narrows the library grid to that person and leaves a chip on the filter bar saying so, which is also how it is cleared. It is a term on `RatingFilter` rather than a grid scope of its own, exactly as that struct's own doc says new narrowing terms should be — so the count and the cells are narrowed by the same thing, and it composes with the others for free. Suggested faces count, not only confirmed ones, or a freshly grouped person would show an empty grid. Crops are read from where they are now stored, falling back to cutting one out of the proxy for faces indexed before that existed. 480 tests pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -249,6 +249,25 @@ pub struct RatingFilter {
|
||||
/// above: the count and the cells must be narrowed by the same thing.
|
||||
pub captured_from: Option<i64>,
|
||||
pub captured_to: Option<i64>,
|
||||
/// TRACES: FR-CULL-11
|
||||
/// Only photographs this person appears in.
|
||||
///
|
||||
/// The way back from a face to the pictures it came from, which is the
|
||||
/// question the People screen leaves the user holding: they have just
|
||||
/// identified someone, and what they want next is *everything with them in
|
||||
/// it*. Without this the identification is a dead end.
|
||||
///
|
||||
/// Here rather than a grid scope of its own, for the reason `local_only`
|
||||
/// gives above — the count and the cells must be narrowed by the same
|
||||
/// thing, and this struct is the one narrowing every query path already
|
||||
/// threads. It composes with the rest for free: three-star photographs of
|
||||
/// Anna from last summer is this term ANDed with two others.
|
||||
///
|
||||
/// Suggested faces count, not only confirmed ones. A user who has just
|
||||
/// grouped someone and not yet confirmed a single face would otherwise get
|
||||
/// an empty grid, which reads as "no photographs of this person" rather
|
||||
/// than "you have not ticked anything yet".
|
||||
pub person: Option<u64>,
|
||||
}
|
||||
|
||||
impl RatingFilter {
|
||||
@@ -260,6 +279,7 @@ impl RatingFilter {
|
||||
&& !self.local_only
|
||||
&& self.captured_from.is_none()
|
||||
&& self.captured_to.is_none()
|
||||
&& self.person.is_none()
|
||||
}
|
||||
|
||||
/// Whether a date range is narrowing the grid.
|
||||
@@ -333,6 +353,17 @@ impl RatingFilter {
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(person) = self.person {
|
||||
// An integer this code owns, like every other term here. `EXISTS`
|
||||
// rather than a join, so a photograph holding three faces of the
|
||||
// same person appears once — the grid shows pictures, not faces.
|
||||
terms.push(format!(
|
||||
"EXISTS (SELECT 1 FROM faces f
|
||||
JOIN face_person fp ON fp.face_id = f.id
|
||||
WHERE f.image_id = i.id AND fp.person_id = {person})"
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(flag) = self.flag {
|
||||
terms.push(format!(
|
||||
"coalesce((SELECT dv.flag FROM versions dv
|
||||
@@ -4587,6 +4618,7 @@ mod tests {
|
||||
confidence: 0.9,
|
||||
embedding: vec![0u8; 1024],
|
||||
crop_px: 120.0,
|
||||
crop: Vec::new(),
|
||||
model_id: "w600k_mbf".into(),
|
||||
};
|
||||
dr_catalog::faces::record_detections(
|
||||
@@ -4635,6 +4667,7 @@ mod tests {
|
||||
confidence: 0.9,
|
||||
embedding: vec![0u8; 1024],
|
||||
crop_px: 120.0,
|
||||
crop: Vec::new(),
|
||||
model_id: "w600k_mbf".into(),
|
||||
};
|
||||
let orphan = ids[40];
|
||||
|
||||
Reference in New Issue
Block a user