summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/comprehensive9
-rw-r--r--info/blueshift.texinfo9
-rwxr-xr-xsrc/__main__.py17
3 files changed, 28 insertions, 7 deletions
diff --git a/examples/comprehensive b/examples/comprehensive
index 05407b5..d361bea 100644
--- a/examples/comprehensive
+++ b/examples/comprehensive
@@ -6,7 +6,8 @@
# negative image, inverted image, sigmoid correction, or free
# function modifier. Neither does it support multiple screens,
# this is normally not an issue because Xinerama is normally used
-# to put all monitors on the same screen.
+# to put all monitors on the same screen; nor does it parse
+# ad-hoc settings
# Geographical coodinates.
@@ -163,6 +164,12 @@ monitor_controller = lambda : randr(*monitors)
'''
+uses_adhoc_opts = False
+'''
+:bool `True` if the configuration screens parses the ad-hoc settings
+'''
+
+
last_dayness = None
def periodically(year, month, day, hour, minute, second, weekday, fade):
'''
diff --git a/info/blueshift.texinfo b/info/blueshift.texinfo
index 1d0da93..0555cf5 100644
--- a/info/blueshift.texinfo
+++ b/info/blueshift.texinfo
@@ -339,6 +339,15 @@ arguments passed onto the configuration script; and
store information is required to survive a
configuration reload, such as replaced functions.
+If you want to use the settings intended for ad-hoc
+mode, set @code{uses_adhoc_opts} to @code{True}. This
+lets you use @code{parser}, which is an instance of
+@code{ArgParser} (from the argparser library) which
+@code{parser} and @code{support_alternatives} already
+invoked, without a warning being printed. If you do
+not do this, @code{parser} will be @code{None} at the
+time @code{periodically} is first invoked by Blueshift.
+
@node Colour curve manipulators
@section Colour curve manipulators
diff --git a/src/__main__.py b/src/__main__.py
index f432a23..d7827cd 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -31,7 +31,7 @@ PROGRAM_VERSION = '1.7'
## 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_, conf_storage
+global monitor_controller, running, continuous_run, panic, _globals_, conf_storage, parser
global signal_SIGTERM, signal_SIGUSR1, signal_SIGUSR2
@@ -125,6 +125,11 @@ panic = False
:bool `True` if the program has received two terminate signals
'''
+uses_adhoc_opts = False
+'''
+:bool `True` if the configuration screens parses the ad-hoc settings
+'''
+
conf_opts = None
'''
:list<str> This list will never be `None` and it will always have at least
@@ -356,11 +361,6 @@ output = parser.opts['--output']
if output is None:
output = []
-if config_file is not None:
- if any([doreset, location, gammas, rgb_brightnesses, cie_brightnesses, temperatures, output]):
- print('--configurations can only be combined with --panicgate')
- sys.exit(1)
-
a = lambda opt : 0 if parser.opts[opt] is None else len(parser.opts[opt])
for opt in ('--configurations', '--panicgate', '--reset', '--location'):
if a(opt) > 1:
@@ -474,6 +474,11 @@ else:
print('No configuration file found')
sys.exit(1)
+ # Warn about ad-hoc settings
+ if not uses_adhoc_opts:
+ if any([doreset, location, gammas, rgb_brightnesses, cie_brightnesses, temperatures, output]):
+ print('%s: warning: --configurations can only be combined with --panicgate' % sys.argv[0])
+ parser = None
## Run periodically if configured to
if periodically is not None: