PEP 8 (I'm bored): uptime

This commit is contained in:
enkore 2014-10-14 16:44:40 +02:00
parent ac58db5811
commit d1725228d0

View File

@ -1,34 +1,33 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from i3pystatus import IntervalModule, formatp from i3pystatus import IntervalModule, formatp
from i3pystatus.core.util import TimeWrapper from i3pystatus.core.util import TimeWrapper
class Uptime(IntervalModule): class Uptime(IntervalModule):
""" """
Outputs Uptime Outputs Uptime
""" """
settings = ( settings = (
("format","Format string"), ("format", "Format string"),
("color","String color"), ("color", "String color"),
("alert","If you want the string to change color"), ("alert", "If you want the string to change color"),
("seconds_alert","How many seconds necessary to start the alert"), ("seconds_alert", "How many seconds necessary to start the alert"),
("color_alert","Alert color"), ("color_alert", "Alert color"),
) )
file = "/proc/uptime" file = "/proc/uptime"
format = "up {uptime}" format = "up {uptime}"
color = "#ffffff" color = "#ffffff"
alert = False alert = False
seconds_alert = 3600 seconds_alert = 3600
color_alert = "#ff0000" color_alert = "#ff0000"
def run(self): def run(self):
with open(self.file,'r') as f: with open(self.file, "r") as f:
seconds = float(f.read().split()[0]) seconds = float(f.read().split()[0])
fdict = { fdict = {
"uptime" : TimeWrapper(seconds, "%h:%m"), "uptime": TimeWrapper(seconds, "%h:%m"),
} }
if self.alert: if self.alert: