mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-15 03:36:57 -04:00
Library switching: name prompt, library name under My Photos, docs (#902)
- New Library… from the menu asks for a name (default prefilled), then the location. - The open library's name shows under My Photos in the left panel (hover: its path), so it is visible on macOS too, where the window title isn't. - Switching also remembers the library being left (e.g. the one opened at launch). - whats-new entry and parity row LRC-LIB-CATALOG-SWITCH. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
75cf78175a
commit
d94d6856e9
14 files changed
+99
-14
No files matched your search
@@ -2045,5 +2045,7 @@
|
||||
"Recent Libraries": "Zuletzt verwendete Bibliotheken",
|
||||
"Clear Recent Libraries": "Liste leeren",
|
||||
"No Recent Libraries": "Keine zuletzt verwendeten Bibliotheken",
|
||||
"New Library: Choose Where to Put It": "Neue Bibliothek: Speicherort wählen"
|
||||
"New Library: Choose Where to Put It": "Neue Bibliothek: Speicherort wählen",
|
||||
"New Library": "Neue Bibliothek",
|
||||
"Library name": "Name der Bibliothek"
|
||||
}
|
||||
@@ -1890,5 +1890,7 @@
|
||||
"Recent Libraries": "Bibliotecas recientes",
|
||||
"Clear Recent Libraries": "Borrar bibliotecas recientes",
|
||||
"No Recent Libraries": "No hay bibliotecas recientes",
|
||||
"New Library: Choose Where to Put It": "Nueva biblioteca: elige dónde guardarla"
|
||||
"New Library: Choose Where to Put It": "Nueva biblioteca: elige dónde guardarla",
|
||||
"New Library": "Nueva biblioteca",
|
||||
"Library name": "Nombre de la biblioteca"
|
||||
}
|
||||
@@ -1890,5 +1890,7 @@
|
||||
"Recent Libraries": "Bibliothèques récentes",
|
||||
"Clear Recent Libraries": "Effacer les bibliothèques récentes",
|
||||
"No Recent Libraries": "Aucune bibliothèque récente",
|
||||
"New Library: Choose Where to Put It": "Nouvelle bibliothèque : choisir son emplacement"
|
||||
"New Library: Choose Where to Put It": "Nouvelle bibliothèque : choisir son emplacement",
|
||||
"New Library": "Nouvelle bibliothèque",
|
||||
"Library name": "Nom de la bibliothèque"
|
||||
}
|
||||
@@ -1892,5 +1892,7 @@
|
||||
"Recent Libraries": "最近使ったライブラリ",
|
||||
"Clear Recent Libraries": "最近使ったライブラリを消去",
|
||||
"No Recent Libraries": "最近使ったライブラリはありません",
|
||||
"New Library: Choose Where to Put It": "新しいライブラリ:保存場所を選択"
|
||||
"New Library: Choose Where to Put It": "新しいライブラリ:保存場所を選択",
|
||||
"New Library": "新しいライブラリ",
|
||||
"Library name": "ライブラリ名"
|
||||
}
|
||||
@@ -1890,5 +1890,7 @@
|
||||
"Recent Libraries": "Bibliotecas recentes",
|
||||
"Clear Recent Libraries": "Limpar bibliotecas recentes",
|
||||
"No Recent Libraries": "Nenhuma biblioteca recente",
|
||||
"New Library: Choose Where to Put It": "Nova biblioteca: escolha onde salvá-la"
|
||||
"New Library: Choose Where to Put It": "Nova biblioteca: escolha onde salvá-la",
|
||||
"New Library": "Nova biblioteca",
|
||||
"Library name": "Nome da biblioteca"
|
||||
}
|
||||
@@ -1604,5 +1604,7 @@
|
||||
"Recent Libraries": "Недавние библиотеки",
|
||||
"Clear Recent Libraries": "Очистить список недавних библиотек",
|
||||
"No Recent Libraries": "Нет недавних библиотек",
|
||||
"New Library: Choose Where to Put It": "Новая библиотека: выберите расположение"
|
||||
"New Library: Choose Where to Put It": "Новая библиотека: выберите расположение",
|
||||
"New Library": "Новая библиотека",
|
||||
"Library name": "Название библиотеки"
|
||||
}
|
||||
@@ -2084,5 +2084,7 @@
|
||||
"Recent Libraries": "Нещодавні бібліотеки",
|
||||
"Clear Recent Libraries": "Очистити список нещодавніх бібліотек",
|
||||
"No Recent Libraries": "Немає нещодавніх бібліотек",
|
||||
"New Library: Choose Where to Put It": "Нова бібліотека: виберіть розташування"
|
||||
"New Library: Choose Where to Put It": "Нова бібліотека: виберіть розташування",
|
||||
"New Library": "Нова бібліотека",
|
||||
"Library name": "Назва бібліотеки"
|
||||
}
|
||||
@@ -1890,5 +1890,7 @@
|
||||
"Recent Libraries": "最近的图库",
|
||||
"Clear Recent Libraries": "清除最近的图库",
|
||||
"No Recent Libraries": "没有最近的图库",
|
||||
"New Library: Choose Where to Put It": "新建图库:选择存放位置"
|
||||
"New Library: Choose Where to Put It": "新建图库:选择存放位置",
|
||||
"New Library": "新建图库",
|
||||
"Library name": "图库名称"
|
||||
}
|
||||
@@ -1890,5 +1890,7 @@
|
||||
"Recent Libraries": "最近的圖庫",
|
||||
"Clear Recent Libraries": "清除最近的圖庫",
|
||||
"No Recent Libraries": "沒有最近的圖庫",
|
||||
"New Library: Choose Where to Put It": "新增圖庫:選擇存放位置"
|
||||
"New Library: Choose Where to Put It": "新增圖庫:選擇存放位置",
|
||||
"New Library": "新增圖庫",
|
||||
"Library name": "圖庫名稱"
|
||||
}
|
||||
@@ -182,8 +182,24 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
|
||||
let frame = egui::Frame::NONE.fill(t.chrome).stroke(egui::Stroke::new(1.0, t.divider));
|
||||
frame.show(ui, |ui| {
|
||||
ui.spacing_mut().item_spacing.y = 0.0;
|
||||
let (hr, _) = ui.allocate_exact_size(vec2(ui.available_width(), 44.0), Sense::hover());
|
||||
ui.painter().text(pos2(hr.left() + 18.0, hr.center().y), Align2::LEFT_CENTER, crate::i18n::tr("My Photos"), t.semibold(15.0), t.text);
|
||||
let (hr, header) = ui.allocate_exact_size(vec2(ui.available_width(), 44.0), Sense::hover());
|
||||
// the open library's name under the title, so nobody edits in the wrong one (issue #902)
|
||||
let library = crate::panels::settings::open_library_name(app);
|
||||
let title_y = if library.is_some() { hr.center().y - 7.0 } else { hr.center().y };
|
||||
ui.painter().text(pos2(hr.left() + 18.0, title_y), Align2::LEFT_CENTER, crate::i18n::tr("My Photos"), t.semibold(15.0), t.text);
|
||||
if let Some(name) = library {
|
||||
ui.painter().with_clip_rect(hr.shrink2(vec2(18.0, 0.0))).text(
|
||||
pos2(hr.left() + 18.0, hr.center().y + 10.0),
|
||||
Align2::LEFT_CENTER,
|
||||
name,
|
||||
t.font(11.0),
|
||||
t.text_dim,
|
||||
);
|
||||
crate::widgets::register(ui.ctx(), "label:libraryName", hr);
|
||||
if let Some(l) = app.session.library.as_ref() {
|
||||
header.on_hover_text(l.dir.display().to_string());
|
||||
}
|
||||
}
|
||||
let counts = app.caches.counts(&app.session.catalog);
|
||||
let (total, picks, deleted) = (counts.total, counts.picks, counts.deleted);
|
||||
egui::ScrollArea::both().id_salt("left-scroll").auto_shrink([false, false]).show_viewport(ui, |ui, viewport| {
|
||||
|
||||
@@ -660,12 +660,17 @@ pub fn open_library(app: &mut LightcraftApp, p: &Value) -> Result<Value, String>
|
||||
fn switch_library(app: &mut LightcraftApp, path: &str) -> Result<Value, String> {
|
||||
let dir = lightcraft_engine::library::resolve_dir(std::path::Path::new(path)).map_err(|e| e.to_string())?;
|
||||
let path = dir.to_string_lossy().into_owned();
|
||||
// the library being left goes in the list too (also when it was opened at launch)
|
||||
let previous = app.session.library.as_ref().filter(|l| l.on_disk).map(|l| l.dir.to_string_lossy().into_owned());
|
||||
app.session.close_library().map_err(|e| e.to_string())?;
|
||||
app.session.open_library(&dir, false).map_err(|e| format!("{path}: {e}"))?;
|
||||
app.lightroom_last = None;
|
||||
app.renderer.forget_all();
|
||||
app.ui.compare = None;
|
||||
app.ui.settings.library_path = path.clone();
|
||||
if let Some(prev) = previous.filter(|p| p != &path && !app.ui.settings.recent_libraries.contains(p)) {
|
||||
remember_library(&mut app.ui.settings.recent_libraries, &prev);
|
||||
}
|
||||
remember_library(&mut app.ui.settings.recent_libraries, &path);
|
||||
Ok(json!({"path": path, "name": library_name(&dir), "photos": app.session.catalog.len()}))
|
||||
}
|
||||
@@ -700,6 +705,19 @@ pub fn new_library(app: &mut LightcraftApp, p: &Value) -> Result<Value, String>
|
||||
Some(Value::String(s)) => Some(valid_library_name(s)?),
|
||||
Some(_) => return Err("app.newLibrary: name must be a string".into()),
|
||||
};
|
||||
// from the menu: ask for the name first (default prefilled), then for the location
|
||||
if name.is_none() && p.get("path").is_none() && app.services.pick_folder.is_some() {
|
||||
crate::panels::dialogs::prompt(
|
||||
app,
|
||||
"New Library",
|
||||
"Library name",
|
||||
lightcraft_engine::library::DEFAULT_NAME,
|
||||
"app.newLibrary",
|
||||
json!({}),
|
||||
"name",
|
||||
);
|
||||
return Ok(Value::Null);
|
||||
}
|
||||
let (location, picked) = match p.get("path").and_then(Value::as_str) {
|
||||
Some(x) => (std::path::PathBuf::from(x), false),
|
||||
None => {
|
||||
|
||||
@@ -114,6 +114,27 @@ fn new_library_creates_opens_and_is_remembered_and_named() {
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// From the menu, New Library… asks for a name (default prefilled), then where to put it.
|
||||
#[test]
|
||||
fn new_library_from_the_menu_asks_for_a_name_then_a_location() {
|
||||
let dir = temp("newlibprompt");
|
||||
let mut app = app_in(&dir);
|
||||
let loc = dir.to_string_lossy().into_owned();
|
||||
app.services.pick_folder = Some(Box::new(move || Some(loc.clone())));
|
||||
app.run("app.newLibrary", json!({})).unwrap();
|
||||
let Some(crate::state::Dialog::TextPrompt { value, command, key, .. }) = app.ui.dialog.as_mut() else {
|
||||
panic!("no name prompt: {:?}", app.ui.dialog)
|
||||
};
|
||||
assert_eq!(value, lightcraft_engine::library::DEFAULT_NAME);
|
||||
assert_eq!((command.as_str(), key.as_str()), ("app.newLibrary", "name"));
|
||||
*value = "Wedding".into();
|
||||
// what the dialog's OK runs
|
||||
app.ui.dialog = None;
|
||||
app.run("app.newLibrary", json!({"name": "Wedding"})).unwrap();
|
||||
assert_eq!(app.session.library.as_ref().unwrap().dir, dir.join("Wedding"));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// A remembered library that's gone is greyed out in the menu; opening it anyway is an error that
|
||||
/// keeps the current library open and drops it from the list. The list is capped.
|
||||
#[test]
|
||||
|
||||
@@ -52,10 +52,10 @@ cited here still exists. Formerly docs/parity.md.
|
||||
| X. Cross-cutting behaviours (BEHAV) | 18 | 6 | 1 | 1 | 8/8 (100%) | 6/9 (67%) |
|
||||
| Y. Menus | 82 | 0 | 4 | 8 | 47/47 (100%) | 23/23 (100%) |
|
||||
| Z. Keyboard shortcuts (desktop) | 75 | 3 | 3 | 1 | 49/52 (94%) | 23/24 (96%) |
|
||||
| Lightroom Classic extras | 33 | 15 | 35 | 9 | — | 23/25 (92%) |
|
||||
| **Total** | 397 | 49 | 73 | 36 | 192/200 (96%) | 143/155 (92%) |
|
||||
| Lightroom Classic extras | 34 | 15 | 35 | 9 | — | 24/26 (92%) |
|
||||
| **Total** | 398 | 49 | 73 | 36 | 192/200 (96%) | 144/156 (92%) |
|
||||
|
||||
Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **81.2%** of 519 in-scope rows — P0 98.0% of 200 · P1 95.2% of 155 · P2 47.2% of 163.
|
||||
Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **81.2%** of 520 in-scope rows — P0 98.0% of 200 · P1 95.2% of 156 · P2 47.2% of 163.
|
||||
<!-- /parity:summary -->
|
||||
|
||||
## Top gaps and shortcut notes
|
||||
@@ -681,6 +681,7 @@ From `08-lightroom-classic-extras.md` (Classic-only features) and part 2 of `06-
|
||||
| LRC-LIB-CATALOG-PANEL | Catalog sets | P1 | ✅ | `cmd:library.source` (`missing`) | all, recently added, picks, recently deleted, missing photos (when any) |
|
||||
| LRC-LIB-CATALOG-IMPORT | Native Lightroom Classic catalog import | P1 | 🟡 | `cmd:library.inspectLightroom`, `cmd:library.importLightroom`, `crates/engine/src/lightroom_catalog.rs`, `docs/lightroom-catalog-import.md` | read-only `.lrcat` plus committed WAL pages, in-tree read-only Rust SQLite B-tree reader; background inspection/import with progress/cancellation, per-open library identity checks; originals in place, ratings/flags/labels, XMP, hierarchical keywords, collection sets/regular collections, virtual copies, mapped develop settings; stable reimport identities, undo, missing-file placeholders, existing edits preserved. Best-effort deduplicated recovery archives retain settings/history/snapshots/collection rules (32 MiB each, eight archives/128 MiB aggregate); archive limits/write failures and optional-table limits warn without blocking photo import; unrelated unsupported tables and opaque SQL BLOBs skipped. Custom white balance on relative-WB raws (`RAW` in Lightroom's terms) stays As Shot and is reported, since the catalog keeps no as-shot white to shift from (issue #510). Adobe rendering, AI data and native history replay remain incomplete; no writes to Lightroom catalogs |
|
||||
| LRC-LIB-CATALOG-LOCK | Catalog open in one program at a time | P1 | ✅ | `cmd:app.openLibrary`, `crates/catalog/src/lock.rs`, `crates/engine/src/library.rs` (`open_library`) | exclusive OS lock on `catalog.lock` for the session (app and `lightcraft-cli --library`); a second opener is refused with who has it (`catalog.lock.owner`: program, process, computer); released by the OS on a crash, so never stale; file systems without locks open unprotected with a warning (the app's notices, `library.info` → `settingsWarnings`, and the CLI's stderr; issue #171); no read-only mode; the browser build (OPFS) has no guard across tabs yet. A library that can't be opened at launch (locked, unreadable, newer format, drive missing) shows a window — Try Again, Choose Another Library…, Continue Without Saving (then a banner; nothing written), Quit — instead of a silent demo session (`crates/ui-egui/src/panels/library_problem.rs`) |
|
||||
| LRC-LIB-CATALOG-SWITCH | New / Open Recent catalog, catalog name shown | P1 | ✅ | `cmd:app.newLibrary`, `cmd:app.openLibrary`, `cmd:app.recentLibraries`, `cmd:app.clearRecentLibraries`, `crates/ui-egui/src/panels/settings.rs`, `crates/ui-egui/src/panels/left.rs` | File ▸ New Library… (name, then location), File ▸ Open Recent Library (last 8; missing ones greyed out, dropped when opened; Clear), the open library's name under My Photos and in the window title (issue #902); a library that can't be opened leaves the current one open |
|
||||
| LRC-LIB-FOLDERS | Disk folder tree | P1 | ✅ | `cmd:library.browse`, `cmd:folder.rename`, `cmd:folder.move`, `crates/ui-egui/src/panels/left.rs` (`local_section`, `folder_tree`) | standard places + the browsed folder + Browse Folder…, each an expandable tree of subfolders, breadcrumb navigation; context menu: Rename Folder…, Move Folder To…, Show in Finder (on disk, photos relinked; one undo step each: undo / redo move the folder back and forth, refused when the destination is taken) |
|
||||
| LRC-LIB-LIBFOLDERS | Library folders | P1 | ✅ | `cmd:library.folders`, `cmd:library.source` (`libraryFolder`), `cmd:library.filter` (`libraryFolder`), `cmd:library.removeFolder`, `cmd:folder.rename`, `cmd:folder.move`, `cmd:folder.label`, `cmd:folder.scanChanges`, `cmd:folder.synchronize`, `crates/catalog/src/folders.rs`, `crates/engine/src/sync.rs`, `crates/ui-egui/src/sync.rs`, `crates/ui-egui/src/panels/left.rs` (`folders_section`, `folder_menu_for_library`, `row_menu`), `crates/ui-egui/src/tests_panels.rs` | sidebar Folders: the folders the library's photos were imported from, with photo counts (subfolders included), as another way to explore the library next to By Date and Keywords; Local stays the way to browse any folder on disk. Each disk is a row of its own and starts open: a drive letter, a Windows share (`\\server\share`, `\\?\UNC\…`, `\\wsl$\…`), a macOS share or disk (`/Volumes/tokyo`), a Linux mount (`/media`, `/run/media`, `/mnt`, gvfs `smb-share:…`, `/net/<host>`), NFS (`/Network/Servers/<host>`), else “This Computer” — told apart from the stored paths alone, so an offline share lists like a mounted one and the sidebar never waits on a network. Only folders that hold imported photos are listed (browsed, deleted and demo photos don't count); every folder is a row of its own (`Users` → `me` → `Pictures`), and a folder that holds nothing itself and leads to one folder starts open; every level indents one step more than its parent however deep it goes: the whole sidebar (Albums, Local, By Date, Folders, Keywords) scrolls sideways when its widest row is wider than the panel (rows are measured one frame behind; Create Album and the counts stay at the visible edge); a name that does not fit ends in an ellipsis at the count (the full name on hover; a row asks for room for at most 140 pt of its name, so depth, not one long name, makes the sidebar scroll), as does the grid title; selection and hover bars end at the panel's edge; click makes the folder the source, like an album or a Local folder (its photos and those of the folders inside it fill the grid, titled “photos/travel”; the filter bar narrows it further; `library.source` `libraryFolder` + `path`; kept with the library's view), and its row is always opened into view; the shown folder follows a rename or move and their undo (engine-tested; the sidebar test covers rename), is dropped back to All Photos when it is removed or no longer holds a photo, and a smart album made from the view keeps it, also when its rules are edited (the editor has no folder field). Only a folder that shows exactly its own photos can be shown (not the startup disk, not `/Volumes`-like folders above disks, not an empty one). A row that would cover other disks' photos too (the startup disk, `/Volumes`, `/mnt`…) only opens. Right-click (row or triangle): Rename Folder…, Move Folder To…, Show in Finder (on disk, photos relinked, as in Local), Set Color Label ▸ (the five colours with their custom names, None, Edit Label Names…; `folder.label`, one undo step; the row shows the label's dot before its count and says it with its name; kept in the catalog as a folder record under the folder's identity, so it follows Rename / Move and their undo and redo, the folders inside going along), Synchronize Folder… (the dialog opens at once and scans the folder and the folders inside it on a worker thread — the look for new files beside parallel checks of the library's photos — then offers Import new photos (checked; files only browsed in Local count as new), Relink photos whose file was renamed or moved within the folder (checked; matched by content — a Duplicate's too — or, for a photo with no hash on record such as one from a Lightroom catalog, by file size and dimensions when exactly one file agrees), Remove missing photos from the library (to Recently Deleted) and Read metadata updates from XMP sidecars (saved after the photo came in or was last edited here, and saying something the library doesn't; the sidecar wins), with counts and skipped duplicates / unreadable files; `folder.scanChanges` / `folder.synchronize`, which acts on exactly the scan shown — a scan whose folder's photos changed meanwhile is refused and made again in the background — and is one undo step, also with a full history; a folder that isn't there (an unplugged disk) is reported as such, not as every photo missing; a whole disk or a folder holding disks needs `disk: true`; Esc stops the scan; Synchronize hands everything to a worker thread — the import, the checks that moved and missing files are still as found, the sidecar reads — and commits its steps between frames, shown in the activity stack with ✕ to stop, so no file is touched on the UI thread) and Remove from Library… (asks; moves the folder's photos to Recently Deleted, one undo step, no file touched); a disk row (not the startup disk) offers Set Color Label ▸, Synchronize Folder… and Remove DiLine truncated
|
||||
| LRC-LIB-COLLECTIONS | Collections & sets | P1 | ✅ | `cmd:album.create`, `cmd:album.createSmart`, `cmd:album.toggleTarget`, `cmd:album.setTarget`, `cmd:album.clearQuick` | albums + folders (sets), smart albums (rule editor; rules incl. File Path — the whole string, either separator, case-insensitive), Quick Collection and target album (B in the grids adds / removes the selection; album menu ▸ Set as Target Album; the target is marked +) |
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# What's new in LightCraft
|
||||
|
||||
## 2026-10-11
|
||||
|
||||
### Switching libraries
|
||||
- File ▸ New Library… asks for a name, then where to put it, and opens the new library (issue #902).
|
||||
- File ▸ Open Recent Library lists the last 8 libraries; ones that are gone (moved, drive disconnected) are greyed
|
||||
out. Clear Recent Libraries empties the list.
|
||||
- The open library's name shows under My Photos at the top of the left panel and in the window title.
|
||||
- `lightcraft-cli --library` given a library's own file (`catalog.snap`) opens its folder instead of failing with
|
||||
"File exists".
|
||||
- Agents use `app.newLibrary {path, name}`, `app.recentLibraries` and `app.clearRecentLibraries`.
|
||||
|
||||
## 2026-10-10
|
||||
|
||||
### Activity stack
|
||||
|
||||
Reference in new issue
Block a user