diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-02-19 09:09:50 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-02-19 09:09:50 +0100 |
commit | e7dfa26ce2d9e5aa51adad3964eff2cc72985d9c (patch) | |
tree | 1e310e2643d9a9762ac7cdb7b324b2ec34db2612 | |
parent | extend readme (diff) | |
download | blueshift-e7dfa26ce2d9e5aa51adad3964eff2cc72985d9c.tar.gz blueshift-e7dfa26ce2d9e5aa51adad3964eff2cc72985d9c.tar.bz2 blueshift-e7dfa26ce2d9e5aa51adad3964eff2cc72985d9c.tar.xz |
do not do unneccasary work
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | examples/comprehensive | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/comprehensive b/examples/comprehensive index e1c045e..26abc3c 100644 --- a/examples/comprehensive +++ b/examples/comprehensive @@ -120,6 +120,7 @@ monitor_controller = lambda : randr(*monitors) ''' +last_dayness = None def periodically(year, month, day, hour, minute, second, weekday, fade): ''' :(int, int, int, int, int, int, int, float?)?→void Place holder for periodically invoked function @@ -154,7 +155,12 @@ def periodically(year, month, day, hour, minute, second, weekday, fade): (*) Can be exceeded if the calendar system is changed, like in 1712-(02)Feb-30 (**) See https://en.wikipedia.org/wiki/Leap_second ''' + global last_dayness dayness = get_dayness() + if fade is None: + if dayness == last_dayness: + return + last_dayness = dayness # Help functions for colour interpolation interpol = lambda _day, _night : _day[m % len(_day)] * dayness + _night[m % len(_night)] * (1 - dayness) |