diff --git a/game/src/debug/mod.rs b/game/src/debug/mod.rs index 44ba7eac57..dc94736437 100644 --- a/game/src/debug/mod.rs +++ b/game/src/debug/mod.rs @@ -1063,7 +1063,7 @@ fn draw_arterial_crosswalks(ctx: &mut EventCtx, app: &App) -> Drawable { fn reimport_map(ctx: &mut EventCtx, app: &App) -> Box> { RunCommand::new_state( ctx, - app, + false, vec![ find_exe("importer"), "--map".to_string(), diff --git a/game/src/sandbox/gameplay/freeform/importers.rs b/game/src/sandbox/gameplay/freeform/importers.rs index 26a2efbb16..d9d62b2b55 100644 --- a/game/src/sandbox/gameplay/freeform/importers.rs +++ b/game/src/sandbox/gameplay/freeform/importers.rs @@ -21,7 +21,7 @@ pub fn import_grid2demand(ctx: &mut EventCtx) -> Transition { if let Ok(Some(path)) = maybe_path { Transition::Replace(RunCommand::new_state( ctx, - app, + true, vec![ find_exe("import_grid2demand"), format!("--map={}", app.primary.map.get_name().path()), diff --git a/map_gui/src/tools/command.rs b/map_gui/src/tools/command.rs index 2479c16c07..a8accdee66 100644 --- a/map_gui/src/tools/command.rs +++ b/map_gui/src/tools/command.rs @@ -20,6 +20,7 @@ pub struct RunCommand { max_capacity: usize, started: Instant, last_drawn: Instant, + show_success_popup: bool, // Wrapped in an Option just to make calling from event() work. The bool is success, and the // strings are the last lines of output. on_load: Option) -> Transition>>, @@ -28,7 +29,7 @@ pub struct RunCommand { impl RunCommand { pub fn new_state( ctx: &mut EventCtx, - _: &A, + show_success_popup: bool, args: Vec, on_load: Box) -> Transition>, ) -> Box> { @@ -57,6 +58,7 @@ impl RunCommand { max_capacity, started: Instant::now(), last_drawn: Instant::now(), + show_success_popup, on_load: Some(on_load), }) } @@ -150,15 +152,18 @@ impl State for RunCommand { if !success { lines.push(format!("Command failed: {:?}", status)); } - return Transition::Multi(vec![ + let mut transitions = vec![ Transition::Pop, (self.on_load.take().unwrap())(ctx, app, success, lines.clone()), - Transition::Push(PopupMsg::new_state( + ]; + if !success || self.show_success_popup { + transitions.push(Transition::Push(PopupMsg::new_state( ctx, if success { "Success!" } else { "Failure!" }, lines, - )), - ]); + ))); + } + return Transition::Multi(transitions); } Transition::Keep diff --git a/map_gui/src/tools/importer.rs b/map_gui/src/tools/importer.rs index 6c058cbaa4..e44b9194b4 100644 --- a/map_gui/src/tools/importer.rs +++ b/map_gui/src/tools/importer.rs @@ -85,7 +85,7 @@ impl ImportCity { } impl State for ImportCity { - fn event(&mut self, ctx: &mut EventCtx, app: &mut A) -> Transition { + fn event(&mut self, ctx: &mut EventCtx, _: &mut A) -> Transition { match self.panel.event(ctx) { Outcome::Clicked(x) => match x.as_ref() { "close" => Transition::Pop, @@ -106,7 +106,7 @@ impl State for ImportCity { match grab_geojson_from_clipboard() { Ok(()) => Transition::Push(crate::tools::RunCommand::new_state( ctx, - app, + true, args, Box::new(|_, _, success, mut lines| { if success {