LR-BEHAV-DRAGDROP: drags say what a drop does, refuse what it can't, and Esc gives them up

Esc now gives up a photo drag, and while any drag lasts it does nothing else (no Back).
Album rows say how many photos a drop adds or that they're there already (a no-op
drop runs nothing); smart albums, album folders and the sidebar's Keywords rows refuse
photos with the not-allowed cursor and a reason. The Keyword List says how many photos
get a keyword (nothing to do when all have it) and refuses a keyword dropped inside itself.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Nathaniel Ledford
2026-10-17 19:22:36 -04:00
parent 8f638b33bd
commit c35efabd41
36 changed files with 638 additions and 67 deletions
+4 -1
View File
@@ -325,5 +325,8 @@
"View › Detail View ({keys}).": "Zobrazení › Zobrazení detailu ({keys}).",
"File › Export… · File › Print… ({keys}).": "Soubor › Exportovat… · Soubor › Tisk… ({keys}).",
"{n} folder{} could not be read": "Složky, které se nepodařilo přečíst: {n}{:.0}",
"{n} file{} skipped (not a supported photo type)": "Přeskočené soubory (nejde o podporovaný typ fotografie): {n}{:.0}"
"{n} file{} skipped (not a supported photo type)": "Přeskočené soubory (nejde o podporovaný typ fotografie): {n}{:.0}",
"Add {n} photo{} to “{}”": "Přidat do „{1}“ fotografie: {n}{0:.0}",
"{n} already there": "již tam je: {n}",
"Add “{keyword}” to {n} photo{}": "Přidat „{keyword}“ k fotografiím: {n}{:.0}"
}
+9 -1
View File
@@ -2472,5 +2472,13 @@
"Welcome": "Vítejte",
"Next": "Další",
"Get Started": "Začít",
"Stopped at the scan limit: there may be more photos": "Zastaveno na limitu skenování: je možné, že existují další fotografie"
"Stopped at the scan limit: there may be more photos": "Zastaveno na limitu skenování: je možné, že existují další fotografie",
"Can't add to an album folder": "Nelze přidat do složky alb",
"An album folder holds albums, not photos: drop on an album inside it": "Složka alb obsahuje alba, ne fotografie: pusťte je na album uvnitř",
"Can't add to a smart album": "Nelze přidat do inteligentního alba",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Fotografie inteligentního alba určují jeho pravidla: změníte je přes Upravit inteligentní album…",
"Add keywords in the Keyword List": "Klíčová slova přidávejte v Seznamu klíčových slov",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "Klíčové slovo fotografiím přidáte v Seznamu klíčových slov (Okno → Klíčová slova, K): pusťte je tam na klíčové slovo",
"Already on these photos": "Už je mají",
"Can't go inside itself": "Nemůže jít samo do sebe"
}
+4 -1
View File
@@ -326,5 +326,8 @@
"{name} is installed and in use: face recognition is on": "{name} ist installiert und in Gebrauch: Gesichtserkennung ist eingeschaltet",
"Bring photos in with File › Import Photos… ({keys}).": "Fotos holen Sie mit Datei › Fotos importieren… ({keys}) in die Bibliothek.",
"View › Detail View ({keys}).": "Ansicht › Detailansicht ({keys}).",
"File › Export… · File › Print… ({keys}).": "Datei › Exportieren… · Datei › Drucken… ({keys})."
"File › Export… · File › Print… ({keys}).": "Datei › Exportieren… · Datei › Drucken… ({keys}).",
"Add {n} photo{} to “{}”": "{n} Foto{0} zu „{1}“ hinzufügen",
"{n} already there": "{n} bereits enthalten",
"Add “{keyword}” to {n} photo{}": "„{keyword}“ zu {n} Foto{} hinzufügen"
}
+9 -1
View File
@@ -3507,5 +3507,13 @@
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Starten Sie die App mit --control 7980 (oder LIGHTCRAFT_CONTROL_PORT), dann verbindet lightcraft-cli mcp --connect einen Agenten mit ihr.",
"Welcome": "Willkommen",
"Next": "Weiter",
"Get Started": "Loslegen"
"Get Started": "Loslegen",
"Can't add to an album folder": "Nicht zu einem Albenordner hinzufügbar",
"An album folder holds albums, not photos: drop on an album inside it": "Ein Albenordner enthält Alben, keine Fotos: auf ein Album darin ablegen",
"Can't add to a smart album": "Nicht zu einem Smart-Album hinzufügbar",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Die Regeln eines Smart-Albums bestimmen seine Fotos: ändere sie mit Smart-Album bearbeiten…",
"Add keywords in the Keyword List": "Stichwörter in der Stichwortliste hinzufügen",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "Stichwörter vergibst du in der Stichwortliste (Fenster → Stichwörter, K): Fotos dort auf ein Stichwort ziehen",
"Already on these photos": "Bereits bei diesen Fotos",
"Can't go inside itself": "Kann nicht in sich selbst liegen"
}
+4 -1
View File
@@ -326,5 +326,8 @@
"{name} is installed and in use: face recognition is on": "{name} está instalado y en uso: el reconocimiento facial está activado",
"Bring photos in with File › Import Photos… ({keys}).": "Importa fotos con Archivo › Importar fotos… ({keys}).",
"View › Detail View ({keys}).": "Vista › Vista de detalle ({keys}).",
"File › Export… · File › Print… ({keys}).": "Archivo › Exportar… · Archivo › Imprimir… ({keys})."
"File › Export… · File › Print… ({keys}).": "Archivo › Exportar… · Archivo › Imprimir… ({keys}).",
"Add {n} photo{} to “{}”": "Añadir {n} foto{0} a “{1}”",
"{n} already there": "{n} ya estaban",
"Add “{keyword}” to {n} photo{}": "Añadir “{keyword}” a {n} foto{}"
}
+9 -1
View File
@@ -2426,5 +2426,13 @@
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Inicia la aplicación con --control 7980 (o LIGHTCRAFT_CONTROL_PORT), y lightcraft-cli mcp --connect conecta un agente a ella.",
"Welcome": "Bienvenido",
"Next": "Siguiente",
"Get Started": "Empezar"
"Get Started": "Empezar",
"Can't add to an album folder": "No se puede añadir a una carpeta de álbumes",
"An album folder holds albums, not photos: drop on an album inside it": "Una carpeta de álbumes contiene álbumes, no fotos: suéltalas en un álbum de dentro",
"Can't add to a smart album": "No se puede añadir a un álbum inteligente",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Las reglas de un álbum inteligente eligen sus fotos: cámbialas con Editar álbum inteligente…",
"Add keywords in the Keyword List": "Añade palabras clave en la Lista de palabras clave",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "Para dar una palabra clave a las fotos, usa la Lista de palabras clave (Ventana → Palabras clave, K): suéltalas allí sobre ella",
"Already on these photos": "Ya las tienen estas fotos",
"Can't go inside itself": "No puede ir dentro de sí misma"
}
+4 -1
View File
@@ -326,5 +326,8 @@
"{name} is installed and in use: face recognition is on": "{name} est installé et utilisé : la reconnaissance des visages est activée",
"Bring photos in with File › Import Photos… ({keys}).": "Importez des photos avec Fichier › Importer des photos… ({keys}).",
"View › Detail View ({keys}).": "Affichage › Vue de détail ({keys}).",
"File › Export… · File › Print… ({keys}).": "Fichier › Exporter… · Fichier › Imprimer… ({keys})."
"File › Export… · File › Print… ({keys}).": "Fichier › Exporter… · Fichier › Imprimer… ({keys}).",
"Add {n} photo{} to “{}”": "Ajouter {n} photo{} à « {} »",
"{n} already there": "{n} déjà présent(s)",
"Add “{keyword}” to {n} photo{}": "Ajouter « {keyword} » à {n} photo{}"
}
+9 -1
View File
@@ -3609,5 +3609,13 @@
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Démarrez l'application avec --control 7980 (ou LIGHTCRAFT_CONTROL_PORT), puis lightcraft-cli mcp --connect y connecte un agent.",
"Welcome": "Bienvenue",
"Next": "Suivant",
"Get Started": "Commencer"
"Get Started": "Commencer",
"Can't add to an album folder": "Impossible d’ajouter à un dossier d’albums",
"An album folder holds albums, not photos: drop on an album inside it": "Un dossier d’albums contient des albums, pas des photos : déposez-les sur un album à l’intérieur",
"Can't add to a smart album": "Impossible d’ajouter à un album intelligent",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Les règles d’un album intelligent choisissent ses photos : modifiez-les avec Modifier l'album intelligent…",
"Add keywords in the Keyword List": "Ajoutez des mots-clés dans la Liste des mots-clés",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "Pour donner un mot-clé à des photos, utilisez la Liste des mots-clés (Fenêtre → Mots-clés, K) : déposez-les sur le mot-clé",
"Already on these photos": "Déjà sur ces photos",
"Can't go inside itself": "Ne peut pas aller dans lui-même"
}
+4 -1
View File
@@ -325,5 +325,8 @@
"View › Detail View ({keys}).": "Visualizza › Vista dettaglio ({keys}).",
"File › Export… · File › Print… ({keys}).": "File › Esporta… · File › Stampa… ({keys}).",
"{n} folder{} could not be read": "Cartelle non leggibili: {n}{:.0}",
"{n} file{} skipped (not a supported photo type)": "File saltati (non è un tipo di foto supportato): {n}{:.0}"
"{n} file{} skipped (not a supported photo type)": "File saltati (non è un tipo di foto supportato): {n}{:.0}",
"Add {n} photo{} to “{}”": "Aggiungi {n} foto{0:.0} a “{1}”",
"{n} already there": "{n} già presenti",
"Add “{keyword}” to {n} photo{}": "Aggiungi “{keyword}” a {n} foto{:.0}"
}
+9 -1
View File
@@ -2590,5 +2590,13 @@
"Welcome": "Benvenuto",
"Next": "Avanti",
"Get Started": "Inizia",
"Stopped at the scan limit: there may be more photos": "Fermati al limite di scansione: potrebbero esserci altre foto"
"Stopped at the scan limit: there may be more photos": "Fermati al limite di scansione: potrebbero esserci altre foto",
"Can't add to an album folder": "Impossibile aggiungere a una cartella di album",
"An album folder holds albums, not photos: drop on an album inside it": "Una cartella di album contiene album, non foto: rilascia su un album al suo interno",
"Can't add to a smart album": "Impossibile aggiungere a un album smart",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Le regole di un album smart scelgono le sue foto: cambiale con Modifica album smart…",
"Add keywords in the Keyword List": "Aggiungi le parole chiave nell'Elenco parole chiave",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "Per dare una parola chiave alle foto usa l'Elenco parole chiave (Finestra → Parole chiave, K): rilasciale lì sulla parola chiave",
"Already on these photos": "Già presente su queste foto",
"Can't go inside itself": "Non può andare dentro se stessa"
}
+4 -1
View File
@@ -326,5 +326,8 @@
"{name} is installed and in use: face recognition is on": "{name} をインストールして使用中です:顔認識はオンです",
"Bring photos in with File › Import Photos… ({keys}).": "ファイル › 写真を読み込む… ({keys}) で写真を読み込みます。",
"View › Detail View ({keys}).": "表示 › 詳細表示 ({keys})。",
"File › Export… · File › Print… ({keys}).": "ファイル › 書き出す… · ファイル › 印刷… ({keys})。"
"File › Export… · File › Print… ({keys}).": "ファイル › 書き出す… · ファイル › 印刷… ({keys})。",
"Add {n} photo{} to “{}”": "{n}枚を「{1}」に追加{0:.0}",
"{n} already there": "{n}枚は追加済み",
"Add “{keyword}” to {n} photo{}": "写真{n}枚に「{keyword}」を追加{:.0}"
}
+9 -1
View File
@@ -2424,5 +2424,13 @@
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "アプリを --control 7980 (または LIGHTCRAFT_CONTROL_PORT) で起動してから、lightcraft-cli mcp --connect でエージェントを接続できます。",
"Welcome": "ようこそ",
"Next": "次へ",
"Get Started": "始める"
"Get Started": "始める",
"Can't add to an album folder": "アルバムフォルダには追加できません",
"An album folder holds albums, not photos: drop on an album inside it": "アルバムフォルダに入れられるのはアルバムだけです:中のアルバムにドロップしてください",
"Can't add to a smart album": "スマートアルバムには追加できません",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "スマートアルバムの写真はルールで決まります:「スマートアルバムを編集…」で変更してください",
"Add keywords in the Keyword List": "キーワードはキーワードリストで追加します",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "写真にキーワードを付けるには、キーワードリスト(ウィンドウ → キーワード、K)で、そのキーワードにドロップしてください",
"Already on these photos": "すでにこの写真にあります",
"Can't go inside itself": "自分の中には入れられません"
}
+4 -1
View File
@@ -328,5 +328,8 @@
"View › Detail View ({keys}).": "ხედი › დეტალური ხედი ({keys}).",
"File › Export… · File › Print… ({keys}).": "ფაილი › ექსპორტი… · ფაილი › დაბეჭდვა… ({keys}).",
"{n} folder{} could not be read": "საქაღალდეები, რომლებიც ვერ წაიკითხა: {n}{:.0}",
"{n} file{} skipped (not a supported photo type)": "გამოტოვებული ფაილები (მხარდაუჭერელი ფოტოს ტიპია): {n}{:.0}"
"{n} file{} skipped (not a supported photo type)": "გამოტოვებული ფაილები (მხარდაუჭერელი ფოტოს ტიპია): {n}{:.0}",
"Add {n} photo{} to “{}”": "დაამატეთ ფოტო „{1}“-ში: {n}{0:.0}",
"{n} already there": "{n} უკვე არის",
"Add “{keyword}” to {n} photo{}": "დაამატეთ „{keyword}“ ფოტოებს: {n}{:.0}"
}
+9 -1
View File
@@ -3692,5 +3692,13 @@
"Tool strip": "ხელსაწყოების ზოლი",
"Bottom bar": "ქვედა ზოლი",
"Prevent G-SYNC/FreeSync flicker (applies at next launch)": "G-SYNC/FreeSync-ის ციმციმის თავიდან აცილება (ამოქმედდება შემდეგი გაშვებისას)",
"Stopped at the scan limit: there may be more photos": "სკანირების ლიმიტზე გაჩერდა: შესაძლოა სხვა ფოტოებიც არის"
"Stopped at the scan limit: there may be more photos": "სკანირების ლიმიტზე გაჩერდა: შესაძლოა სხვა ფოტოებიც არის",
"Can't add to an album folder": "ალბომების საქაღალდეში დამატება შეუძლებელია",
"An album folder holds albums, not photos: drop on an album inside it": "ალბომების საქაღალდეში ალბომებია, არა ფოტოები: ჩააგდეთ მასში არსებულ ალბომზე",
"Can't add to a smart album": "სმარტ-ალბომში დამატება შეუძლებელია",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "სმარტ-ალბომის ფოტოებს მისი წესები ირჩევს: შეცვალეთ „სმარტ-ალბომის რედაქტირება…“-ით",
"Add keywords in the Keyword List": "საკვანძო სიტყვები დაამატეთ საკვანძო სიტყვების სიაში",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "ფოტოებისთვის საკვანძო სიტყვის მისაცემად გამოიყენეთ საკვანძო სიტყვების სია (ფანჯარა → საკვანძო სიტყვები, K): ჩააგდეთ იქ სასურველ სიტყვაზე",
"Already on these photos": "ამ ფოტოებს უკვე აქვთ",
"Can't go inside itself": "საკუთარ თავში ვერ მოხვდება"
}
+4 -1
View File
@@ -325,5 +325,8 @@
"View › Detail View ({keys}).": "Widok › Widok szczegółów ({keys}).",
"File › Export… · File › Print… ({keys}).": "Plik › Eksportuj… · Plik › Drukuj… ({keys}).",
"{n} folder{} could not be read": "Nie udało się odczytać folderów: {n}{:.0}",
"{n} file{} skipped (not a supported photo type)": "Pominięte pliki (nieobsługiwany typ zdjęcia): {n}{:.0}"
"{n} file{} skipped (not a supported photo type)": "Pominięte pliki (nieobsługiwany typ zdjęcia): {n}{:.0}",
"Add {n} photo{} to “{}”": "Dodaj do „{1}” — zdjęcia: {n}{0:.0}",
"{n} already there": "{n} już tam jest",
"Add “{keyword}” to {n} photo{}": "Dodaj „{keyword}” do zdjęć: {n}{:.0}"
}
+9 -1
View File
@@ -2348,5 +2348,13 @@
"Welcome": "Witamy",
"Next": "Dalej",
"Get Started": "Zaczynamy",
"Stopped at the scan limit: there may be more photos": "Zatrzymano na limicie skanowania: możliwe, że jest więcej zdjęć"
"Stopped at the scan limit: there may be more photos": "Zatrzymano na limicie skanowania: możliwe, że jest więcej zdjęć",
"Can't add to an album folder": "Nie można dodać do folderu albumów",
"An album folder holds albums, not photos: drop on an album inside it": "Folder albumów zawiera albumy, nie zdjęcia: upuść na album w jego wnętrzu",
"Can't add to a smart album": "Nie można dodać do albumu inteligentnego",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Zdjęcia albumu inteligentnego wybierają jego reguły: zmienisz je przez Edytuj album inteligentny…",
"Add keywords in the Keyword List": "Dodawaj słowa kluczowe na Liście słów kluczowych",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "Aby nadać zdjęciom słowo kluczowe, użyj Listy słów kluczowych (Okno → Słowa kluczowe, K): upuść je tam na to słowo",
"Already on these photos": "Już mają je te zdjęcia",
"Can't go inside itself": "Nie może trafić do siebie samego"
}
+4 -1
View File
@@ -326,5 +326,8 @@
"{name} is installed and in use: face recognition is on": "{name} está instalado e em uso: o reconhecimento facial está ativado",
"Bring photos in with File › Import Photos… ({keys}).": "Traga fotos com Arquivo › Importar fotos… ({keys}).",
"View › Detail View ({keys}).": "Exibir › Exibição de detalhe ({keys}).",
"File › Export… · File › Print… ({keys}).": "Arquivo › Exportar… · Arquivo › Imprimir… ({keys})."
"File › Export… · File › Print… ({keys}).": "Arquivo › Exportar… · Arquivo › Imprimir… ({keys}).",
"Add {n} photo{} to “{}”": "Adicionar {n} foto{0} a “{1}”",
"{n} already there": "{n} já estavam lá",
"Add “{keyword}” to {n} photo{}": "Adicionar “{keyword}” a {n} foto{}"
}
+9 -1
View File
@@ -2270,5 +2270,13 @@
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Inicie o aplicativo com --control 7980 (ou LIGHTCRAFT_CONTROL_PORT) e o lightcraft-cli mcp --connect conecta um agente a ele.",
"Welcome": "Bem-vindo",
"Next": "Próximo",
"Get Started": "Começar"
"Get Started": "Começar",
"Can't add to an album folder": "Não é possível adicionar a uma pasta de álbuns",
"An album folder holds albums, not photos: drop on an album inside it": "Uma pasta de álbuns contém álbuns, não fotos: solte em um álbum dentro dela",
"Can't add to a smart album": "Não é possível adicionar a um álbum inteligente",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "As regras de um álbum inteligente escolhem suas fotos: altere-as com Editar álbum inteligente…",
"Add keywords in the Keyword List": "Adicione palavras-chave na Lista de palavras-chave",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "Para dar uma palavra-chave às fotos, use a Lista de palavras-chave (Janela → Palavras-chave, K): solte-as lá sobre ela",
"Already on these photos": "Já estão nestas fotos",
"Can't go inside itself": "Não pode ficar dentro de si mesma"
}
+4 -1
View File
@@ -326,5 +326,8 @@
"{name} is installed and in use: face recognition is on": "Модель {name} установлена и используется: распознавание лиц включено",
"Bring photos in with File › Import Photos… ({keys}).": "Фотографии добавляются через Файл › Импорт фото… ({keys}).",
"View › Detail View ({keys}).": "Вид › Режим детализации ({keys}).",
"File › Export… · File › Print… ({keys}).": "Файл › Экспорт… · Файл › Печать… ({keys})."
"File › Export… · File › Print… ({keys}).": "Файл › Экспорт… · Файл › Печать… ({keys}).",
"Add {n} photo{} to “{}”": "Добавить в «{1}» фото: {n}{0:.0}",
"{n} already there": "{n} уже там",
"Add “{keyword}” to {n} photo{}": "Добавить «{keyword}» к фото: {n}{:.0}"
}
+9 -1
View File
@@ -2632,5 +2632,13 @@
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Запустите приложение с --control 7980 (или LIGHTCRAFT_CONTROL_PORT), и команда lightcraft-cli mcp --connect подключит к нему одного агента.",
"Welcome": "Добро пожаловать",
"Next": "Далее",
"Get Started": "Начать"
"Get Started": "Начать",
"Can't add to an album folder": "Нельзя добавить в папку альбомов",
"An album folder holds albums, not photos: drop on an album inside it": "В папке альбомов лежат альбомы, а не фото: бросьте на альбом внутри неё",
"Can't add to a smart album": "Нельзя добавить в смарт-альбом",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Фото смарт-альбома выбирают его правила: измените их через «Изменить смарт-альбом…»",
"Add keywords in the Keyword List": "Добавляйте ключевые слова в списке ключевых слов",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "Чтобы задать фото ключевое слово, используйте список ключевых слов (Окно → Ключевые слова, K): бросьте фото там на нужное слово",
"Already on these photos": "Уже есть у этих фото",
"Can't go inside itself": "Нельзя поместить внутрь себя"
}
+4 -1
View File
@@ -326,5 +326,8 @@
"{name} is installed and in use: face recognition is on": "{name} установлено й використовується: розпізнавання облич увімкнено",
"Bring photos in with File › Import Photos… ({keys}).": "Фотографії імпортуйте через Файл › Імпортувати фото… ({keys}).",
"View › Detail View ({keys}).": "Вигляд › Детальне подання ({keys}).",
"File › Export… · File › Print… ({keys}).": "Файл › Експортувати… · Файл › Друк… ({keys})."
"File › Export… · File › Print… ({keys}).": "Файл › Експортувати… · Файл › Друк… ({keys}).",
"Add {n} photo{} to “{}”": "Додати до «{1}» фото: {n}{0:.0}",
"{n} already there": "{n} уже там",
"Add “{keyword}” to {n} photo{}": "Додати «{keyword}» до фото: {n}{:.0}"
}
+9 -1
View File
@@ -2422,5 +2422,13 @@
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Запустіть програму з --control 7980 (або LIGHTCRAFT_CONTROL_PORT), і lightcraft-cli mcp --connect під'єднає до неї одного агента.",
"Welcome": "Ласкаво просимо",
"Next": "Далі",
"Get Started": "Почати"
"Get Started": "Почати",
"Can't add to an album folder": "Не можна додати до теки альбомів",
"An album folder holds albums, not photos: drop on an album inside it": "У теці альбомів лежать альбоми, а не фото: киньте на альбом усередині неї",
"Can't add to a smart album": "Не можна додати до смарт-альбому",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "Фото смарт-альбому вибирають його правила: змініть їх через «Редагувати смарт-альбом…»",
"Add keywords in the Keyword List": "Додавайте ключові слова у списку ключових слів",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "Щоб задати фото ключове слово, скористайтеся списком ключових слів (Вікно → Ключові слова, K): киньте фото там на потрібне слово",
"Already on these photos": "Уже є в цих фото",
"Can't go inside itself": "Не можна помістити всередину себе"
}
+4 -1
View File
@@ -326,5 +326,8 @@
"{name} is installed and in use: face recognition is on": "{name} 已安装并在使用:人脸识别已开启",
"Bring photos in with File › Import Photos… ({keys}).": "通过 文件 › 导入照片… ({keys}) 导入照片。",
"View › Detail View ({keys}).": "视图 › 详细视图 ({keys})。",
"File › Export… · File › Print… ({keys}).": "文件 › 导出… · 文件 › 打印… ({keys})。"
"File › Export… · File › Print… ({keys}).": "文件 › 导出… · 文件 › 打印… ({keys})。",
"Add {n} photo{} to “{}”": "将 {n} 张照片添加到“{1}”{0:.0}",
"{n} already there": "{n} 张已在其中",
"Add “{keyword}” to {n} photo{}": "将“{keyword}”添加到 {n} 张照片{:.0}"
}
+9 -1
View File
@@ -2425,5 +2425,13 @@
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "先以 --control 7980 (或 LIGHTCRAFT_CONTROL_PORT) 启动应用,lightcraft-cli mcp --connect 即可将一个智能体接入其中。",
"Welcome": "欢迎",
"Next": "下一步",
"Get Started": "开始使用"
"Get Started": "开始使用",
"Can't add to an album folder": "无法添加到相册文件夹",
"An album folder holds albums, not photos: drop on an album inside it": "相册文件夹里放的是相册,不是照片:请拖到其中的某个相册上",
"Can't add to a smart album": "无法添加到智能相册",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "智能相册的照片由其规则决定:请用“编辑智能相册…”更改规则",
"Add keywords in the Keyword List": "请在关键字列表中添加关键字",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "要给照片添加关键字,请使用关键字列表(窗口 → 关键字,K),把照片拖到那里的关键字上",
"Already on these photos": "这些照片已有",
"Can't go inside itself": "不能放入自身"
}
+4 -1
View File
@@ -326,5 +326,8 @@
"{name} is installed and in use: face recognition is on": "{name} 已安裝並在使用中:臉部辨識已開啟",
"Bring photos in with File › Import Photos… ({keys}).": "透過 檔案 › 匯入照片… ({keys}) 匯入照片。",
"View › Detail View ({keys}).": "檢視 › 詳細檢視 ({keys})。",
"File › Export… · File › Print… ({keys}).": "檔案 › 匯出… · 檔案 › 列印… ({keys})。"
"File › Export… · File › Print… ({keys}).": "檔案 › 匯出… · 檔案 › 列印… ({keys})。",
"Add {n} photo{} to “{}”": "將 {n} 張照片加入「{1}」{0:.0}",
"{n} already there": "{n} 張已在其中",
"Add “{keyword}” to {n} photo{}": "將「{keyword}」加入 {n} 張照片{:.0}"
}
+9 -1
View File
@@ -2426,5 +2426,13 @@
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "先以 --control 7980 (或 LIGHTCRAFT_CONTROL_PORT) 啟動應用程式,lightcraft-cli mcp --connect 即可將一個代理程式連接到其中。",
"Welcome": "歡迎",
"Next": "下一步",
"Get Started": "開始使用"
"Get Started": "開始使用",
"Can't add to an album folder": "無法加入相簿資料夾",
"An album folder holds albums, not photos: drop on an album inside it": "相簿資料夾裡放的是相簿,不是照片:請拖到其中的某個相簿上",
"Can't add to a smart album": "無法加入智慧型相簿",
"A smart album's rules choose its photos: change them with Edit Smart Album…": "智慧型相簿的照片由其規則決定:請用「編輯智慧型相簿…」變更規則",
"Add keywords in the Keyword List": "請在關鍵字清單中加入關鍵字",
"Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there": "要替照片加入關鍵字,請使用關鍵字清單(視窗 → 關鍵字,K),把照片拖到那裡的關鍵字上",
"Already on these photos": "這些照片已有",
"Can't go inside itself": "不能放入自身"
}
+22 -3
View File
@@ -1147,17 +1147,36 @@ pub fn drag_hint(ctx: &egui::Context, text: String) {
ctx.data_mut(|d| d.insert_temp(egui::Id::unique("drag-photos-hint"), (frame, text)));
}
/// What a drop target that refuses the dragged photos does: the label says so, the cursor shows
/// it, and a release there toasts `why` and ends the drag, changing nothing.
pub fn refuse_drop(app: &mut LightcraftApp, ctx: &egui::Context, hint: String, why: &str, released: bool) {
drag_hint(ctx, hint);
ctx.set_cursor_icon(egui::CursorIcon::NotAllowed);
if released {
app.toast(ctx, why);
app.ui.dragging_photos = None;
}
}
pub fn drag_feedback(app: &mut LightcraftApp, ctx: &egui::Context) {
let Some(ids) = &app.ui.dragging_photos else { return };
let (released, down, pos) = ctx.input(|i| (i.pointer.primary_released(), i.pointer.primary_down(), i.pointer.latest_pos()));
if released || !down {
let (released, down, pos, esc) =
ctx.input(|i| (i.pointer.primary_released(), i.pointer.primary_down(), i.pointer.latest_pos(), i.key_pressed(egui::Key::Escape)));
if released || !down || esc {
if esc {
// the drag's Esc, not also a dialog's or a view's
crate::widgets::take_escape(ctx);
}
app.ui.dragging_photos = None;
return;
}
let Some(pos) = pos else { return };
let t = Tokens::get(ctx);
let n = ids.len();
ctx.set_cursor_icon(egui::CursorIcon::Grabbing);
// (a row that refuses them has set the not-allowed cursor this frame: it stays)
if ctx.output(|o| o.cursor_icon) != egui::CursorIcon::NotAllowed {
ctx.set_cursor_icon(egui::CursorIcon::Grabbing);
}
// a drop target under the pointer says where they would go (only this frame's)
let frame = ctx.cumulative_frame_nr();
let hint = ctx.data(|d| d.get_temp::<(u64, String)>(egui::Id::unique("drag-photos-hint"))).filter(|(f, _)| *f == frame).map(|(_, text)| text);
+56 -24
View File
@@ -115,6 +115,9 @@ fn shown_under(ui: &egui::Ui, rect: Rect, pointer: Option<egui::Pos2>) -> bool {
crate::docking::drop_target(ui, rect, pointer)
}
/// What the dragged keyword's label says this frame instead of its name (a row refusing it sets it).
const KEYWORD_HINT: &str = "drag-keyword-hint";
/// A keyword being dragged, each frame (after the panels, which take the drop): its name follows
/// the pointer, and the drag ends with the button's release wherever it is (the list may be gone
/// by then) or with Esc.
@@ -123,13 +126,22 @@ pub fn drag_feedback(app: &mut LightcraftApp, ctx: &egui::Context) {
let (released, down, at, esc) =
ctx.input(|i| (i.pointer.any_released(), i.pointer.any_down(), i.pointer.latest_pos(), i.key_pressed(egui::Key::Escape)));
if released || !down || esc {
if esc {
// the drag's Esc, not also a dialog's or a view's
crate::widgets::take_escape(ctx);
}
app.ui.dragging_keyword = None;
return;
}
let Some(at) = at else { return };
let t = Tokens::get(ctx);
ctx.set_cursor_icon(egui::CursorIcon::Grabbing);
let name = keyword.rsplit('|').next().unwrap_or(&keyword).to_string();
// (a row that refuses it has set the not-allowed cursor this frame: it stays)
if ctx.output(|o| o.cursor_icon) != egui::CursorIcon::NotAllowed {
ctx.set_cursor_icon(egui::CursorIcon::Grabbing);
}
let frame = ctx.cumulative_frame_nr();
let hint = ctx.data(|d| d.get_temp::<(u64, String)>(egui::Id::unique(KEYWORD_HINT))).filter(|(f, _)| *f == frame).map(|(_, text)| text);
let name = hint.unwrap_or_else(|| keyword.rsplit('|').next().unwrap_or(&keyword).to_string());
egui::Area::new(egui::Id::unique("drag-keyword")).order(egui::Order::Tooltip).interactable(false).fixed_pos(at + vec2(14.0, 10.0)).show(
ctx,
|ui| {
@@ -326,9 +338,16 @@ fn drop_target(app: &mut LightcraftApp, ui: &mut egui::Ui, rect: Rect, path: &st
return;
}
let t = Tokens::get(ui.ctx());
let outline = |ui: &egui::Ui| ui.painter().rect_stroke(rect.shrink2(vec2(16.0, 1.0)), 4.0, Stroke::new(1.5, t.accent), StrokeKind::Inside);
let outline = |ui: &egui::Ui| {
ui.painter().rect_stroke(rect.shrink2(vec2(16.0, 1.0)), 4.0, Stroke::new(1.5, t.accent), StrokeKind::Inside);
};
if let Some(k) = app.ui.dragging_keyword.clone() {
if lightcraft_catalog::keywords::is_under(path, &k) {
// never inside itself or what is inside it: the not-allowed cursor, and the dragged
// label says why; a release does nothing
ui.ctx().set_cursor_icon(egui::CursorIcon::NotAllowed);
let frame = ui.ctx().cumulative_frame_nr();
ui.data_mut(|d| d.insert_temp(egui::Id::unique(KEYWORD_HINT), (frame, crate::i18n::tr("Can't go inside itself").to_string())));
return;
}
outline(ui);
@@ -336,30 +355,43 @@ fn drop_target(app: &mut LightcraftApp, ui: &mut egui::Ui, rect: Rect, path: &st
drop_keyword(app, ui.ctx(), &k, Some(path));
}
} else if let Some(ids) = app.ui.dragging_photos.clone() {
outline(ui);
drop_photos_on_keyword(app, ui, &ids, path, &outline);
}
}
/// Photos dragged over the keyword row `path`: only the photos that don't have it get it. `outline`
/// marks the row when a release would give it to some.
fn drop_photos_on_keyword(app: &mut LightcraftApp, ui: &mut egui::Ui, ids: &[u64], path: &str, outline: &dyn Fn(&egui::Ui)) {
let released = ui.input(|i| i.pointer.any_released());
let lacking = |id: &u64| {
app.session.catalog.photo(PhotoId(*id)).is_some_and(|p| !p.meta.keywords.iter().any(|k| same(&lightcraft_catalog::keywords::clean(k), path)))
};
let n = ids.iter().filter(|id| lacking(id)).count();
if n == 0 {
super::grid::drag_hint(ui.ctx(), crate::i18n::tr("Already on these photos").to_string());
if released {
// only the photos that didn't have it get it
let lacking = |id: &u64| {
app.session
.catalog
.photo(PhotoId(*id))
.is_some_and(|p| !p.meta.keywords.iter().any(|k| same(&lightcraft_catalog::keywords::clean(k), path)))
};
let n = ids.iter().filter(|id| lacking(id)).count();
app.ui.dragging_photos = None;
match app.run("photo.setMeta", json!({"ids": ids, "addKeywords": [path]})) {
Ok(_) => app.toast(
ui.ctx(),
crate::i18n::tr_format!(
"Added “{keyword}” to {n} photo{}",
if n == 1 { "" } else { "s" },
keyword = path.replace('|', " › "),
n = n
),
),
Err(e) => app.toast(ui.ctx(), e),
}
}
return;
}
let keyword = path.replace('|', " › ");
super::grid::drag_hint(
ui.ctx(),
crate::i18n::tr_format!("Add “{keyword}” to {n} photo{}", if n == 1 { "" } else { "s" }, keyword = keyword, n = n),
);
outline(ui);
if released {
app.ui.dragging_photos = None;
give_keyword(app, ui.ctx(), ids, path, n);
}
}
/// Gives the keyword `path` to the dragged photos and toasts how many (`n`) lacked it.
fn give_keyword(app: &mut LightcraftApp, ctx: &egui::Context, ids: &[u64], path: &str, n: usize) {
let keyword = path.replace('|', " › ");
match app.run("photo.setMeta", json!({"ids": ids, "addKeywords": [path]})) {
Ok(_) => app.toast(ctx, crate::i18n::tr_format!("Added “{keyword}” to {n} photo{}", if n == 1 { "" } else { "s" }, keyword = keyword, n = n)),
Err(e) => app.toast(ctx, e),
}
}
+76 -10
View File
@@ -43,6 +43,13 @@ fn albums_tree(app: &mut LightcraftApp, ui: &mut egui::Ui, all: &AlbumKids, pare
if album_drag_over(app, ui, &resp, a, has_children.then_some(&mut open), indent) {
set_tree_open(ui, open_id, true);
}
refuse_photos(
app,
ui,
&resp,
crate::i18n::tr("Can't add to an album folder"),
crate::i18n::tr("An album folder holds albums, not photos: drop on an album inside it"),
);
// what this frame draws; a click shows from the next one
let draw_open = open;
let mut toggled = false;
@@ -86,7 +93,15 @@ fn albums_tree(app: &mut LightcraftApp, ui: &mut egui::Ui, all: &AlbumKids, pare
app.ui.dragging_album = Some(a.id.0);
}
album_drag_over(app, ui, &resp, a, None, indent);
if !a.is_smart() {
if a.is_smart() {
refuse_photos(
app,
ui,
&resp,
crate::i18n::tr("Can't add to a smart album"),
crate::i18n::tr("A smart album's rules choose its photos: change them with Edit Smart Album…"),
);
} else {
drop_target(app, ui, &resp, a);
}
if let Some(rules) = &a.smart {
@@ -373,8 +388,45 @@ pub fn album_drag_feedback(app: &mut LightcraftApp, ctx: &egui::Context) {
);
}
/// An album row while photos are dragged from the grid: highlighted under the pointer; a
/// release there adds them.
/// A row that can't hold photos, while photos are dragged from the grid: the not-allowed cursor
/// and a label saying so (`hint`); a release there says why (`why`) and changes nothing.
pub(super) fn refuse_photos(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, hint: &str, why: &str) {
if app.ui.dragging_photos.is_none() || !pointer_over_row(ui, resp.rect) {
return;
}
let released = ui.input(|i| i.pointer.any_released());
crate::panels::grid::refuse_drop(app, ui.ctx(), hint.to_string(), why, released);
}
/// How many of the dragged photos are library photos, and how many of those the album holds already.
fn dragged_and_there(app: &LightcraftApp, a: &Album, ids: &[u64]) -> (usize, usize) {
let library = ids.iter().filter(|id| app.session.catalog.photo(lightcraft_catalog::PhotoId(**id)).is_some_and(|p| !p.local)).count();
let dragged: std::collections::HashSet<u64> = ids.iter().copied().collect();
(library, a.photos.iter().filter(|p| dragged.contains(&p.0)).count().min(library))
}
/// A drop on album `a` that would add nothing: `local` Local photos in the drag aren't in the album
/// either, so a release says why they stay out; else the library photos are all there already, and a
/// release only ends the drag.
fn drop_adds_nothing(app: &mut LightcraftApp, ui: &egui::Ui, a: &Album, local: usize, released: bool) {
if local > 0 {
let why = crate::i18n::tr_format!(
"{n} Local photo{} skipped: albums hold library photos (Add to My Photos first)",
if local == 1 { "" } else { "s" },
n = local
);
crate::panels::grid::refuse_drop(app, ui.ctx(), crate::panels::grid::albums_hint(), &why, released);
return;
}
crate::panels::grid::drag_hint(ui.ctx(), crate::i18n::tr_format!("Already in “{}”", a.name));
if released {
app.ui.dragging_photos = None;
}
}
/// An album row while photos are dragged from the grid: highlighted under the pointer, the dragged
/// label saying how many photos a release there adds (the ones the album doesn't hold yet). When it
/// holds them all it says so, and a release does nothing.
fn drop_target(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, a: &Album) {
let Some(ids) = app.ui.dragging_photos.clone() else { return };
// only where the row can be seen: not scrolled out of the sidebar or beneath the pinned header
@@ -387,37 +439,51 @@ fn drop_target(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response
// light up, and a release says why
let photos: Vec<lightcraft_catalog::PhotoId> = ids.iter().map(|id| lightcraft_catalog::PhotoId(*id)).collect();
if crate::panels::grid::local_only(app, &photos) {
ui.ctx().set_cursor_icon(egui::CursorIcon::NotAllowed);
crate::panels::grid::refuse_drop(app, ui.ctx(), crate::panels::grid::albums_hint(), &crate::panels::grid::albums_hint(), released);
return;
}
// of the library photos dragged, the album holds some already
let (library, there) = dragged_and_there(app, a, &ids);
let fresh = library.saturating_sub(there);
if fresh == 0 {
crate::panels::grid::drag_hint(ui.ctx(), crate::i18n::tr_format!("Already in “{}”", a.name));
if released {
app.toast(ui.ctx(), crate::panels::grid::albums_hint());
app.ui.dragging_photos = None;
}
return;
}
crate::panels::grid::drag_hint(
ui.ctx(),
crate::i18n::tr_format!("Add {n} photo{} to “{}”", if fresh == 1 { "" } else { "s" }, a.name, n = fresh),
);
let t = Tokens::get(ui.ctx());
ui.painter().rect_stroke(resp.rect.shrink2(vec2(8.0, 1.0)), 4.0, egui::Stroke::new(1.5, t.accent), egui::StrokeKind::Inside);
if released {
drop_photos_on_album(app, ui, a, ids);
drop_photos_on_album(app, ui, a, ids, there);
app.ui.dragging_photos = None;
}
}
/// Adds the dragged photos to the album and toasts how many went in (and how many Local ones were skipped).
fn drop_photos_on_album(app: &mut LightcraftApp, ui: &egui::Ui, a: &Album, ids: Vec<u64>) {
fn drop_photos_on_album(app: &mut LightcraftApp, ui: &egui::Ui, a: &Album, ids: Vec<u64>, there: usize) {
match app.run("album.addPhotos", json!({"id": a.id.0, "ids": ids})) {
Ok(r) => {
let name = crate::destination::album(&app.session.catalog, a);
app.toast(ui.ctx(), added_message(&name, &r));
app.toast(ui.ctx(), added_message(&name, &r, there));
}
Err(e) => app.toast(ui.ctx(), e),
}
}
/// "Added N photos to “album”", plus a note when Local photos were skipped.
fn added_message(name: &str, r: &serde_json::Value) -> String {
/// "Added N photos to “album”", plus a note when some were there already and when Local photos were skipped.
fn added_message(name: &str, r: &serde_json::Value, there: usize) -> String {
let n = r.get("added").and_then(serde_json::Value::as_u64).unwrap_or(0);
let skipped = r.get("skipped").and_then(serde_json::Value::as_u64).unwrap_or(0);
let mut msg = crate::i18n::tr_format!("Added {n} photo{} to “{}”", if n == 1 { "" } else { "s" }, name, n = n);
if there > 0 {
msg.push_str(" · ");
msg.push_str(&crate::i18n::tr_format!("{n} already there", n = there));
}
if skipped > 0 {
msg.push_str(" · ");
msg.push_str(&skipped_note(skipped));
@@ -1,3 +1,4 @@
use super::albums::refuse_photos;
use super::dates::browse_all_photos;
use super::rows::{INDENT_STEP, Row, out_of_sight, tree_open, tree_toggle};
use super::{Icon, KeywordNode, LightcraftApp, json};
@@ -24,6 +25,13 @@ pub(super) fn keyword_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, nodes: &[
fn keyword_row(app: &mut LightcraftApp, ui: &mut egui::Ui, n: &KeywordNode, id: &str, indent: f32, open_id: Option<egui::Id>, open: &mut bool) {
let sel = app.session.filter.keyword.as_deref().is_some_and(|k| k.eq_ignore_ascii_case(&n.path));
let resp = Row::new(id, Icon::Tag, &n.name).count(Some(n.count)).selected(sel).indent(indent).show(app, ui);
refuse_photos(
app,
ui,
&resp,
crate::i18n::tr("Add keywords in the Keyword List"),
crate::i18n::tr("Give photos a keyword in the Keyword List (Window ▸ Keywords, K): drop them on it there"),
);
if let Some(k) = open_id {
tree_toggle(ui, &resp, indent, k, open, format!("keywordToggle:{}", n.path), &n.name);
}
+2
View File
@@ -431,6 +431,8 @@ fn pressed_commands(app: &LightcraftApp, ctx: &egui::Context) -> (Vec<String>, V
let popup_open = egui::Popup::is_any_open(ctx);
// Esc that just took a text field's focus away (it gives back the field's text) does nothing else
let popup_open = popup_open || app.text_focus;
// a drag in progress: Esc gives it up (where it is dragged) and does nothing else
let popup_open = popup_open || app.ui.drag_active();
ctx.input(|i| {
// Enter opens the active grid photo; widgets, popups and custom bindings keep the key.
if grid
+5
View File
@@ -536,6 +536,11 @@ impl Default for UiState {
}
impl UiState {
/// Whether photos, an album, a sidebar section or a keyword are being dragged.
pub fn drag_active(&self) -> bool {
self.dragging_photos.is_some() || self.dragging_album.is_some() || self.dragging_section.is_some() || self.dragging_keyword.is_some()
}
/// Which colour grading wheels (shadows, midtones, highlights) are hidden for viewing `photo`.
pub fn grading_hidden_for(&self, photo: lightcraft_catalog::PhotoId) -> [bool; 3] {
match self.grading_hidden {
+1
View File
@@ -26,6 +26,7 @@ mod dialog_tab;
mod dialogs;
mod disk_space;
mod docking_acceptance;
mod drag_contract;
mod drop_import;
mod edit_layout;
mod empty_library;
+282
View File
@@ -0,0 +1,282 @@
//! What a drag of photos (or a keyword) promises: Esc gives it up and does nothing else, every row
//! it passes over says what a drop would do, a drop that would do nothing does nothing (no undo
//! step, no toast), and a row that can't take it shows so (the not-allowed cursor and a reason).
use std::time::Duration;
use egui::{Pos2, Rect};
use serde_json::json;
use crate::headless::Headless;
use crate::{LightcraftApp, Services};
const T: Duration = Duration::from_secs(20);
const SETTLE: Duration = Duration::from_secs(120);
/// The demo library in the grid with the sidebar's Albums and Keywords and the Keyword List open,
/// in a window tall enough for every row to be on screen.
fn app() -> Headless {
let services = Services { png: None, ..Default::default() };
let mut h = Headless::new(LightcraftApp::new(lightcraft_engine::Session::with_demo(), services), [1600.0, 2600.0], 1.0);
let hidden = |id: &str| json!({"id": id, "hidden": true});
let r = h.request(
"ui.set",
json!({
"view": "photoGrid", "leftPanel": true, "right": "keywords",
"sidebar": ["albums", "keywords", hidden("local"), hidden("byDate"), hidden("folders")],
}),
T,
);
assert_eq!(r["ok"], true, "{r}");
h.settle(SETTLE);
h
}
fn run(h: &mut Headless, command: &str, params: serde_json::Value) -> serde_json::Value {
let r = h.request("engine.execute", json!({"command": command, "params": params}), T);
assert_eq!(r["ok"], true, "{command}: {r}");
h.settle(SETTLE);
r["result"].clone()
}
fn widget(h: &Headless, id: &str) -> Rect {
h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r).unwrap_or_else(|| panic!("no widget {id}"))
}
fn pointer(h: &mut Headless, at: Pos2, pressed: Option<bool>) {
h.events.push(egui::Event::PointerMoved(at));
if let Some(pressed) = pressed {
h.events.push(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE });
}
h.step();
}
/// Press on `from`, then move to `to` over a few frames, holding.
fn hold(h: &mut Headless, from: Pos2, to: Pos2) {
pointer(h, from, Some(true));
for i in 1..=8 {
pointer(h, from + (to - from) * (i as f32 / 8.0), None);
}
// a few more, so what a row says about the drop has settled
h.step();
h.step();
}
fn release(h: &mut Headless, at: Pos2) {
pointer(h, at, Some(false));
// (not settled: a toast lapses with the frames)
h.step();
h.step();
}
fn esc(h: &mut Headless) {
h.events.push(egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE });
h.step();
h.events.push(egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: false, repeat: false, modifiers: egui::Modifiers::NONE });
h.step();
}
/// What the dragged label says this frame instead of the count, if a drop target set it.
fn hint(h: &Headless) -> Option<String> {
h.view.ctx.data(|d| d.get_temp::<(u64, String)>(egui::Id::new("drag-photos-hint"))).map(|(_, text)| text)
}
fn toast(h: &Headless) -> String {
h.app.ui.toast.clone().map(|t| t.0).unwrap_or_default()
}
fn select(h: &mut Headless, ids: &[u64]) {
run(h, "library.select", json!({"ids": ids}));
}
fn members(h: &Headless, album: u64) -> Vec<u64> {
h.app.session.catalog.album(lightcraft_catalog::AlbumId(album)).map(|a| a.photos.iter().map(|p| p.0).collect()).unwrap_or_default()
}
fn keywords_of(h: &Headless, id: u64) -> Vec<String> {
h.app.session.catalog.photo(lightcraft_catalog::PhotoId(id)).map(|p| p.meta.keywords.clone()).unwrap_or_default()
}
/// Two photos of the grid that are not in `album`, and one that is.
fn photos_around(h: &mut Headless, album: u64) -> (Vec<u64>, u64) {
let held = members(h, album);
let shown: Vec<u64> = h.app.session.visible_cloned().iter().map(|p| p.0).collect();
let outside: Vec<u64> = shown.iter().copied().filter(|id| !held.contains(id)).take(2).collect();
let inside = *held.iter().find(|id| shown.contains(id)).expect("the album holds a photo the grid shows");
(outside, inside)
}
const GARDEN: u64 = 6;
/// Drag the selection `ids` from its first photo to `to`, still holding.
fn drag_photos(h: &mut Headless, ids: &[u64], to: &str) -> Pos2 {
select(h, ids);
let from = widget(h, &format!("thumb:{}", ids[0])).center();
let target = widget(h, to).center();
hold(h, from, target);
assert_eq!(h.app.ui.dragging_photos.as_deref(), Some(ids), "the photos are being dragged");
target
}
#[test]
fn esc_gives_up_a_photo_drag_and_does_nothing_else() {
let mut h = app();
let (outside, _) = photos_around(&mut h, GARDEN);
// Esc's own command (Back: lights out → on) is something the drag must not also trigger
h.app.ui.lights_out = crate::state::LightsOut::Dim;
let before = members(&h, GARDEN);
let undo = h.app.session.undo.len();
let target = drag_photos(&mut h, &outside, &format!("source:album:{GARDEN}"));
esc(&mut h);
assert_eq!(h.app.ui.dragging_photos, None, "given up");
assert_eq!(h.app.ui.lights_out, crate::state::LightsOut::Dim, "Esc only gave up the drag");
assert_eq!(h.app.session.selection.ids.iter().map(|p| p.0).collect::<Vec<_>>(), outside, "the selection stays");
// let go over the album afterwards: nothing is added
release(&mut h, target);
assert_eq!(members(&h, GARDEN), before);
assert_eq!(h.app.session.undo.len(), undo);
assert_eq!(toast(&h), "");
}
#[test]
fn esc_only_gives_up_an_album_or_keyword_drag() {
let mut h = app();
h.app.ui.lights_out = crate::state::LightsOut::Dim;
// an album dragged in the sidebar
let from = widget(&h, &format!("source:album:{GARDEN}")).center();
hold(&mut h, from, from + egui::vec2(0.0, 40.0));
assert_eq!(h.app.ui.dragging_album, Some(GARDEN), "dragging an album");
esc(&mut h);
assert_eq!(h.app.ui.dragging_album, None);
assert_eq!(h.app.ui.lights_out, crate::state::LightsOut::Dim, "an album drag's Esc is its own");
release(&mut h, from);
// a keyword dragged in the Keyword List
let from = widget(&h, "keywordRow:mountains").center();
hold(&mut h, from, from + egui::vec2(0.0, 40.0));
assert_eq!(h.app.ui.dragging_keyword.as_deref(), Some("mountains"));
esc(&mut h);
assert_eq!(h.app.ui.dragging_keyword, None);
assert_eq!(h.app.ui.lights_out, crate::state::LightsOut::Dim, "a keyword drag's Esc is its own");
release(&mut h, from);
// and with nothing dragged, Esc does what it did
esc(&mut h);
assert_eq!(h.app.ui.lights_out, crate::state::LightsOut::On);
}
#[test]
fn an_album_row_says_how_many_photos_a_drop_adds() {
let mut h = app();
let (outside, inside) = photos_around(&mut h, GARDEN);
let before = members(&h, GARDEN);
// two photos that aren't in the album
let target = drag_photos(&mut h, &outside, &format!("source:album:{GARDEN}"));
let said = hint(&h).expect("the row says what a drop does");
assert!(said.contains("2 photos") && said.contains("Garden"), "{said}");
assert!(h.painted_text().contains(&said), "the dragged label shows it");
release(&mut h, target);
assert_eq!(members(&h, GARDEN).len(), before.len() + 2);
assert_eq!(toast(&h), "Added 2 photos to “Garden”");
// one that is there already and one that isn't: only the one counts, and the toast says so
let (fresh, _) = photos_around(&mut h, GARDEN + 1);
let fresh = fresh.into_iter().find(|id| !members(&h, GARDEN).contains(id));
let Some(fresh) = fresh else { return };
let pair = [inside, fresh];
let target = drag_photos(&mut h, &pair, &format!("source:album:{GARDEN}"));
assert!(hint(&h).is_some_and(|t| t.contains("1 photo ") && !t.contains("2 ")), "{:?}", hint(&h));
release(&mut h, target);
assert_eq!(toast(&h), "Added 1 photo to “Garden” · 1 already there");
}
#[test]
fn a_drop_on_an_album_that_adds_nothing_does_nothing() {
let mut h = app();
let (_, inside) = photos_around(&mut h, GARDEN);
let before = members(&h, GARDEN);
let undo = h.app.session.undo.len();
let target = drag_photos(&mut h, &[inside], &format!("source:album:{GARDEN}"));
let said = hint(&h).expect("the row says so");
assert!(said.contains("Garden") && !said.starts_with("Add "), "{said}");
assert_ne!(h.last_cursor, egui::CursorIcon::NotAllowed, "it isn't refused: it is just already there");
release(&mut h, target);
assert_eq!(members(&h, GARDEN), before);
assert_eq!(h.app.session.undo.len(), undo, "no undo step for nothing");
assert_eq!(toast(&h), "", "and nothing to say");
assert_eq!(h.app.ui.dragging_photos, None);
}
#[test]
fn rows_that_cannot_hold_photos_say_so_and_refuse() {
let mut h = app();
let smart = run(&mut h, "album.createSmart", json!({"name": "Fours", "rules": {"rating": 4}}))["id"].as_u64().unwrap();
h.settle(SETTLE);
let (outside, _) = photos_around(&mut h, GARDEN);
let travel_folder = 1u64;
let undo = h.app.session.undo.len();
let albums_before: Vec<_> = h.app.session.catalog.albums().map(|a| (a.id.0, a.photos.len())).collect();
for (row, pointing_at) in [
(format!("source:album:{smart}"), "Edit Smart Album…"),
(format!("source:folder:{travel_folder}"), "inside"),
("source:keyword:mountains".to_string(), "Keyword List"),
] {
let target = drag_photos(&mut h, &outside, &row);
assert_eq!(h.last_cursor, egui::CursorIcon::NotAllowed, "{row}: refused");
assert!(hint(&h).is_some(), "{row}: the dragged label says so");
release(&mut h, target);
assert!(toast(&h).contains(pointing_at), "{row}: the toast says why: {}", toast(&h));
assert_eq!(h.app.ui.dragging_photos, None, "{row}");
assert_eq!(h.app.session.undo.len(), undo, "{row}: nothing changed");
h.app.ui.toast = None;
}
let albums_after: Vec<_> = h.app.session.catalog.albums().map(|a| (a.id.0, a.photos.len())).collect();
assert_eq!(albums_before, albums_after);
}
#[test]
fn a_keyword_row_says_how_many_photos_would_get_it() {
let mut h = app();
let shown: Vec<u64> = h.app.session.visible_cloned().iter().map(|p| p.0).collect();
let (with, without): (Vec<u64>, Vec<u64>) = shown.iter().copied().partition(|id| keywords_of(&h, *id).iter().any(|k| k == "mountains"));
assert!(!with.is_empty() && without.len() >= 2, "the demo has photos with and without the keyword");
let pair = [with[0], without[0], without[1]];
let target = drag_photos(&mut h, &pair, "keywordRow:mountains");
let said = hint(&h).expect("the row says what a drop does");
assert!(said.contains("mountains") && said.contains("2 photos"), "{said}");
release(&mut h, target);
assert!(pair.iter().all(|id| keywords_of(&h, *id).iter().any(|k| k == "mountains")));
}
#[test]
fn a_drop_on_a_keyword_every_photo_has_does_nothing() {
let mut h = app();
let shown: Vec<u64> = h.app.session.visible_cloned().iter().map(|p| p.0).collect();
let with: Vec<u64> = shown.iter().copied().filter(|id| keywords_of(&h, *id).iter().any(|k| k == "mountains")).take(2).collect();
assert!(!with.is_empty());
let undo = h.app.session.undo.len();
let target = drag_photos(&mut h, &with, "keywordRow:mountains");
assert!(hint(&h).is_some_and(|t| !t.starts_with("Add ")), "{:?}", hint(&h));
release(&mut h, target);
assert_eq!(h.app.session.undo.len(), undo, "no undo step for nothing");
assert_eq!(toast(&h), "");
}
#[test]
fn a_keyword_cannot_be_dropped_inside_itself() {
let mut h = app();
run(&mut h, "keyword.create", json!({"name": "Weddings", "parent": "Events"}));
let r = h.request("ui.clickWidget", json!({"id": "keywordRowToggle:Events"}), T);
assert_eq!(r["ok"], true, "{r}");
h.settle(SETTLE);
let tree = |h: &Headless| (h.app.session.catalog.has_keyword("Events|Weddings"), h.app.session.catalog.has_keyword("Weddings"));
assert_eq!(tree(&h), (true, false));
let undo = h.app.session.undo.len();
for over in ["keywordRow:Events", "keywordRow:Events|Weddings"] {
let (from, to) = (widget(&h, "keywordRow:Events").center(), widget(&h, over).center());
hold(&mut h, from, to + egui::vec2(60.0, 3.0));
assert_eq!(h.app.ui.dragging_keyword.as_deref(), Some("Events"), "{over}");
assert_eq!(h.last_cursor, egui::CursorIcon::NotAllowed, "{over}: refused");
assert!(h.painted_text().iter().any(|t| t == "Can't go inside itself"), "{over}: the label says why: {:?}", h.painted_text());
release(&mut h, to);
assert_eq!(tree(&h), (true, false), "{over}: nothing moved");
assert_eq!(h.app.session.undo.len(), undo);
}
}
File diff suppressed because one or more lines are too long
+13 -1
View File
@@ -364,6 +364,19 @@
Denoise ▸ Run on chooses; Automatic times both). Photos
denoised before are denoised again the next time they are needed. See [AI Denoise](denoise.md).
### Drag and drop says what a drop will do
- Photos dragged over an album now say how many a drop adds ("Add 2 photos to “Garden”"), or "Already in “Garden”"
when it holds them all, in which case letting go does nothing at all (no undo step, no message). When some are there
already, the message after the drop says how many. Over the Keyword List, the label says how many photos get the
keyword, or that they all have it.
- Rows that can't take photos now show it instead of staying silent: a smart album, an album folder and the Keywords
in the sidebar show the not-allowed cursor while photos are over them, and letting go says why and where to drop
instead (Edit Smart Album…, an album inside the folder, the Keyword List).
- A keyword dragged over itself or over a keyword inside it shows the not-allowed cursor and says "Can't go inside
itself".
- Esc gives up a drag of photos, as it already did for albums, sidebar sections and keywords, and does nothing else
while the drag lasts (it no longer also leaves full screen or lights back on).
### A right-click on a text field while you carry photos opens no menu
- While you drag photos from the grid, a right-click on a text field, such as the search box, opens no Cut, Copy and
Paste menu. Before, the menu opened over the field the photos were on. Right-clicking a field without a drag works
@@ -408,7 +421,6 @@
reads them back as the same keywords. A sidecar written by an earlier version is put right the next time it is
saved.
### Relative-date filters and smart albums follow the clock
- A current view or source count using “in the last” rules now refreshes when the session clock moves into a new
minute, even when no catalog edit occurred. This fixes stale photos remaining in the grid and stale counts for