Skip to content

Commit

Permalink
Hide the progress bar when complete
Browse files Browse the repository at this point in the history
  • Loading branch information
Ketok4321 committed Aug 18, 2023
1 parent 6af13a7 commit a559aa6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 38 deletions.
4 changes: 4 additions & 0 deletions src/speedtest_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ def upCallback(speed, progress):
view.progress.add_css_class("up")
view.progress.set_fraction(progress)

GLib.idle_add(view.progress.set_visible, True)

await perform_test(download, self.server, lambda *args: GLib.idle_add(dlCallback, *args), 1 / 30)
await perform_test(upload, self.server, lambda *args: GLib.idle_add(upCallback, *args), 1 / 30)

GLib.idle_add(view.progress.set_visible, False)
except Exception as e:
print(e)
GLib.idle_add(self.win.set_view, self.win.offline_view)
79 changes: 41 additions & 38 deletions src/ui/views/test.blp
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,55 @@ using Adw 1;
template $TestView : Box {
orientation: vertical;

ProgressBar progress {
styles [ "osd" ]
}

Label title {
label: bind template.server;
margin-top: 8;
styles [ "title-3" ]
}

Box {
orientation: horizontal;

$Gauge download {
label: "Download:";
color1: "33d17a";
color2: "62a0ea";

vexpand: true;
hexpand: true;
Overlay {
[overlay]
ProgressBar progress {
styles [ "osd" ]
}

Label title {
label: bind template.server;
margin-top: 8;
styles [ "title-3" ]
}

Box {
orientation: vertical;
valign: end;
width-request: 80;
margin-bottom: 16;

Label {
label: "Ping:";
styles [ "title-2" ]
orientation: horizontal;

$Gauge download {
label: "Download:";
color1: "33d17a";
color2: "62a0ea";

vexpand: true;
hexpand: true;
}

Label {
label: bind template.ping;
styles [ "title-3" ]
Box {
orientation: vertical;
valign: end;
width-request: 80;
margin-bottom: 16;

Label {
label: "Ping:";
styles [ "title-2" ]
}

Label {
label: bind template.ping;
styles [ "title-3" ]
}
}
}

$Gauge upload {
label: "Upload:";
color1: "c061cb";
color2: "1c71d8";
$Gauge upload {
label: "Upload:";
color1: "c061cb";
color2: "1c71d8";

vexpand: true;
hexpand: true;
vexpand: true;
hexpand: true;
}
}
}
}

0 comments on commit a559aa6

Please sign in to comment.