mirror of https://codeberg.org/topola/topola.git
refactor(egui): report invoker error one outside of `Interactor`
This commit is contained in:
parent
489f55a8b0
commit
3766ade270
|
|
@ -13,7 +13,7 @@ use topola::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
activity::{ActivityContext, ActivityStatus, ActivityStepperWithStatus},
|
activity::{ActivityContext, ActivityError, ActivityStatus, ActivityStepperWithStatus},
|
||||||
interaction::InteractionContext,
|
interaction::InteractionContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -62,22 +62,21 @@ impl<M: AccessMesadata> Interactor<M> {
|
||||||
self.invoker.replay(history);
|
self.invoker.replay(history);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&mut self) -> ControlFlow<()> {
|
pub fn update(&mut self) -> ControlFlow<Result<(), ActivityError>> {
|
||||||
if let Some(ref mut activity) = self.activity {
|
if let Some(ref mut activity) = self.activity {
|
||||||
return match activity.step(&mut ActivityContext {
|
return match activity.step(&mut ActivityContext {
|
||||||
interaction: InteractionContext {},
|
interaction: InteractionContext {},
|
||||||
invoker: &mut self.invoker,
|
invoker: &mut self.invoker,
|
||||||
}) {
|
}) {
|
||||||
Ok(ActivityStatus::Running) => ControlFlow::Continue(()),
|
Ok(ActivityStatus::Running) => ControlFlow::Continue(()),
|
||||||
Ok(ActivityStatus::Finished(..)) => ControlFlow::Break(()),
|
Ok(ActivityStatus::Finished(..)) => ControlFlow::Break(Ok(())),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
//error_dialog.push_error("tr-module-invoker", format!("{}", err));
|
|
||||||
self.activity = None;
|
self.activity = None;
|
||||||
ControlFlow::Break(())
|
ControlFlow::Break(Err(err))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
ControlFlow::Break(())
|
ControlFlow::Break(Ok(()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn invoker(&self) -> &Invoker<M> {
|
pub fn invoker(&self) -> &Invoker<M> {
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,14 @@ impl Workspace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.interactor.update()
|
match self.interactor.update() {
|
||||||
|
ControlFlow::Continue(()) => ControlFlow::Continue(()),
|
||||||
|
ControlFlow::Break(Ok(())) => ControlFlow::Break(()),
|
||||||
|
ControlFlow::Break(Err(err)) => {
|
||||||
|
error_dialog.push_error("tr-module-invoker", format!("{}", err));
|
||||||
|
ControlFlow::Break(())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_layers(&mut self, ctx: &egui::Context) {
|
pub fn update_layers(&mut self, ctx: &egui::Context) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue