From 2005fa3ae8e4745e97a9fc44a4f0ac259a21cc43 Mon Sep 17 00:00:00 2001 From: olf Date: Sun, 15 Mar 2015 13:28:41 +0100 Subject: adapted status script --- scripts/status_script.py | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/scripts/status_script.py b/scripts/status_script.py index a5595ac..1b30d01 100755 --- a/scripts/status_script.py +++ b/scripts/status_script.py @@ -64,26 +64,17 @@ def tweet(status, last_change): else: print "Message too long: " + tweet -def update_css(colors): +def update_css(statusimage): css = ''' -span.sublabopen { - color: %s; -} - -span.sublabclosed { - color: %s; -} - #statusimage { background: url(../img/%s) ; - height: 100px; - width: 100px; - position: absolute; - right: 20px; + height: 40px; + width: 40px; + margin: 5px; } -''' % colors +''' % statusimage path = os.path.realpath(os.path.dirname(__file__)) path = os.path.join(path, '..', 'public', 'css', 'sublab.status.css') @@ -120,14 +111,14 @@ if __name__ == '__main__': # check if status changed, if yes, update css and tweet it if s.door_status() != old_status: if s.door_status() == 'open': - update_css(('#0f0', '#222', 'status-open.png')) + update_css('status-open.png') save_statusfile(STATUSFILE, s.door_status()) tweet('open', last_change) elif s.door_status() == 'closed': save_statusfile(STATUSFILE, s.door_status()) - update_css(('#222', '#f00', 'status-closed.png')) + update_css('status-closed.png') tweet('closed', last_change) else: save_statusfile(STATUSFILE, s.door_status()) - update_css(('#222', '#222', 'status-unknown.png')) + update_css('status-unknown.png') tweet('unknown', last_change) -- cgit v1.2.1