From 04bb00b4cf339bc4481c8169acaa4126ac94accb Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 5 Apr 2014 14:06:13 +0200 Subject: make the previous commit optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2