summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/comprehensive4
-rw-r--r--info/blueshift.texinfo5
-rwxr-xr-xsrc/__main__.py11
3 files changed, 17 insertions, 3 deletions
diff --git a/examples/comprehensive b/examples/comprehensive
index aa69f7d..9b9bf36 100644
--- a/examples/comprehensive
+++ b/examples/comprehensive
@@ -260,6 +260,10 @@ if get_dayness is not None:
# Transition on exit in the same way, calculated on exit.
old_signal_SIGTERM = signal_SIGTERM
+ if 'SIGTERM' not in conf_storage:
+ conf_storage['SIGTERM'] = old_signal_SIGTERM
+ else:
+ old_signal_SIGTERM = conf_storage['SIGTERM']
def signal_SIGTERM(signum, frame):
global fadeout_time, fadeout_steps
fadeout_time = 5 * (1 - get_dayness())
diff --git a/info/blueshift.texinfo b/info/blueshift.texinfo
index 239c756..c4f7242 100644
--- a/info/blueshift.texinfo
+++ b/info/blueshift.texinfo
@@ -530,7 +530,10 @@ the second time a SIGTERM signal has been received.
Additionally if the variable @code{panicgate}
is @code{True}, there is no fading when the program
starts. And @code{conf_opts} is a list of command line
-arguments passed onto the configuration script.
+arguments passed onto the configuration script; and
+@code{conf_storage} is a dictionary can be used to
+store information is required to survive a
+configuration reload, such as replaced functions.
The parameterless function @code{continuous_run},
may replace if you want to do something very special,
diff --git a/src/__main__.py b/src/__main__.py
index 0d22f77..74c7ebe 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -31,8 +31,8 @@ PROGRAM_VERSION = '1.2'
## Set global variables
global DATADIR, i_size, o_size, r_curve, g_curve, b_curve, clip_result, reset, panicgate
global periodically, wait_period, fadein_time, fadeout_time, fadein_steps, fadeout_steps
-global monitor_controller, running, continuous_run, panic, _globals_
-global signal_SIGTERM
+global monitor_controller, running, continuous_run, panic, _globals_, conf_storage
+global signal_SIGTERM, signal_SIGUSR1
from solar import *
@@ -131,6 +131,13 @@ conf_opts = None
configurations, with the first element being the configuration file
'''
+conf_storage = {}
+'''
+:dict<?, ?> A place for you to store information that is required to survive
+ a configuration reload
+'''
+
+
def reset():
'''
Invoked to reset the displays