From 4925e09995b6b65e603caf0c2c7e45ef24925d04 Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Fri, 26 Jun 2020 09:40:35 +0200 Subject: [PATCH] [modules/speedtest] no autostart, improve icons do not start a speedtest automatically during startup, and improve the icons a bit. --- bumblebee_status/modules/core/speedtest.py | 9 +++++++-- themes/icons/ascii.json | 4 ++++ themes/icons/awesome-fonts.json | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bumblebee_status/modules/core/speedtest.py b/bumblebee_status/modules/core/speedtest.py index aa07a16..947666a 100644 --- a/bumblebee_status/modules/core/speedtest.py +++ b/bumblebee_status/modules/core/speedtest.py @@ -7,6 +7,8 @@ Requires the following python module: """ +import sys + import core.module import core.widget import core.input @@ -22,7 +24,7 @@ class Module(core.module.Module): super().__init__(config, theme, []) self.background = True - self.__result = "waiting" + self.__result = "" self.__running = False start = self.add_widget(name="start") @@ -34,10 +36,12 @@ class Module(core.module.Module): return self.__result def update_event(self, _): + self.__running = True self.update() def update(self): - self.__running = True + if not self.__running: + return core.event.trigger("update", [self.id], redraw_only=True) s = speedtest.Speedtest() s.get_best_server() @@ -50,6 +54,7 @@ class Module(core.module.Module): s.results.upload / 1024 / 1024, ) self.__running = False + core.event.trigger("update", [self.id], redraw_only=True) def state(self, widget): if widget.name == "start": diff --git a/themes/icons/ascii.json b/themes/icons/ascii.json index 1913752..ba2f414 100644 --- a/themes/icons/ascii.json +++ b/themes/icons/ascii.json @@ -362,5 +362,9 @@ }, "arandr": { "prefix": " displays " + }, + "speedtest": { + "running": { "prefix": [".", "..", "...", ".."] }, + "not-running": { "prefix": "[start]" } } } diff --git a/themes/icons/awesome-fonts.json b/themes/icons/awesome-fonts.json index f524de3..d6b2eb5 100644 --- a/themes/icons/awesome-fonts.json +++ b/themes/icons/awesome-fonts.json @@ -283,7 +283,7 @@ "prefix": "" }, "speedtest": { - "running": { "prefix": "\uf110" }, + "running": { "prefix": ["\uf251", "\uf252", "\uf253"] }, "not-running": { "prefix": "\uf144" } } }