Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

LRC-LIB-KEYWORDS: the Keyword List needs no selection

Nathaniel Ledford344db72c850c
diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.json
index cdd96f9dc..23a5879ed 100644
--- a/crates/ui-egui/locales/de.json
+++ b/crates/ui-egui/locales/de.json
@@ -1910,5 +1910,6 @@
"Purge Unused Keywords": "Nicht verwendete Stichwörter löschen",
"Delete Keyword…": "Stichwort löschen…",
"Drop here for the top level": "Hier ablegen für die oberste Ebene",
- "Their photos and the keywords below them come together under one keyword.": "Ihre Fotos und die Stichwörter darunter kommen unter einem Stichwort zusammen."
+ "Their photos and the keywords below them come together under one keyword.": "Ihre Fotos und die Stichwörter darunter kommen unter einem Stichwort zusammen.",
+ "Select photos to give them keywords.": "Wählen Sie Fotos aus, um ihnen Stichwörter zu geben."
}
diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.json
index 814e0c796..c8cd8f87d 100644
--- a/crates/ui-egui/locales/es.json
+++ b/crates/ui-egui/locales/es.json
@@ -1755,5 +1755,6 @@
"Purge Unused Keywords": "Eliminar palabras clave no usadas",
"Delete Keyword…": "Eliminar palabra clave…",
"Drop here for the top level": "Soltar aquí para el nivel superior",
- "Their photos and the keywords below them come together under one keyword.": "Sus fotos y las palabras clave que contienen quedan bajo una sola palabra clave."
+ "Their photos and the keywords below them come together under one keyword.": "Sus fotos y las palabras clave que contienen quedan bajo una sola palabra clave.",
+ "Select photos to give them keywords.": "Selecciona fotos para darles palabras clave."
}
diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.json
index b073b3440..e8610ea0b 100644
--- a/crates/ui-egui/locales/ja.json
+++ b/crates/ui-egui/locales/ja.json
@@ -1755,5 +1755,6 @@
"Purge Unused Keywords": "使用されていないキーワードを削除",
"Delete Keyword…": "キーワードを削除…",
"Drop here for the top level": "ここにドロップすると最上位に移動",
- "Their photos and the keywords below them come together under one keyword.": "写真と下位のキーワードが1つのキーワードにまとめられます。"
+ "Their photos and the keywords below them come together under one keyword.": "写真と下位のキーワードが1つのキーワードにまとめられます。",
+ "Select photos to give them keywords.": "写真を選択するとキーワードを付けられます。"
}
diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.json
index 3e366b9ef..7dddca874 100644
--- a/crates/ui-egui/locales/pt-br.json
+++ b/crates/ui-egui/locales/pt-br.json
@@ -1755,5 +1755,6 @@
"Purge Unused Keywords": "Excluir palavras-chave não usadas",
"Delete Keyword…": "Excluir palavra-chave…",
"Drop here for the top level": "Solte aqui para o nível superior",
- "Their photos and the keywords below them come together under one keyword.": "Suas fotos e as palavras-chave abaixo delas ficam sob uma só palavra-chave."
+ "Their photos and the keywords below them come together under one keyword.": "Suas fotos e as palavras-chave abaixo delas ficam sob uma só palavra-chave.",
+ "Select photos to give them keywords.": "Selecione fotos para dar palavras-chave a elas."
}
diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json
index cd3bd4913..22ce2e160 100644
--- a/crates/ui-egui/locales/ru.json
+++ b/crates/ui-egui/locales/ru.json
@@ -1428,5 +1428,6 @@
"Purge Unused Keywords": "Удалить неиспользуемые ключевые слова",
"Delete Keyword…": "Удалить ключевое слово…",
"Drop here for the top level": "Отпустите здесь для верхнего уровня",
- "Their photos and the keywords below them come together under one keyword.": "Их фото и вложенные ключевые слова объединятся под одним ключевым словом."
+ "Their photos and the keywords below them come together under one keyword.": "Их фото и вложенные ключевые слова объединятся под одним ключевым словом.",
+ "Select photos to give them keywords.": "Выберите фото, чтобы назначить им ключевые слова."
}
diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.json
index b6e09076c..e73f6593c 100644
--- a/crates/ui-egui/locales/zh-hans.json
+++ b/crates/ui-egui/locales/zh-hans.json
@@ -1755,5 +1755,6 @@
"Purge Unused Keywords": "清除未使用的关键字",
"Delete Keyword…": "删除关键字…",
"Drop here for the top level": "拖放到此处以移至顶层",
- "Their photos and the keywords below them come together under one keyword.": "它们的照片和下级关键字将合并到同一个关键字下。"
+ "Their photos and the keywords below them come together under one keyword.": "它们的照片和下级关键字将合并到同一个关键字下。",
+ "Select photos to give them keywords.": "选择照片以为其添加关键字。"
}
diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.json
index af97aac45..886336abb 100644
--- a/crates/ui-egui/locales/zh-hant.json
+++ b/crates/ui-egui/locales/zh-hant.json
@@ -1755,5 +1755,6 @@
"Purge Unused Keywords": "清除未使用的關鍵字",
"Delete Keyword…": "刪除關鍵字…",
"Drop here for the top level": "拖放到此處以移至最上層",
- "Their photos and the keywords below them come together under one keyword.": "它們的照片與下層關鍵字將合併到同一個關鍵字下。"
+ "Their photos and the keywords below them come together under one keyword.": "它們的照片與下層關鍵字將合併到同一個關鍵字下。",
+ "Select photos to give them keywords.": "選取照片以加入關鍵字。"
}
diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs
index 9f2788a16..f8a817955 100644
--- a/crates/ui-egui/src/panels/right.rs
+++ b/crates/ui-egui/src/panels/right.rs
@@ -19,6 +19,18 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
let width = app.ui.right_width;
let resized = super::resizable_side(ui, false, "right_panel", frame, width, crate::state::RIGHT_WIDTH, reserve, |ui| {
let Some(id) = app.session.active() else {
+ // the Keyword List is the library's, not a photo's: it is there without a selection
+ if app.ui.right == RightPanel::Keywords {
+ egui::ScrollArea::vertical().id_salt("right-scroll").auto_shrink([false, false]).show(ui, |ui| {
+ ui.spacing_mut().item_spacing.y = 0.0;
+ header(ui, "Keywords");
+ padded(ui, |ui| {
+ ui.label(egui::RichText::new(crate::i18n::tr("Select photos to give them keywords.")).color(t.text_dim));
+ });
+ super::keyword_list::show(app, ui);
+ });
+ return;
+ }
let r = ui.max_rect();
super::empty_message(ui, r, "No photo selected", "Select a photo to edit");
return;
diff --git a/crates/ui-egui/src/tests_keyword_list.rs b/crates/ui-egui/src/tests_keyword_list.rs
index 9c840811d..17a62f37c 100644
--- a/crates/ui-egui/src/tests_keyword_list.rs
+++ b/crates/ui-egui/src/tests_keyword_list.rs
@@ -293,3 +293,16 @@ fn drops_land_only_on_what_is_shown() {
ask(&mut h, "ui.dragWidget", json!({"id": "keywordRow:aaa|zz", "toX": hidden.x, "toY": hidden.y, "steps": 12}));
assert_eq!(keywords_of(&h, ids[0]), ["aaa|zz"], "not moved to the top level");
}
+
+/// With no photo selected the Keyword List is still there, to create and organize keywords; its
+/// tick boxes wait for a selection.
+#[test]
+fn the_keyword_list_needs_no_selection() {
+ let (mut h, _) = keywords_panel();
+ run(&mut h, "library.select", json!({"ids": []}));
+ assert!(has(&h, "keywordList:topLevel") && has(&h, "keywordList:create"), "the list is shown");
+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordList:create"}));
+ ask(&mut h, "ui.text", json!({"text": "Weddings"}));
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(h.app.session.catalog.has_keyword("Weddings"), "and creates keywords");
+}