Import: dropped and picked files show an Importing card (#270)
Files dropped on the window or picked in the Import dialog were probed
one after the other on the UI thread: the app froze while a video was
read, nothing said what was being imported or how many files were
left, and only the last new item was selected. People ended up
importing the same file again and again.
file.import takes `background`: the files are probed in a background
job (Window > Progress, jobs.list / jobs.cancel) that names the file
being read and how many there are ("b.png (2 of 3)"); then they are
added in one undo step, all selected (the Project panel scrolls to
them, a file already in the project arrives again as in After
Effects) and a toast reports the count ("Imported 3 items", with the
first error). Drops and the Import dialog use it, and an Importing
card at the bottom left shows the job with its progress bar and
Cancel. Agents and scripts still import at once by default. The
toast registers an automation id.
Test: background_imports_report_progress_and_select_what_arrived
(engine), dropped_files_show_import_progress_then_the_items_they_made
(ui_drag_drop).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
285297ed93
commit
3318cb0da1
@@ -1383,7 +1383,7 @@ impl EffectcraftApp {
|
||||
self.session.poll_mask_track();
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(50));
|
||||
}
|
||||
// Background tasks (Content-Aware Fill, Scene Edit Detection).
|
||||
// Background tasks (Content-Aware Fill, Scene Edit Detection, imports).
|
||||
if !self.session.tasks.is_empty() {
|
||||
self.session.poll_jobs();
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(100));
|
||||
@@ -1451,10 +1451,13 @@ impl EffectcraftApp {
|
||||
panels::scriptui_view::sync_panels(self);
|
||||
panels::scriptui_view::show_windows(self, &ctx);
|
||||
panels::learn::coach(self, &ctx);
|
||||
self.draw_toast(ui, full);
|
||||
let lift = panels::media_panels::import_card(self, ui, full);
|
||||
self.draw_toast(ui, full, lift);
|
||||
}
|
||||
|
||||
fn draw_toast(&mut self, ui: &mut egui::Ui, full: egui::Rect) {
|
||||
/// The status message or the latest toast, bottom left (`lift` points higher while the
|
||||
/// Importing card is there).
|
||||
fn draw_toast(&mut self, ui: &mut egui::Ui, full: egui::Rect, lift: f32) {
|
||||
let now = ui.input(|i| i.time);
|
||||
let msg = if !self.ui.status.is_empty() {
|
||||
Some(self.ui.status.clone())
|
||||
@@ -1463,11 +1466,12 @@ impl EffectcraftApp {
|
||||
};
|
||||
if let Some(m) = msg {
|
||||
let t = &self.tokens;
|
||||
let galley = ui.painter().layout_no_wrap(m, Tokens::ui(12.0), t.text);
|
||||
let r = egui::Rect::from_min_size(egui::pos2(full.min.x + 16.0, full.max.y - 44.0), galley.size() + egui::vec2(24.0, 14.0));
|
||||
let galley = ui.painter().layout_no_wrap(m.clone(), Tokens::ui(12.0), t.text);
|
||||
let r = egui::Rect::from_min_size(egui::pos2(full.min.x + 16.0, full.max.y - 44.0 - lift), galley.size() + egui::vec2(24.0, 14.0));
|
||||
ui.painter().rect_filled(r, 6.0, t.panel_bg);
|
||||
ui.painter().rect_stroke(r, 6.0, egui::Stroke::new(1.0, t.field_border), egui::StrokeKind::Inside);
|
||||
ui.painter().galley(r.min + egui::vec2(12.0, 7.0), galley, t.text);
|
||||
self.auto.add("toast", r, &m);
|
||||
let resp = ui.interact(r, egui::Id::new("toast"), egui::Sense::click());
|
||||
if resp.clicked() {
|
||||
self.ui.status.clear();
|
||||
|
||||
Reference in New Issue
Block a user