mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
fix progressbar animation
This commit is contained in:
parent
2a9564bec6
commit
44c68675b2
1 changed files with 7 additions and 4 deletions
|
|
@ -139,9 +139,9 @@ impl Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&self, progress_fraction: Option<f64>) {
|
pub fn update(&self, progress_fraction: Option<f64>) {
|
||||||
// Skip update animation for Non value
|
// Skip update animation for None value
|
||||||
if let Some(value) = progress_fraction {
|
if let Some(value) = progress_fraction {
|
||||||
// Update shared fraction value for async progressbar function, animate on changed only
|
// Update shared fraction on new value was changed
|
||||||
if value != self.progress.fraction.replace(value) {
|
if value != self.progress.fraction.replace(value) {
|
||||||
// Start new frame on previous process function completed (`source_id` changed to None)
|
// Start new frame on previous process function completed (`source_id` changed to None)
|
||||||
// If previous process still active, we have just updated shared fraction value before, to use it inside the active process
|
// If previous process still active, we have just updated shared fraction value before, to use it inside the active process
|
||||||
|
|
@ -167,8 +167,11 @@ impl Widget {
|
||||||
// Deactivate
|
// Deactivate
|
||||||
progress.source_id.replace(None);
|
progress.source_id.replace(None);
|
||||||
|
|
||||||
// Reset (to hide progress widget)
|
// Reset on 100% (to hide progress bar)
|
||||||
gobject.set_progress_fraction(0.0);
|
// or, just await for new value request
|
||||||
|
if gobject.progress_fraction() == 1.0 {
|
||||||
|
gobject.set_progress_fraction(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
// Stop iteration
|
// Stop iteration
|
||||||
ControlFlow::Break
|
ControlFlow::Break
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue