Large STEP imports: no more multi-minute hang, shared STEP text, cancel and progress (#925)
This commit is contained in:
1 parent
dfbf7dd6a8
commit
2f91338d3d
18 files changed
+525
-45
No files matched your search
@@ -474,6 +474,8 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
};
|
||||
let phase = r.phase.load(Ordering::Relaxed);
|
||||
let (done, total) = r.progress.features();
|
||||
// Long work inside one feature (a large STEP file) has progress of its own.
|
||||
let work = r.progress.work().filter(|(_, d, t)| phase == 0 && d < t);
|
||||
let screen = ctx.content_rect();
|
||||
// Leave the title bar to the window. The resize edges are a foreground layer above this.
|
||||
let cover = egui::Rect::from_min_max(egui::pos2(screen.left(), screen.top() + crate::toolbar::APP_BAR_HEIGHT), screen.max);
|
||||
@@ -538,16 +540,22 @@ pub fn show(app: &mut SolveApp, ctx: &egui::Context) {
|
||||
ui.label(if cancelled {
|
||||
"Waiting for the previous operation to stop...".to_string()
|
||||
} else {
|
||||
match phase {
|
||||
1 => "Preparing the view...".into(),
|
||||
2 => "Preparing the thumbnail...".into(),
|
||||
match (phase, work) {
|
||||
(_, Some(("reading", d, t))) => format!("Reading the file... {}%", d * 100 / t.max(1)),
|
||||
(_, Some((_, d, t))) => format!("Converting solid {} of {t}", d + 1),
|
||||
(1, _) => "Preparing the view...".into(),
|
||||
(2, _) => "Preparing the thumbnail...".into(),
|
||||
_ if total > 0 => format!("Rebuilding feature {} of {total}", (done + 1).min(total)),
|
||||
_ => "Reading the file...".into(),
|
||||
}
|
||||
});
|
||||
});
|
||||
// Always there, so the card keeps its height as the phases change.
|
||||
let fraction = if cancelled || total == 0 {
|
||||
let fraction = if cancelled {
|
||||
0.0
|
||||
} else if let Some((_, d, t)) = work {
|
||||
d as f32 / t.max(1) as f32
|
||||
} else if total == 0 {
|
||||
0.0
|
||||
} else if phase == 0 {
|
||||
done as f32 / total as f32
|
||||
|
||||
Reference in new issue
Block a user