[modules/speedtest] no autostart, improve icons
do not start a speedtest automatically during startup, and improve the icons a bit.
This commit is contained in:
parent
4ac8c2ef7a
commit
4925e09995
3 changed files with 12 additions and 3 deletions
|
@ -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 = "<speedtest>"
|
||||
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":
|
||||
|
|
|
@ -362,5 +362,9 @@
|
|||
},
|
||||
"arandr": {
|
||||
"prefix": " displays "
|
||||
},
|
||||
"speedtest": {
|
||||
"running": { "prefix": [".", "..", "...", ".."] },
|
||||
"not-running": { "prefix": "[start]" }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,7 +283,7 @@
|
|||
"prefix": ""
|
||||
},
|
||||
"speedtest": {
|
||||
"running": { "prefix": "\uf110" },
|
||||
"running": { "prefix": ["\uf251", "\uf252", "\uf253"] },
|
||||
"not-running": { "prefix": "\uf144" }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue