summaryrefslogtreecommitdiffstats
path: root/src/__main__.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-19 00:01:12 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-19 00:01:12 +0100
commitd436a8627469cb08a2dc5fcc45051079da51fb5f (patch)
treecdec13961947e98a1c0a566f38d2cefca4fffc89 /src/__main__.py
parentchange prio on info (diff)
downloadblueshift-d436a8627469cb08a2dc5fcc45051079da51fb5f.tar.gz
blueshift-d436a8627469cb08a2dc5fcc45051079da51fb5f.tar.bz2
blueshift-d436a8627469cb08a2dc5fcc45051079da51fb5f.tar.xz
misc fixes + comperhensive example currently without option support
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rwxr-xr-xsrc/__main__.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/__main__.py b/src/__main__.py
index baf0922..9ae00e3 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -162,7 +162,7 @@ def continuous_run():
try:
wd = t.isocalendar()[2]
periodically(t.year, t.month, t.day, t.hour, t.minute, t.second, wd, fade)
- except:
+ except KeyboardInterrupt:
signal_SIGTERM(0, None)
def sleep(seconds):
try:
@@ -176,6 +176,8 @@ def continuous_run():
## Fade in
early_exit = False
ftime = 0
+ if fadein_steps <= 0:
+ fadein_time = None
if (fadein_time is not None) and not panicgate:
dtime = fadein_time / fadein_steps
df = 1 / fadein_steps
@@ -196,6 +198,8 @@ def continuous_run():
sleep(wait_period)
## Fade out
+ if fadeout_steps <= 0:
+ fadeout_time = None
if fadeout_time is not None:
dtime = fadeout_time / fadeout_steps
df = 1 / fadeout_steps
@@ -288,7 +292,8 @@ if (config_file is None) and any([doreset, location] + settings):
elif len(temperatures) == 1:
temperatures *= 2
settings = [gammas, rgb_brightnesses, cie_brightnesses, temperatures, [location]]
- settings = [None if c is None else [[float(y) for y in x.split(':')] for x in c] for c in settings]
+ s = lambda f, v : f(v) if v is not None else None
+ settings = [s(lambda c : [s(lambda x : [float(y) for y in x.split(':')], x) for x in c], c) for c in settings]
[gammas, rgb_brightnesses, cie_brightnesses, temperatures, location] = settings
location = None if location is None else location[0]
alpha = lambda : 1