Checks for internet connection before running backends.
This commit is contained in:
parent
0b507807bc
commit
3496a7bae5
@ -1,4 +1,5 @@
|
||||
from i3pystatus import SettingsBase, IntervalModule, formatp
|
||||
from i3pystatus.core.util import internet
|
||||
|
||||
|
||||
class Backend(SettingsBase):
|
||||
@ -41,8 +42,10 @@ class Updates(IntervalModule):
|
||||
|
||||
settings = (
|
||||
("backends", "Required list of backends used to check for updates."),
|
||||
("format", "String shown when updates are availible. May contain formatters."),
|
||||
("format_no_updates", "String that is shown if no updates are available. If not set the module will be hidden if no updates are available."),
|
||||
("format", "String shown when updates are availible. "
|
||||
"May contain formatters."),
|
||||
("format_no_updates", "String that is shown if no updates are available."
|
||||
" If not set the module will be hidden if no updates are available."),
|
||||
"color",
|
||||
"color_no_updates",
|
||||
("interval", "Default interval is set to one hour."),
|
||||
@ -63,6 +66,10 @@ class Updates(IntervalModule):
|
||||
return
|
||||
|
||||
def run(self):
|
||||
if not internet():
|
||||
self.logger.info("Updates: No internet connection.")
|
||||
return
|
||||
|
||||
updates_count = 0
|
||||
for backend in self.backends:
|
||||
updates_count += backend.updates
|
||||
|
Loading…
Reference in New Issue
Block a user