summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-05 14:06:13 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-05 14:06:13 +0200
commit04bb00b4cf339bc4481c8169acaa4126ac94accb (patch)
treeb379b62406929114cf732b1ca88b0324cd693980
parentmake sure that `reset` runs after an exception (diff)
downloadblueshift-04bb00b4cf339bc4481c8169acaa4126ac94accb.tar.gz
blueshift-04bb00b4cf339bc4481c8169acaa4126ac94accb.tar.bz2
blueshift-04bb00b4cf339bc4481c8169acaa4126ac94accb.tar.xz
make the previous commit optional
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rwxr-xr-xsrc/__main__.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/__main__.py b/src/__main__.py
index b73108b..2b0c9df 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -72,7 +72,7 @@ setproctitle(sys.argv[0])
## Set global variables
-global i_size, o_size, r_curve, g_curve, b_curve, clip_result, reset, panicgate
+global i_size, o_size, r_curve, g_curve, b_curve, clip_result, reset, panicgate, reset_on_error
global periodically, wait_period, fadein_time, fadeout_time, fadein_steps, fadeout_steps
global monitor_controller, running, continuous_run, panic, _globals_, conf_storage, parser
global signal_SIGTERM, signal_SIGUSR1, signal_SIGUSR2, DATADIR, LIBDIR, LIBEXECDIR
@@ -215,6 +215,12 @@ trans_delta = -1
:int In what direction are with transitioning?
'''
+reset_on_error = True # TODO demo and document this
+'''
+:bool Whether to reset the colour curves if the configuration script
+ runs into an exception that it did not handle
+'''
+
## Combine our globals and locals for the
## configuration script to use
@@ -524,9 +530,13 @@ def continuous_run():
# before we sleep. If we did not break
# would would run into errors.
sleep(fadeout_time / fadeout_steps)
+
+ ## Mark that we ant to reset the colour curves
+ reset_on_error = True
finally:
- ## Reset
- reset()
+ ## Reset when done, or on error if not stated otherwise
+ if reset_on_error:
+ reset()
## Read command line arguments