Skip to content

Commit

Permalink
Make sure loading bar in model selector is visible on start up
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbejar committed Jul 25, 2024
1 parent 454f109 commit 51070b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/chat/model_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ live_design! {
loading = <ModelSelectorLoading> {
width: Fill,
height: Fill,
visible: false,
}

choose = <View> {
Expand Down Expand Up @@ -315,7 +314,7 @@ impl ModelSelector {
self.model_selector_loading(id!(loading))
.show_and_animate(cx);
} else {
self.model_selector_loading(id!(loading)).hide(cx);
self.model_selector_loading(id!(loading)).hide();
}
}

Expand Down Expand Up @@ -358,7 +357,6 @@ impl ModelSelector {
let size = format_model_size(&downloaded_file.file.size).unwrap_or("".to_string());
let size_visible = !size.trim().is_empty();

self.model_selector_loading(id!(loading)).hide(cx);
self.view(id!(selected)).apply_over(
cx,
live! {
Expand Down
10 changes: 4 additions & 6 deletions src/chat/model_selector_loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,13 @@ impl Widget for ModelSelectorLoading {

impl ModelSelectorLoading {
pub fn update_animation(&mut self, cx: &mut Cx) {
self.visible = true;
if self.animator_in_state(cx, id!(line.restart)) {
self.visible = true;
self.animator_play(cx, id!(line.run));
self.timer = cx.start_timeout(1.5);
} else {
self.visible = true;
self.animator_play(cx, id!(line.restart));
self.timer = cx.start_timeout(1.5);
}
self.timer = cx.start_timeout(1.5);
}
}

Expand All @@ -123,11 +121,11 @@ impl ModelSelectorLoadingRef {
}
}

pub fn hide(&mut self, cx: &mut Cx) {
pub fn hide(&mut self) {
let Some(mut inner) = self.borrow_mut() else {
return;
};
inner.view.visible = false;
inner.visible = false;
inner.timer = Timer::default();
}
}

0 comments on commit 51070b2

Please sign in to comment.